Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] llvm9
@ 2019-09-22 22:50 voidlinux-github
  2019-09-22 23:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
                   ` (49 more replies)
  0 siblings, 50 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-22 22:50 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [ ] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [ ] shiboken2

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ]  bpftrace
- [ ] chromium **[need help, won't build here]**
- [ ]  qtcreator
- [ ]  gnome-builder
- [ ]  codelite
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 926feae8b9b306f094c45692a43f13d46b54b4c2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 1/6] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From eca941e81078a3fca2e8239f776c13ca8089aaae Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 2/6] New package: llvm9-9.0.0

---
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 282 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 21 files changed, 653 insertions(+)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/srcpkgs/clang b/srcpkgs/clang
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..79ee7357a4d
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,282 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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 python zlib-devel libffi-devel swig"
+makedepends="python-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+
+_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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python"
+	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() {
+	depends="clang-${version}_${revision} python"
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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+=" python-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python-six instead of conflicting
+		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.a"
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 4aa5d76b785fa5bd11509fd6d858d02de3488076 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 3/6] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 0e08795590040e99c7526ce2ef36b14460ee0170 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 4/6] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From caf6cd14675dfcc6e08aa87a64be04ddb2fb490d Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 5/6] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..3486cc2dd2c 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From e9b144e5222318ec123be541048de09e2c5ea365 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 6/6] libcxxabi: update to 9.0.0

[ci skip]
---
 srcpkgs/libcxxabi/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..cb72f242c47 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -16,8 +16,8 @@ license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
  2019-09-22 23:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
@ 2019-09-22 23:29 ` voidlinux-github
  2019-09-22 23:40 ` llvm9 voidlinux-github
                   ` (47 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-22 23:29 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [ ] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [ ] shiboken2
- [ ]  codelite

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ]  bpftrace
- [ ] chromium **[need help, won't build here]**
- [ ]  qtcreator
- [ ]  gnome-builder
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 926feae8b9b306f094c45692a43f13d46b54b4c2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 1/6] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From a4339c45a835f9811bad9c2388e9ff82b1ad55b1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 2/6] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 281 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 22 files changed, 657 insertions(+), 3 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..ec52da28460 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,15 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.0.0_1
 libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLTO.so.9 libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..eb8a7a06af4
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,281 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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 python zlib-devel libffi-devel swig"
+makedepends="python-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+
+_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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python"
+	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() {
+	depends="clang-${version}_${revision} python"
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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+=" python-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python-six instead of conflicting
+		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From c1171b47f684119f3025ec7acf52c2f9a6d9b3e6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 3/6] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From ba435b736b7d458f489d24e3c679e580e58481f7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 4/6] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From c21d710d3d984c40bfe1002afbd96af96bc01dab Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 5/6] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..3486cc2dd2c 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From d864eedd131dba50b9ba6cfcf76d600fd217aebc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 6/6] libcxxabi: update to 9.0.0

[ci skip]
---
 srcpkgs/libcxxabi/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..cb72f242c47 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -16,8 +16,8 @@ license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
@ 2019-09-22 23:29 ` voidlinux-github
  2019-09-22 23:29 ` voidlinux-github
                   ` (48 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-22 23:29 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [ ] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [ ] shiboken2
- [ ]  codelite

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ]  bpftrace
- [ ] chromium **[need help, won't build here]**
- [ ]  qtcreator
- [ ]  gnome-builder
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 926feae8b9b306f094c45692a43f13d46b54b4c2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 1/6] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From a4339c45a835f9811bad9c2388e9ff82b1ad55b1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 2/6] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 281 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 22 files changed, 657 insertions(+), 3 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..ec52da28460 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,15 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.0.0_1
 libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLTO.so.9 libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..eb8a7a06af4
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,281 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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 python zlib-devel libffi-devel swig"
+makedepends="python-devel zlib-devel libffi-devel libedit-devel
+ libxml2-devel binutils-devel libatomic-devel"
+depends="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+
+_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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	pycompile_dirs="usr/share/scan-view"
+	depends="clang-${version}_${revision} python"
+	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() {
+	depends="clang-${version}_${revision} python"
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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+=" python-six"
+	short_desc+=" - LLDB debugger"
+	homepage="https://lldb.llvm.org/"
+	pkg_install() {
+		vmove usr/bin/*lldb*
+		vmove usr/lib/liblldb*so.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python-six instead of conflicting
+		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From c1171b47f684119f3025ec7acf52c2f9a6d9b3e6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 3/6] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From ba435b736b7d458f489d24e3c679e580e58481f7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 4/6] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From c21d710d3d984c40bfe1002afbd96af96bc01dab Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 5/6] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..3486cc2dd2c 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From d864eedd131dba50b9ba6cfcf76d600fd217aebc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 6/6] libcxxabi: update to 9.0.0

[ci skip]
---
 srcpkgs/libcxxabi/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..cb72f242c47 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -16,8 +16,8 @@ license="NCSA, MIT"
 homepage="https://libcxxabi.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
  2019-09-22 23:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
  2019-09-22 23:29 ` voidlinux-github
@ 2019-09-22 23:40 ` voidlinux-github
  2019-09-22 23:52 ` llvm9 voidlinux-github
                   ` (46 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-22 23:40 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-533929002

Comment:
This will need a few more iterations before it at least builds properly on my machine, so wait with testing until I've done so...

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (2 preceding siblings ...)
  2019-09-22 23:40 ` llvm9 voidlinux-github
@ 2019-09-22 23:52 ` voidlinux-github
  2019-09-23  0:34 ` [PR PATCH] [Updated] llvm9 voidlinux-github
                   ` (45 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-22 23:52 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-533929850

Comment:
Also switching llvm to py3 while at it.

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (3 preceding siblings ...)
  2019-09-22 23:52 ` llvm9 voidlinux-github
@ 2019-09-23  0:34 ` voidlinux-github
  2019-09-23  0:34 ` voidlinux-github
                   ` (44 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23  0:34 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [ ] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [ ] shiboken2
- [ ] codelite
- [ ] gnome-builder
- [ ] bpftrace
- [ ] qtcreator
- [ ] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 7472011d78b92c083d20f293d33982c43e4f7aba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/12] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 64f3db5dbe760b129a31191288bb9ce3541d31e2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/12] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 22 files changed, 658 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 4485daaf96ed3621a852ad41092c2f7a4e3bf9dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/12] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 94a5f7b42238816e9515d2bce6dfd6af00953eed Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/12] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From cdeaef596776f137529f09ceaad6e7da89ca6fd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 05/12] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From a32d3e6867acfcf4408fa4da2b489f3e24f27809 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 06/12] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 99300e986f14bd16b069ab35034744366a54205a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/12] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From dc22c9b0a9d2e52ae81b9e23ccc82cc2e8af8ec4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/12] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From af3abc772b091ea1c2ce78d51446c4b27f6c8059 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/12] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From de6d35347924827337a6f03c4788650aad36b699 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/12] qt5: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From f1a08df4185f7feba9bac1cbf2aabce5cd991ca3 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/12] shiboken2: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 97e96395858bb0a50a0e164ea3b6222380b86c4b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/12] codelite: rebuild for lldb-9.0.0

[ci skip]
---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (4 preceding siblings ...)
  2019-09-23  0:34 ` [PR PATCH] [Updated] llvm9 voidlinux-github
@ 2019-09-23  0:34 ` voidlinux-github
  2019-09-23  0:35 ` llvm9 voidlinux-github
                   ` (43 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23  0:34 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [ ] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [ ] shiboken2
- [ ] codelite
- [ ] gnome-builder
- [ ] bpftrace
- [ ] qtcreator
- [ ] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 7472011d78b92c083d20f293d33982c43e4f7aba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/12] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 64f3db5dbe760b129a31191288bb9ce3541d31e2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/12] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 22 files changed, 658 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 4485daaf96ed3621a852ad41092c2f7a4e3bf9dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/12] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 94a5f7b42238816e9515d2bce6dfd6af00953eed Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/12] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From cdeaef596776f137529f09ceaad6e7da89ca6fd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 05/12] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From a32d3e6867acfcf4408fa4da2b489f3e24f27809 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 06/12] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 99300e986f14bd16b069ab35034744366a54205a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/12] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From dc22c9b0a9d2e52ae81b9e23ccc82cc2e8af8ec4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/12] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From af3abc772b091ea1c2ce78d51446c4b27f6c8059 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/12] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From de6d35347924827337a6f03c4788650aad36b699 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/12] qt5: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From f1a08df4185f7feba9bac1cbf2aabce5cd991ca3 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/12] shiboken2: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 97e96395858bb0a50a0e164ea3b6222380b86c4b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/12] codelite: rebuild for lldb-9.0.0

[ci skip]
---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (5 preceding siblings ...)
  2019-09-23  0:34 ` voidlinux-github
@ 2019-09-23  0:35 ` voidlinux-github
  2019-09-23  1:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
                   ` (42 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23  0:35 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-533933316

Comment:
py3 transition done, llvm is now buildable... i think testing can begin

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (7 preceding siblings ...)
  2019-09-23  1:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
@ 2019-09-23  1:29 ` voidlinux-github
  2019-09-23  2:34 ` voidlinux-github
                   ` (40 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23  1:29 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [x] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [x] shiboken2
- [ ] codelite
- [ ] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 7472011d78b92c083d20f293d33982c43e4f7aba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/12] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 64f3db5dbe760b129a31191288bb9ce3541d31e2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/12] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 22 files changed, 658 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 4485daaf96ed3621a852ad41092c2f7a4e3bf9dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/12] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 94a5f7b42238816e9515d2bce6dfd6af00953eed Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/12] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From cdeaef596776f137529f09ceaad6e7da89ca6fd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 05/12] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From a32d3e6867acfcf4408fa4da2b489f3e24f27809 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 06/12] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 99300e986f14bd16b069ab35034744366a54205a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/12] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From dc22c9b0a9d2e52ae81b9e23ccc82cc2e8af8ec4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/12] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From af3abc772b091ea1c2ce78d51446c4b27f6c8059 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/12] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 0a9e406414e8e06580c94cbbd4c9eec9d5c32cc5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/12] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 220dd5c221421e5332a75d8533a98110fb9da74e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/12] shiboken2: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 5978d28841d61ccd06ba8840b66453ee5e48939d Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/12] codelite: rebuild for lldb-9.0.0

[ci skip]
---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (6 preceding siblings ...)
  2019-09-23  0:35 ` llvm9 voidlinux-github
@ 2019-09-23  1:29 ` voidlinux-github
  2019-09-23  1:29 ` voidlinux-github
                   ` (41 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23  1:29 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [x] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [x] shiboken2
- [ ] codelite
- [ ] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 7472011d78b92c083d20f293d33982c43e4f7aba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/12] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 64f3db5dbe760b129a31191288bb9ce3541d31e2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/12] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 22 files changed, 658 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 4485daaf96ed3621a852ad41092c2f7a4e3bf9dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/12] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 94a5f7b42238816e9515d2bce6dfd6af00953eed Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/12] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From cdeaef596776f137529f09ceaad6e7da89ca6fd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 05/12] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From a32d3e6867acfcf4408fa4da2b489f3e24f27809 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 06/12] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 99300e986f14bd16b069ab35034744366a54205a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/12] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From dc22c9b0a9d2e52ae81b9e23ccc82cc2e8af8ec4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/12] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From af3abc772b091ea1c2ce78d51446c4b27f6c8059 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/12] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 0a9e406414e8e06580c94cbbd4c9eec9d5c32cc5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/12] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 220dd5c221421e5332a75d8533a98110fb9da74e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/12] shiboken2: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 5978d28841d61ccd06ba8840b66453ee5e48939d Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/12] codelite: rebuild for lldb-9.0.0

[ci skip]
---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (9 preceding siblings ...)
  2019-09-23  2:34 ` voidlinux-github
@ 2019-09-23  2:34 ` voidlinux-github
  2019-09-23 15:54 ` voidlinux-github
                   ` (38 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23  2:34 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [x] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [x] shiboken2
- [ ] codelite
- [ ] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 7472011d78b92c083d20f293d33982c43e4f7aba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/12] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 64f3db5dbe760b129a31191288bb9ce3541d31e2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/12] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 22 files changed, 658 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 4485daaf96ed3621a852ad41092c2f7a4e3bf9dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/12] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 94a5f7b42238816e9515d2bce6dfd6af00953eed Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/12] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From cdeaef596776f137529f09ceaad6e7da89ca6fd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 05/12] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From a32d3e6867acfcf4408fa4da2b489f3e24f27809 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 06/12] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 99300e986f14bd16b069ab35034744366a54205a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/12] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From dc22c9b0a9d2e52ae81b9e23ccc82cc2e8af8ec4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/12] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From af3abc772b091ea1c2ce78d51446c4b27f6c8059 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/12] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 0a9e406414e8e06580c94cbbd4c9eec9d5c32cc5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/12] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From a71f541c7c0b7b76841e772b69a0b86d0377fb7a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/12] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 220eba53dbb6d4277145bed1346b10c0fa329a46 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/12] codelite: rebuild for lldb-9.0.0

[ci skip]
---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (8 preceding siblings ...)
  2019-09-23  1:29 ` voidlinux-github
@ 2019-09-23  2:34 ` voidlinux-github
  2019-09-23  2:34 ` voidlinux-github
                   ` (39 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23  2:34 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [ ] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [x] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [x] shiboken2
- [ ] codelite
- [ ] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 7472011d78b92c083d20f293d33982c43e4f7aba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/12] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 64f3db5dbe760b129a31191288bb9ce3541d31e2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/12] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 22 files changed, 658 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From 4485daaf96ed3621a852ad41092c2f7a4e3bf9dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/12] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 94a5f7b42238816e9515d2bce6dfd6af00953eed Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/12] llvm-libunwind: update to 9.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 e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From cdeaef596776f137529f09ceaad6e7da89ca6fd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 05/12] libcxx: update to 9.0.0

---
 srcpkgs/libcxx/template | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From a32d3e6867acfcf4408fa4da2b489f3e24f27809 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 06/12] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 99300e986f14bd16b069ab35034744366a54205a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/12] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From dc22c9b0a9d2e52ae81b9e23ccc82cc2e8af8ec4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/12] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From af3abc772b091ea1c2ce78d51446c4b27f6c8059 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/12] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 0a9e406414e8e06580c94cbbd4c9eec9d5c32cc5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/12] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From a71f541c7c0b7b76841e772b69a0b86d0377fb7a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/12] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 220eba53dbb6d4277145bed1346b10c0fa329a46 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/12] codelite: rebuild for lldb-9.0.0

[ci skip]
---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (11 preceding siblings ...)
  2019-09-23 15:54 ` voidlinux-github
@ 2019-09-23 15:54 ` voidlinux-github
  2019-09-23 15:56 ` llvm9 voidlinux-github
                   ` (36 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 15:54 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [x] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [x] shiboken2
- [x] codelite
- [ ] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From e40b6fb228918484193d5f8698ddf7d8317989f9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/12] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From f75050dc526c7f6ecccb40ebb8ed2a5553b5cb24 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/12] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From f2be6965c015714d5af726229826a8512452685b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/12] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From e833763ceb47ef57d023048e4495a4d6f1c364b0 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/12] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 36ea254a55dc1288a83e799f6c4a5994ae7f838a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/12] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 405793dd7b8c97d230769c9357c44c467a8b51a3 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/12] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From f406d931c33a38af38b0e047011d4f5b1167428c Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/12] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 216fa16d033ca8f80ea47581acf7539039ce7648 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/12] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From f6ef9b3233d3848d9345282006e5c4b989e0f787 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/12] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 38800b0578fc7bf79a7f5129b46a0dbe923a5b2a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/12] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 924ec8435b09e01d5c9fed092834b7102b60f92a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/12] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From cbf774dc6c89259a43b00cd4eaf87fc4321a1eb8 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/12] codelite: rebuild for lldb-9.0.0

[ci skip]
---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (10 preceding siblings ...)
  2019-09-23  2:34 ` voidlinux-github
@ 2019-09-23 15:54 ` voidlinux-github
  2019-09-23 15:54 ` voidlinux-github
                   ` (37 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 15:54 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [ ] ppc64le-musl
- [ ] ppc64
- [ ] ppc64-musl
- [ ] ppc
- [ ] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [x] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] python-bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [x] shiboken2
- [x] codelite
- [ ] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [ ] ardour
- [ ]  afl **[need help, x86 only]**
- [ ]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [ ]  godot
- [ ] ispc
- [ ] yosys
- [ ]  rdedup
- [ ]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From e40b6fb228918484193d5f8698ddf7d8317989f9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/12] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From f75050dc526c7f6ecccb40ebb8ed2a5553b5cb24 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/12] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From f2be6965c015714d5af726229826a8512452685b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/12] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From e833763ceb47ef57d023048e4495a4d6f1c364b0 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/12] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 36ea254a55dc1288a83e799f6c4a5994ae7f838a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/12] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 405793dd7b8c97d230769c9357c44c467a8b51a3 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/12] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From f406d931c33a38af38b0e047011d4f5b1167428c Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/12] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 216fa16d033ca8f80ea47581acf7539039ce7648 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/12] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From f6ef9b3233d3848d9345282006e5c4b989e0f787 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/12] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 38800b0578fc7bf79a7f5129b46a0dbe923a5b2a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/12] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 924ec8435b09e01d5c9fed092834b7102b60f92a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/12] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From cbf774dc6c89259a43b00cd4eaf87fc4321a1eb8 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/12] codelite: rebuild for lldb-9.0.0

[ci skip]
---
 srcpkgs/codelite/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (12 preceding siblings ...)
  2019-09-23 15:54 ` voidlinux-github
@ 2019-09-23 15:56 ` voidlinux-github
  2019-09-23 20:19 ` [PR PATCH] [Updated] llvm9 voidlinux-github
                   ` (35 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 15:56 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534164101

Comment:
Added patches fixing `llvm-libunwind` on 32-bit ppc and a subtle `libcxx` fix on `ppc*` in general, added a gcc9 miscompilation backport patch for clang

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (13 preceding siblings ...)
  2019-09-23 15:56 ` llvm9 voidlinux-github
@ 2019-09-23 20:19 ` voidlinux-github
  2019-09-23 20:19 ` voidlinux-github
                   ` (34 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 20:19 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [x] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ]  afl **[need help, x86 only]**
- [x]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [ ] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 1a2da057d88038f4410e8610018d48d4f935b16b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 21183d45988cd2cc112495c23704ab0156647ca1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From f67fb15f88715fcfbcbf4de5ed8f0afd73256f83 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 696591f118ef55c93cd8bd2fac1e31e366205af2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 3364ea9d158f8fbe7a10bd168528cb477e6ecefd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 40b0f37ad276ddb717d57ce6b44e464ada4f50eb Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 031835fd4851cd9d0f822b48defa9adc7c9f3b3e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 8c1bd13c875b00ea1a564359772c0b906b4c0e9b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 96c6ecf4abe11a53323962a4c709e0c9deeb74dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 90156af213aaca7b0860f61ed5cc7dd2ab31bd85 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/22] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 943c8da9658093b9cfdab10aa730b677853ac1a2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 1263baec47e3055fe0bea996bfe822dd11133cf9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 7915d575f679a861748ca562597c1cc6473f23bc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/22] libGL: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From aed1498fe6cc29b2bfa0babaaa4519c8a07b8ff2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/22] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 4e615e13a790ee80e61961a053beb780ee416e5a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From b1ba711686080cc3c34da698a61a0d3f70b0389b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From a6768a8198605da29f757f54be3428cbbc5b76d9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/22] rtags: rebuild for clang-9.0.0

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

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

From 5e5cd0038a9f9f154e10d251c67d99ff05071fbc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 3e689bb5fc5ff9c9bb8e28c45e03e0d12efbbf6a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/22] ccls: rebuild for clang-9.0.0

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

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

From cc42488bfd0f2990a857a88a9c253ea34e7793b9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From a26db0b666fa86b5eb75a2d1f70e1418393c7ee5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From bf8d6b4a3d52681fa8d16bcb84b13ab86ef3df5b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/22] qtcreator: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (14 preceding siblings ...)
  2019-09-23 20:19 ` [PR PATCH] [Updated] llvm9 voidlinux-github
@ 2019-09-23 20:19 ` voidlinux-github
  2019-09-23 20:51 ` voidlinux-github
                   ` (33 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 20:19 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [ ] libGL
- [ ] beignet **[need help, x86 only]**
- [ ] libclc-git
- [ ] juCi++
- [x] kdevelop
- [ ] rtags
- [ ] bcc
- [ ] ccls
- [ ] clazy
- [ ] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

Not sure if to bump:

- [ ] crystal

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ]  afl **[need help, x86 only]**
- [x]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [ ] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 1a2da057d88038f4410e8610018d48d4f935b16b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 21183d45988cd2cc112495c23704ab0156647ca1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From f67fb15f88715fcfbcbf4de5ed8f0afd73256f83 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 696591f118ef55c93cd8bd2fac1e31e366205af2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 3364ea9d158f8fbe7a10bd168528cb477e6ecefd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 40b0f37ad276ddb717d57ce6b44e464ada4f50eb Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 031835fd4851cd9d0f822b48defa9adc7c9f3b3e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 8c1bd13c875b00ea1a564359772c0b906b4c0e9b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 96c6ecf4abe11a53323962a4c709e0c9deeb74dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 90156af213aaca7b0860f61ed5cc7dd2ab31bd85 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/22] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 943c8da9658093b9cfdab10aa730b677853ac1a2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 1263baec47e3055fe0bea996bfe822dd11133cf9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 7915d575f679a861748ca562597c1cc6473f23bc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/22] libGL: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From aed1498fe6cc29b2bfa0babaaa4519c8a07b8ff2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/22] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 4e615e13a790ee80e61961a053beb780ee416e5a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From b1ba711686080cc3c34da698a61a0d3f70b0389b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From a6768a8198605da29f757f54be3428cbbc5b76d9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/22] rtags: rebuild for clang-9.0.0

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

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

From 5e5cd0038a9f9f154e10d251c67d99ff05071fbc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 3e689bb5fc5ff9c9bb8e28c45e03e0d12efbbf6a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/22] ccls: rebuild for clang-9.0.0

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

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

From cc42488bfd0f2990a857a88a9c253ea34e7793b9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From a26db0b666fa86b5eb75a2d1f70e1418393c7ee5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From bf8d6b4a3d52681fa8d16bcb84b13ab86ef3df5b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/22] qtcreator: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (15 preceding siblings ...)
  2019-09-23 20:19 ` voidlinux-github
@ 2019-09-23 20:51 ` voidlinux-github
  2019-09-23 20:51 ` voidlinux-github
                   ` (32 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 20:51 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ]  afl **[need help, x86 only]**
- [x]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [ ] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 1a2da057d88038f4410e8610018d48d4f935b16b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 21183d45988cd2cc112495c23704ab0156647ca1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From f67fb15f88715fcfbcbf4de5ed8f0afd73256f83 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 696591f118ef55c93cd8bd2fac1e31e366205af2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 3364ea9d158f8fbe7a10bd168528cb477e6ecefd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 40b0f37ad276ddb717d57ce6b44e464ada4f50eb Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 031835fd4851cd9d0f822b48defa9adc7c9f3b3e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 8c1bd13c875b00ea1a564359772c0b906b4c0e9b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 96c6ecf4abe11a53323962a4c709e0c9deeb74dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 90156af213aaca7b0860f61ed5cc7dd2ab31bd85 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/22] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 943c8da9658093b9cfdab10aa730b677853ac1a2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 1263baec47e3055fe0bea996bfe822dd11133cf9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 7915d575f679a861748ca562597c1cc6473f23bc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/22] libGL: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From aed1498fe6cc29b2bfa0babaaa4519c8a07b8ff2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/22] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 4e615e13a790ee80e61961a053beb780ee416e5a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From b1ba711686080cc3c34da698a61a0d3f70b0389b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From a6768a8198605da29f757f54be3428cbbc5b76d9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/22] rtags: rebuild for clang-9.0.0

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

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

From 5e5cd0038a9f9f154e10d251c67d99ff05071fbc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 3e689bb5fc5ff9c9bb8e28c45e03e0d12efbbf6a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/22] ccls: rebuild for clang-9.0.0

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

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

From cc42488bfd0f2990a857a88a9c253ea34e7793b9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From a26db0b666fa86b5eb75a2d1f70e1418393c7ee5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From 7062ba9d57f49e312b80fe055a889715ff04b3e6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (16 preceding siblings ...)
  2019-09-23 20:51 ` voidlinux-github
@ 2019-09-23 20:51 ` voidlinux-github
  2019-09-23 22:17 ` voidlinux-github
                   ` (31 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 20:51 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [ ] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ]  afl **[need help, x86 only]**
- [x]  blender
- [ ]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [ ] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 1a2da057d88038f4410e8610018d48d4f935b16b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 21183d45988cd2cc112495c23704ab0156647ca1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From f67fb15f88715fcfbcbf4de5ed8f0afd73256f83 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 696591f118ef55c93cd8bd2fac1e31e366205af2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 3364ea9d158f8fbe7a10bd168528cb477e6ecefd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 40b0f37ad276ddb717d57ce6b44e464ada4f50eb Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 031835fd4851cd9d0f822b48defa9adc7c9f3b3e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 8c1bd13c875b00ea1a564359772c0b906b4c0e9b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 96c6ecf4abe11a53323962a4c709e0c9deeb74dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 90156af213aaca7b0860f61ed5cc7dd2ab31bd85 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/22] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 943c8da9658093b9cfdab10aa730b677853ac1a2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 1263baec47e3055fe0bea996bfe822dd11133cf9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 7915d575f679a861748ca562597c1cc6473f23bc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/22] libGL: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From aed1498fe6cc29b2bfa0babaaa4519c8a07b8ff2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/22] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 4e615e13a790ee80e61961a053beb780ee416e5a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From b1ba711686080cc3c34da698a61a0d3f70b0389b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From a6768a8198605da29f757f54be3428cbbc5b76d9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/22] rtags: rebuild for clang-9.0.0

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

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

From 5e5cd0038a9f9f154e10d251c67d99ff05071fbc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 3e689bb5fc5ff9c9bb8e28c45e03e0d12efbbf6a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/22] ccls: rebuild for clang-9.0.0

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

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

From cc42488bfd0f2990a857a88a9c253ea34e7793b9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From a26db0b666fa86b5eb75a2d1f70e1418393c7ee5 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From 7062ba9d57f49e312b80fe055a889715ff04b3e6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (17 preceding siblings ...)
  2019-09-23 20:51 ` voidlinux-github
@ 2019-09-23 22:17 ` voidlinux-github
  2019-09-23 22:17 ` voidlinux-github
                   ` (30 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 22:17 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ]  afl **[need help, x86 only]**
- [x]  blender
- [x]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [ ] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 1a2da057d88038f4410e8610018d48d4f935b16b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 21183d45988cd2cc112495c23704ab0156647ca1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From f67fb15f88715fcfbcbf4de5ed8f0afd73256f83 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 696591f118ef55c93cd8bd2fac1e31e366205af2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 3364ea9d158f8fbe7a10bd168528cb477e6ecefd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 40b0f37ad276ddb717d57ce6b44e464ada4f50eb Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 031835fd4851cd9d0f822b48defa9adc7c9f3b3e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 8c1bd13c875b00ea1a564359772c0b906b4c0e9b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 96c6ecf4abe11a53323962a4c709e0c9deeb74dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 90156af213aaca7b0860f61ed5cc7dd2ab31bd85 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/22] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 943c8da9658093b9cfdab10aa730b677853ac1a2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 1263baec47e3055fe0bea996bfe822dd11133cf9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 20fa92238b9dd0b148e79f5397e21a7bce13a5ba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/22] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From 8f20b36141e556733aefb61532f29a868102d93b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/22] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From e5e10dc184f76676b04281d1949225f33e056eab Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From d2b2521b3b214648e0954ee57cb035dbbf1f5e6e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From cc60d54deea165d07dc762f2fe5867de4ce7f1e2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/22] rtags: rebuild for clang-9.0.0

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

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

From 321ba7531be638d04d9762bdc02c85492ad58f34 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 1b243bba9908abef55f324efe72f45435cc3cffc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/22] ccls: rebuild for clang-9.0.0

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

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

From 3eecfbe9cf3b072a111239c49e51c7d2349a11fd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From e6116fdd274e6dd2a06931c9832022e483dbbfe2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From 661fb492ac653d478663a7337f3af5263800c8ce Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (18 preceding siblings ...)
  2019-09-23 22:17 ` voidlinux-github
@ 2019-09-23 22:17 ` voidlinux-github
  2019-09-24  1:14 ` voidlinux-github
                   ` (29 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-23 22:17 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ]  afl **[need help, x86 only]**
- [x]  blender
- [x]  firefox
- [ ]  firefox-esr
- [ ]  icecat
- [ ]  thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [ ] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From 1a2da057d88038f4410e8610018d48d4f935b16b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..43aa9b36f96 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From 21183d45988cd2cc112495c23704ab0156647ca1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From f67fb15f88715fcfbcbf4de5ed8f0afd73256f83 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 696591f118ef55c93cd8bd2fac1e31e366205af2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 3364ea9d158f8fbe7a10bd168528cb477e6ecefd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 40b0f37ad276ddb717d57ce6b44e464ada4f50eb Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 031835fd4851cd9d0f822b48defa9adc7c9f3b3e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 8c1bd13c875b00ea1a564359772c0b906b4c0e9b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 96c6ecf4abe11a53323962a4c709e0c9deeb74dd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 90156af213aaca7b0860f61ed5cc7dd2ab31bd85 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/22] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From 943c8da9658093b9cfdab10aa730b677853ac1a2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From 1263baec47e3055fe0bea996bfe822dd11133cf9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 20fa92238b9dd0b148e79f5397e21a7bce13a5ba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/22] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From 8f20b36141e556733aefb61532f29a868102d93b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/22] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From e5e10dc184f76676b04281d1949225f33e056eab Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From d2b2521b3b214648e0954ee57cb035dbbf1f5e6e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From cc60d54deea165d07dc762f2fe5867de4ce7f1e2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/22] rtags: rebuild for clang-9.0.0

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

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

From 321ba7531be638d04d9762bdc02c85492ad58f34 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 1b243bba9908abef55f324efe72f45435cc3cffc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/22] ccls: rebuild for clang-9.0.0

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

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

From 3eecfbe9cf3b072a111239c49e51c7d2349a11fd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From e6116fdd274e6dd2a06931c9832022e483dbbfe2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From 661fb492ac653d478663a7337f3af5263800c8ce Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (19 preceding siblings ...)
  2019-09-23 22:17 ` voidlinux-github
@ 2019-09-24  1:14 ` voidlinux-github
  2019-09-24  1:14 ` voidlinux-github
                   ` (28 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24  1:14 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [ ] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From bc7b0080f49aaa8ca36c0630aee4b5fc28d3f4b1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From afb1f34f90524b25fe948d7402919dce8021fbd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ea1ce72493b7d8892085cc2fb62898e87a755139 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From a74d724ce15a80c3f833a53b1064c952cd60a47f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 90f14b9e2ab4eea0a11e5a3d4f027ae4f5413c15 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 795b4850d2b622539a8458e4800fb5c05c6558e1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 6e2aa2bc5bae476d6f5b61b38647bae2e5cf3984 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 5c8e0b4b82ad1af3f50799c272e1fd58234966ce Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 98d1633e12834f1695a9642b85e06f26a89e6277 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 691942d6c7fdfcc9d7135f4302be6c58c3d3f557 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/22] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From c146308e9049bd6002631c10723a8913b6beb8c7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From e5f0a4568db756953950df59d5b671bb63dd6896 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 2c593a9a8e0166566b20f583bb69b8259afb825b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/22] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From 31142bc720f534b687041e3a74440243f9dc8d33 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/22] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From dc1e1ddb1d1b1d245f893443b208363ae59514b9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From b6e7ef29f770be3c66b84f35d31b6f5fcadccfbc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From f4e877d819f78ed5d9fe2ba4fe5bfb2928b8f84b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/22] rtags: rebuild for clang-9.0.0

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

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

From 1452162570a9233a0f83f3edfdbe30fc6bc1ee50 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From e02b723c105ab913a861c89efefffa1f59e43083 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/22] ccls: rebuild for clang-9.0.0

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

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

From 6f4729e18c95af1449a379bb6d4d2aad6ecb6e4b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From fec49d626988b1a71e47d26fe0ae0136e94bdb9a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From f205c645b41e00837a5464a3718101f2775f48ff Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (20 preceding siblings ...)
  2019-09-24  1:14 ` voidlinux-github
@ 2019-09-24  1:14 ` voidlinux-github
  2019-09-24 11:34 ` llvm9 voidlinux-github
                   ` (27 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24  1:14 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [ ] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [ ] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From bc7b0080f49aaa8ca36c0630aee4b5fc28d3f4b1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From afb1f34f90524b25fe948d7402919dce8021fbd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ea1ce72493b7d8892085cc2fb62898e87a755139 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From a74d724ce15a80c3f833a53b1064c952cd60a47f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 90f14b9e2ab4eea0a11e5a3d4f027ae4f5413c15 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 795b4850d2b622539a8458e4800fb5c05c6558e1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 6e2aa2bc5bae476d6f5b61b38647bae2e5cf3984 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 5c8e0b4b82ad1af3f50799c272e1fd58234966ce Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 98d1633e12834f1695a9642b85e06f26a89e6277 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 691942d6c7fdfcc9d7135f4302be6c58c3d3f557 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/22] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From c146308e9049bd6002631c10723a8913b6beb8c7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From e5f0a4568db756953950df59d5b671bb63dd6896 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 2c593a9a8e0166566b20f583bb69b8259afb825b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/22] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From 31142bc720f534b687041e3a74440243f9dc8d33 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/22] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From dc1e1ddb1d1b1d245f893443b208363ae59514b9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From b6e7ef29f770be3c66b84f35d31b6f5fcadccfbc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From f4e877d819f78ed5d9fe2ba4fe5bfb2928b8f84b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/22] rtags: rebuild for clang-9.0.0

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

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

From 1452162570a9233a0f83f3edfdbe30fc6bc1ee50 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From e02b723c105ab913a861c89efefffa1f59e43083 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/22] ccls: rebuild for clang-9.0.0

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

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

From 6f4729e18c95af1449a379bb6d4d2aad6ecb6e4b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From fec49d626988b1a71e47d26fe0ae0136e94bdb9a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From f205c645b41e00837a5464a3718101f2775f48ff Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (21 preceding siblings ...)
  2019-09-24  1:14 ` voidlinux-github
@ 2019-09-24 11:34 ` voidlinux-github
  2019-09-24 11:34 ` llvm9 voidlinux-github
                   ` (26 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 11:34 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534517229

Comment:
Tested llvm* build on x86_64, works!

beignet: /usr/bin/ld: CMakeFiles/gbeinterp.dir/gbe_bin_interpreter.cpp.o:(.data.rel+0x0):
 undefined reference to `llvm::DisableABIBreakingChecks'

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (22 preceding siblings ...)
  2019-09-24 11:34 ` llvm9 voidlinux-github
@ 2019-09-24 11:34 ` voidlinux-github
  2019-09-24 11:35 ` llvm9 voidlinux-github
                   ` (25 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 11:34 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534517459

Comment:
afl: clang-9: error: unknown argument: '-fstack-clash-protection'

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (23 preceding siblings ...)
  2019-09-24 11:34 ` llvm9 voidlinux-github
@ 2019-09-24 11:35 ` voidlinux-github
  2019-09-24 11:37 ` llvm9 voidlinux-github
                   ` (24 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 11:35 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534517788

Comment:
ispc works.

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (24 preceding siblings ...)
  2019-09-24 11:35 ` llvm9 voidlinux-github
@ 2019-09-24 11:37 ` voidlinux-github
  2019-09-24 11:38 ` llvm9 voidlinux-github
                   ` (23 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 11:37 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534517459

Comment:
afl: clang-9: error: unknown argument: '-fstack-clash-protection'

Patching that out:

```
echo 0 | ../afl-showmap -m none -q -o .test-instr0 ./test-instr
echo 1 | ../afl-showmap -m none -q -o .test-instr1 ./test-instr

Oops, the instrumentation does not seem to be behaving correctly!

Please ping <lcamtuf@google.com> to troubleshoot the issue.
```

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (25 preceding siblings ...)
  2019-09-24 11:37 ` llvm9 voidlinux-github
@ 2019-09-24 11:38 ` voidlinux-github
  2019-09-24 11:43 ` llvm9 voidlinux-github
                   ` (22 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 11:38 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534518713

Comment:
I suspect afl has been broken all along then since `-fstack-clash-protection` is not a thing in clang8 either, AFAIK it's a hardening flag we add ourselves. Beignet will probably need patching.

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (26 preceding siblings ...)
  2019-09-24 11:38 ` llvm9 voidlinux-github
@ 2019-09-24 11:43 ` voidlinux-github
  2019-09-24 11:46 ` llvm9 voidlinux-github
                   ` (21 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 11:43 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534520222

Comment:
AFL bump and fix: https://0x0.st/ztdv.diff

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (27 preceding siblings ...)
  2019-09-24 11:43 ` llvm9 voidlinux-github
@ 2019-09-24 11:46 ` voidlinux-github
  2019-09-24 12:02 ` [PR PATCH] [Updated] llvm9 voidlinux-github
                   ` (20 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 11:46 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534521182

Comment:
Arch uses a Git snapshot for beignet and a llvm8 patch.

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (29 preceding siblings ...)
  2019-09-24 12:02 ` [PR PATCH] [Updated] llvm9 voidlinux-github
@ 2019-09-24 12:02 ` voidlinux-github
  2019-09-24 12:03 ` llvm9 voidlinux-github
                   ` (18 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 12:02 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From bc7b0080f49aaa8ca36c0630aee4b5fc28d3f4b1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/23] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From afb1f34f90524b25fe948d7402919dce8021fbd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/23] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ea1ce72493b7d8892085cc2fb62898e87a755139 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/23] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From a74d724ce15a80c3f833a53b1064c952cd60a47f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/23] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 90f14b9e2ab4eea0a11e5a3d4f027ae4f5413c15 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/23] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 795b4850d2b622539a8458e4800fb5c05c6558e1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/23] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 6e2aa2bc5bae476d6f5b61b38647bae2e5cf3984 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/23] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 5c8e0b4b82ad1af3f50799c272e1fd58234966ce Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/23] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 98d1633e12834f1695a9642b85e06f26a89e6277 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/23] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 691942d6c7fdfcc9d7135f4302be6c58c3d3f557 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/23] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From c146308e9049bd6002631c10723a8913b6beb8c7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/23] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From e5f0a4568db756953950df59d5b671bb63dd6896 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/23] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 2c593a9a8e0166566b20f583bb69b8259afb825b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/23] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From 31142bc720f534b687041e3a74440243f9dc8d33 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/23] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From dc1e1ddb1d1b1d245f893443b208363ae59514b9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/23] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From b6e7ef29f770be3c66b84f35d31b6f5fcadccfbc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/23] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From f4e877d819f78ed5d9fe2ba4fe5bfb2928b8f84b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/23] rtags: rebuild for clang-9.0.0

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

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

From 1452162570a9233a0f83f3edfdbe30fc6bc1ee50 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/23] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From e02b723c105ab913a861c89efefffa1f59e43083 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/23] ccls: rebuild for clang-9.0.0

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

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

From 6f4729e18c95af1449a379bb6d4d2aad6ecb6e4b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/23] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From fec49d626988b1a71e47d26fe0ae0136e94bdb9a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/23] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From f205c645b41e00837a5464a3718101f2775f48ff Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/23] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From fc3608dc6bacba9cb64bfd9a91a4d555d1fc5d79 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 24 Sep 2019 14:02:01 +0200
Subject: [PATCH 23/23] afl: update to 2.55b + clang 8/9 fix

[ci skip]
---
 srcpkgs/afl/template | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/afl/template b/srcpkgs/afl/template
index 9842510d59f..59d0f7325ef 100644
--- a/srcpkgs/afl/template
+++ b/srcpkgs/afl/template
@@ -1,7 +1,8 @@
 # Template file for 'afl'
 pkgname=afl
-version=2.52b
+version=2.55b
 revision=1
+wrksrc="AFL-${version}"
 build_style=gnu-makefile
 # x86 only currently
 archs="i686* x86_64*"
@@ -9,17 +10,17 @@ hostmakedepends="llvm clang"
 short_desc="American fuzzy lop - a brute-force fuzzer"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Apache-2.0"
-homepage="http://lcamtuf.coredump.cx/afl/"
-distfiles="http://lcamtuf.coredump.cx/afl/releases/afl-${version}.tgz"
-checksum=43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045
+homepage="https://github.com/google/AFL/"
+distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
+checksum=ca96fa6fac76f1ee104762cc9313be37a398f936f2b0e8a9f66e94244ae6babc
 
 nostrip_files="small_archive.a small_exec.elf"
 
 do_build() {
 	make PREFIX=/usr
 
-	CFLAGS="${CFLAGS} -fPIC" \
-	CXXFLAGS="${CXXFLAGS} -fPIC" \
+	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
+	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
 	LDFLAGS="${LDFLAGS} -pie" \
 	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
 }

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (28 preceding siblings ...)
  2019-09-24 11:46 ` llvm9 voidlinux-github
@ 2019-09-24 12:02 ` voidlinux-github
  2019-09-24 12:02 ` voidlinux-github
                   ` (19 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 12:02 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [ ] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From bc7b0080f49aaa8ca36c0630aee4b5fc28d3f4b1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/23] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From afb1f34f90524b25fe948d7402919dce8021fbd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/23] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ea1ce72493b7d8892085cc2fb62898e87a755139 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/23] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From a74d724ce15a80c3f833a53b1064c952cd60a47f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/23] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 90f14b9e2ab4eea0a11e5a3d4f027ae4f5413c15 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/23] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 795b4850d2b622539a8458e4800fb5c05c6558e1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/23] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 6e2aa2bc5bae476d6f5b61b38647bae2e5cf3984 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/23] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 5c8e0b4b82ad1af3f50799c272e1fd58234966ce Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/23] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 98d1633e12834f1695a9642b85e06f26a89e6277 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/23] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 691942d6c7fdfcc9d7135f4302be6c58c3d3f557 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/23] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From c146308e9049bd6002631c10723a8913b6beb8c7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/23] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From e5f0a4568db756953950df59d5b671bb63dd6896 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/23] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 2c593a9a8e0166566b20f583bb69b8259afb825b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/23] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From 31142bc720f534b687041e3a74440243f9dc8d33 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/23] beignet: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From dc1e1ddb1d1b1d245f893443b208363ae59514b9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/23] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From b6e7ef29f770be3c66b84f35d31b6f5fcadccfbc Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/23] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From f4e877d819f78ed5d9fe2ba4fe5bfb2928b8f84b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/23] rtags: rebuild for clang-9.0.0

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

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

From 1452162570a9233a0f83f3edfdbe30fc6bc1ee50 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/23] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From e02b723c105ab913a861c89efefffa1f59e43083 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/23] ccls: rebuild for clang-9.0.0

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

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

From 6f4729e18c95af1449a379bb6d4d2aad6ecb6e4b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/23] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From fec49d626988b1a71e47d26fe0ae0136e94bdb9a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/23] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From f205c645b41e00837a5464a3718101f2775f48ff Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/23] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From fc3608dc6bacba9cb64bfd9a91a4d555d1fc5d79 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 24 Sep 2019 14:02:01 +0200
Subject: [PATCH 23/23] afl: update to 2.55b + clang 8/9 fix

[ci skip]
---
 srcpkgs/afl/template | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/afl/template b/srcpkgs/afl/template
index 9842510d59f..59d0f7325ef 100644
--- a/srcpkgs/afl/template
+++ b/srcpkgs/afl/template
@@ -1,7 +1,8 @@
 # Template file for 'afl'
 pkgname=afl
-version=2.52b
+version=2.55b
 revision=1
+wrksrc="AFL-${version}"
 build_style=gnu-makefile
 # x86 only currently
 archs="i686* x86_64*"
@@ -9,17 +10,17 @@ hostmakedepends="llvm clang"
 short_desc="American fuzzy lop - a brute-force fuzzer"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Apache-2.0"
-homepage="http://lcamtuf.coredump.cx/afl/"
-distfiles="http://lcamtuf.coredump.cx/afl/releases/afl-${version}.tgz"
-checksum=43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045
+homepage="https://github.com/google/AFL/"
+distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
+checksum=ca96fa6fac76f1ee104762cc9313be37a398f936f2b0e8a9f66e94244ae6babc
 
 nostrip_files="small_archive.a small_exec.elf"
 
 do_build() {
 	make PREFIX=/usr
 
-	CFLAGS="${CFLAGS} -fPIC" \
-	CXXFLAGS="${CXXFLAGS} -fPIC" \
+	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
+	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
 	LDFLAGS="${LDFLAGS} -pie" \
 	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
 }

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (30 preceding siblings ...)
  2019-09-24 12:02 ` voidlinux-github
@ 2019-09-24 12:03 ` voidlinux-github
  2019-09-24 12:10 ` llvm9 voidlinux-github
                   ` (17 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 12:03 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534526537

Comment:
Added `afl` update into the batch...

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (31 preceding siblings ...)
  2019-09-24 12:03 ` llvm9 voidlinux-github
@ 2019-09-24 12:10 ` voidlinux-github
  2019-09-24 12:11 ` llvm9 voidlinux-github
                   ` (16 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 12:10 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534528939

Comment:
Looks like the Arch llvm8 patch should be the one for beignet

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (32 preceding siblings ...)
  2019-09-24 12:10 ` llvm9 voidlinux-github
@ 2019-09-24 12:11 ` voidlinux-github
  2019-09-24 12:44 ` llvm9 voidlinux-github
                   ` (15 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 12:11 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534528939

Comment:
Looks like the Arch llvm8 patch should be the one for beignet; can you try dropping it into the tree and building with it?

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (33 preceding siblings ...)
  2019-09-24 12:11 ` llvm9 voidlinux-github
@ 2019-09-24 12:44 ` voidlinux-github
  2019-09-24 12:53 ` llvm9 voidlinux-github
                   ` (14 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 12:44 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534541058

Comment:
Yes, but it doesnt work on 1.3.2 release I think.

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (34 preceding siblings ...)
  2019-09-24 12:44 ` llvm9 voidlinux-github
@ 2019-09-24 12:53 ` voidlinux-github
  2019-09-24 12:58 ` llvm9 voidlinux-github
                   ` (13 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 12:53 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534544631

Comment:
It should, I looked at their git and it seems there was only a handful of commits since then.

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (35 preceding siblings ...)
  2019-09-24 12:53 ` llvm9 voidlinux-github
@ 2019-09-24 12:58 ` voidlinux-github
  2019-09-24 13:10 ` llvm9 voidlinux-github
                   ` (12 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 12:58 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534546271

Comment:
```
/builddir/Beignet-1.3.2-Source/backend/src/llvm/llvm_sampler_fix.cpp: In member 
function 'bool gbe::SamplerFix::visitCallInst(llvm::CallInst*)':
/builddir/Beignet-1.3.2-Source/backend/src/llvm/llvm_sampler_fix.cpp:85:53: erro
r: cannot convert 'llvm::FunctionCallee' to 'llvm::Value*' in initialization
```

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (36 preceding siblings ...)
  2019-09-24 12:58 ` llvm9 voidlinux-github
@ 2019-09-24 13:10 ` voidlinux-github
  2019-09-24 14:01 ` llvm9 voidlinux-github
                   ` (11 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 13:10 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534550940

Comment:
As I see it,

```
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
```

will need changing to

```
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType()).getCallee();
```

in two places in that file when compiling for llvm9.

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (37 preceding siblings ...)
  2019-09-24 13:10 ` llvm9 voidlinux-github
@ 2019-09-24 14:01 ` voidlinux-github
  2019-09-24 16:52 ` [PR PATCH] [Updated] llvm9 voidlinux-github
                   ` (10 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 14:01 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534572483

Comment:
FreeBSD has a complete patchset, but I have other things to do right now: https://bz-attachments.freebsd.org/attachment.cgi?id=206326

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (38 preceding siblings ...)
  2019-09-24 14:01 ` llvm9 voidlinux-github
@ 2019-09-24 16:52 ` voidlinux-github
  2019-09-24 16:52 ` voidlinux-github
                   ` (9 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 16:52 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [x] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From bc7b0080f49aaa8ca36c0630aee4b5fc28d3f4b1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/23] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From afb1f34f90524b25fe948d7402919dce8021fbd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/23] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ea1ce72493b7d8892085cc2fb62898e87a755139 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/23] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From a74d724ce15a80c3f833a53b1064c952cd60a47f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/23] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 90f14b9e2ab4eea0a11e5a3d4f027ae4f5413c15 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/23] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 795b4850d2b622539a8458e4800fb5c05c6558e1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/23] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 6e2aa2bc5bae476d6f5b61b38647bae2e5cf3984 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/23] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 5c8e0b4b82ad1af3f50799c272e1fd58234966ce Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/23] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 98d1633e12834f1695a9642b85e06f26a89e6277 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/23] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 691942d6c7fdfcc9d7135f4302be6c58c3d3f557 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/23] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From c146308e9049bd6002631c10723a8913b6beb8c7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/23] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From e5f0a4568db756953950df59d5b671bb63dd6896 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/23] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 2c593a9a8e0166566b20f583bb69b8259afb825b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/23] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From ad94cf7598b275f41d933dd0e7dfe5d202e14c8f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/23] beignet: patch and rebuild for llvm-9.0.0

---
 srcpkgs/beignet/patches/llvm8.patch |  56 ++++++++
 srcpkgs/beignet/patches/llvm9.patch | 196 ++++++++++++++++++++++++++++
 srcpkgs/beignet/template            |   2 +-
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm8.patch
 create mode 100644 srcpkgs/beignet/patches/llvm9.patch

diff --git a/srcpkgs/beignet/patches/llvm8.patch b/srcpkgs/beignet/patches/llvm8.patch
new file mode 100644
index 00000000000..15128d1a115
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm8.patch
@@ -0,0 +1,56 @@
+From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
+From: Jan Beich <jbeich@FreeBSD.org>
+Date: Wed, 30 Jan 2019 12:42:34 +0000
+Subject: [PATCH] lang/beignet: unbreak with llvm80
+
+Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
+
+unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
+ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
+
+Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
+
+backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+
+--- backend/src/CMakeLists.txt.orig	2017-09-22 08:05:22 UTC
++++ backend/src/CMakeLists.txt
+@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
+ endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
+ 
+ add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
++target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
+ 
+ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
+   find_library(TERMINFO NAMES tinfo ncurses)
+--- backend/src/llvm/llvm_gen_backend.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_gen_backend.cpp
+@@ -3073,14 +3073,22 @@ namespace gbe
+ 
+ 
+   static unsigned getChildNo(BasicBlock *bb) {
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     return term->getNumSuccessors();
+   }
+ 
+   // return NULL if index out-range of children number
+   static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
+ 
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     unsigned childNo = term->getNumSuccessors();
+     BasicBlock *child = NULL;
+     if(index < childNo) {
diff --git a/srcpkgs/beignet/patches/llvm9.patch b/srcpkgs/beignet/patches/llvm9.patch
new file mode 100644
index 00000000000..83942a73472
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm9.patch
@@ -0,0 +1,196 @@
+Source: FreeBSD
+
+Regressed by https://github.com/llvm/llvm-project/commit/2e97d2aa1bd3
+
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::addMatcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&, clang::ast_matchers::MatchFinder::MatchCallback*)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::~MatchFinder()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxMethodDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxRecordDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unaryOperator
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructorDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxOperatorCallExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::expr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::allOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::anyOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::eachOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unless
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::varDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::callExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::castExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::internal::hasAnyNameFunc(llvm::ArrayRef<llvm::StringRef const*>)
+ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
+c++: error: linker command failed with exit code 1 (use -v to see invocation)
+
+Regressed by https://github.com/llvm/llvm-project/commit/13680223b9d8
+
+backend/src/llvm/llvm_intrinsic_lowering.cpp:80:19: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Constant *'
+        Constant* FCache = M->getOrInsertFunction(NewFn,
+                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:85:18: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:127:18: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_profiling.cpp:166:27: error: no
+      matching function for call to 'cast'
+      builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+                          ^~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_device_enqueue.cpp:401:52: error:
+      no matching function for call to 'cast'
+              CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                                                   ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+                                           ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+      llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+      'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+                                             ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+backend/src/llvm/llvm_profiling.cpp:188:25: error: no
+      matching function for call to 'cast'
+    builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+                        ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+                                           ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+      llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+      'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+                                             ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+
+--- CMake/FindLLVM.cmake.orig	2017-09-22 08:05:22 UTC
++++ CMake/FindLLVM.cmake
+@@ -116,6 +116,9 @@ macro(add_one_lib name)
+ endmacro()
+ 
+ #Assume clang lib path same as llvm lib path
++if (LLVM_VERSION_NODOT VERSION_GREATER 80)
++add_one_lib("clang-cpp")
++endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
+ add_one_lib("clangCodeGen")
+ add_one_lib("clangFrontend")
+ add_one_lib("clangSerialization")
+--- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_intrinsic_lowering.cpp
+@@ -77,7 +77,11 @@ namespace gbe {
+         std::vector<Type *> ParamTys;
+         for (Value** I = ArgBegin; I != ArgEnd; ++I)
+           ParamTys.push_back((*I)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
++#else
+         Constant* FCache = M->getOrInsertFunction(NewFn,
++#endif
+                                         FunctionType::get(RetTy, ParamTys, false));
+ 
+         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
+--- backend/src/llvm/llvm_sampler_fix.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_sampler_fix.cpp
+@@ -82,7 +82,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+@@ -124,7 +128,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+--- backend/src/llvm/llvm_profiling.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_profiling.cpp
+@@ -163,10 +163,18 @@ namespace gbe
+       // __gen_ocl_store_timestamp(int nth, int type);
+       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++      builder->CreateCall(module->getOrInsertFunction(
++#else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
+               IntegerType::getInt32Ty(module->getContext()),
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              IntegerType::getInt32Ty(module->getContext())),
++#else
+               IntegerType::getInt32Ty(module->getContext()))),
++#endif
+               ArrayRef<Value*>(Args));
+ #else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+@@ -185,10 +193,18 @@ namespace gbe
+     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+ 
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++    builder->CreateCall(module->getOrInsertFunction(
++#else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+             ptrTy,
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++            IntegerType::getInt32Ty(module->getContext())),
++#else
+             IntegerType::getInt32Ty(module->getContext()))),
++#endif
+             ArrayRef<Value*>(Args2));
+ #else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+--- backend/src/llvm/llvm_device_enqueue.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_device_enqueue.cpp
+@@ -398,8 +398,13 @@ namespace gbe {
+               std::vector<Type *> ParamTys;
+               for (Value** iter = args.begin(); iter != args.end(); ++iter)
+                 ParamTys.push_back((*iter)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
++                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
++#else
+               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
++#endif
+               CI->replaceAllUsesWith(newCI);
+               deadInsnSet.insert(CI);
+             }
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 107560784f57cbf92d72ca006a0f2eafc97ccb3f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/23] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From d1a7e808d57e958d5427445e3a4b09a988a1610f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/23] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From 6d847b61d89f7565febfb49c4fd9fac473105ef1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/23] rtags: rebuild for clang-9.0.0

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

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

From fe729e7922d358b0add28306064cfe1ed2732505 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/23] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 48748a27b0887c74e7de867d06230886202cb186 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/23] ccls: rebuild for clang-9.0.0

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

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

From 989b08d75a68f348d7f0784f796576132c74655d Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/23] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From afefde042c1b927b33758bfe37f7405d674e16e6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/23] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From fb93783658f40b3a3c1544e7985a6e7d8f965bbd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/23] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 4f1e710a62b6f43cf12c15a8ddb9d00a7757f425 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 24 Sep 2019 14:02:01 +0200
Subject: [PATCH 23/23] afl: update to 2.55b + clang 8/9 fix

[ci skip]
---
 srcpkgs/afl/template | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/afl/template b/srcpkgs/afl/template
index 9842510d59f..59d0f7325ef 100644
--- a/srcpkgs/afl/template
+++ b/srcpkgs/afl/template
@@ -1,7 +1,8 @@
 # Template file for 'afl'
 pkgname=afl
-version=2.52b
+version=2.55b
 revision=1
+wrksrc="AFL-${version}"
 build_style=gnu-makefile
 # x86 only currently
 archs="i686* x86_64*"
@@ -9,17 +10,17 @@ hostmakedepends="llvm clang"
 short_desc="American fuzzy lop - a brute-force fuzzer"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Apache-2.0"
-homepage="http://lcamtuf.coredump.cx/afl/"
-distfiles="http://lcamtuf.coredump.cx/afl/releases/afl-${version}.tgz"
-checksum=43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045
+homepage="https://github.com/google/AFL/"
+distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
+checksum=ca96fa6fac76f1ee104762cc9313be37a398f936f2b0e8a9f66e94244ae6babc
 
 nostrip_files="small_archive.a small_exec.elf"
 
 do_build() {
 	make PREFIX=/usr
 
-	CFLAGS="${CFLAGS} -fPIC" \
-	CXXFLAGS="${CXXFLAGS} -fPIC" \
+	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
+	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
 	LDFLAGS="${LDFLAGS} -pie" \
 	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
 }

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (39 preceding siblings ...)
  2019-09-24 16:52 ` [PR PATCH] [Updated] llvm9 voidlinux-github
@ 2019-09-24 16:52 ` voidlinux-github
  2019-09-24 18:46 ` llvm9 voidlinux-github
                   ` (8 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 16:52 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [x] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [ ] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From bc7b0080f49aaa8ca36c0630aee4b5fc28d3f4b1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/23] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From afb1f34f90524b25fe948d7402919dce8021fbd9 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/23] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index 71341b5c070..4a793547303 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ea1ce72493b7d8892085cc2fb62898e87a755139 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/23] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From a74d724ce15a80c3f833a53b1064c952cd60a47f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/23] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From 90f14b9e2ab4eea0a11e5a3d4f027ae4f5413c15 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/23] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 795b4850d2b622539a8458e4800fb5c05c6558e1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/23] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From 6e2aa2bc5bae476d6f5b61b38647bae2e5cf3984 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/23] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From 5c8e0b4b82ad1af3f50799c272e1fd58234966ce Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/23] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 98d1633e12834f1695a9642b85e06f26a89e6277 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/23] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From 691942d6c7fdfcc9d7135f4302be6c58c3d3f557 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:35:52 +0200
Subject: [PATCH 10/23] qt5: rebuild for clang-9.0.0 + patch build after pulse
 breakage

---
 srcpkgs/qt5/patches/0050-pulse-stubs.patch | 49 ++++++++++++++++++++++
 srcpkgs/qt5/template                       |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qt5/patches/0050-pulse-stubs.patch

diff --git a/srcpkgs/qt5/patches/0050-pulse-stubs.patch b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
new file mode 100644
index 00000000000..c4f0fae86ee
--- /dev/null
+++ b/srcpkgs/qt5/patches/0050-pulse-stubs.patch
@@ -0,0 +1,49 @@
+Pulse changed API in a recent update and these need to be fixed
+in order to avoid build errors.
+
+--- qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
++++ qtwebengine/src/3rdparty/chromium/media/audio/pulse/pulse.sigs
+@@ -24,11 +24,11 @@ pa_operation* pa_context_get_source_info_by_index(pa_context* c, uint32_t idx, p
+ pa_operation* pa_context_get_source_info_by_name(pa_context* c, const char* name, pa_source_info_cb_t cb, void *userdata);
+ pa_operation* pa_context_get_source_info_list(pa_context* c, pa_source_info_cb_t cb, void* userdata);
+ pa_operation* pa_context_get_sink_info_list(pa_context* c, pa_sink_info_cb_t cb, void* userdata);
+-pa_context_state_t pa_context_get_state(pa_context* c);
++pa_context_state_t pa_context_get_state(const pa_context* c);
+ pa_context* pa_context_new(pa_mainloop_api* mainloop, const char* name);
+ pa_operation* pa_context_set_source_volume_by_index(pa_context* c, uint32_t idx, const pa_cvolume* volume, pa_context_success_cb_t cb, void* userdata);
+ void pa_context_set_state_callback(pa_context* c, pa_context_notify_cb_t cb, void* userdata);
+-pa_operation_state_t pa_operation_get_state(pa_operation* o);
++pa_operation_state_t pa_operation_get_state(const pa_operation* o);
+ void pa_context_unref(pa_context* c);
+ void pa_operation_unref(pa_operation* o);
+ int pa_stream_begin_write(pa_stream* p, void** data, size_t* nbytes);
+@@ -38,23 +38,23 @@ pa_operation* pa_stream_cork(pa_stream* s, int b, pa_stream_success_cb_t cb, voi
+ int pa_stream_disconnect(pa_stream* s);
+ int pa_stream_drop(pa_stream *p);
+ pa_operation* pa_stream_flush(pa_stream* s, pa_stream_success_cb_t cb, void* userdata);
+-uint32_t pa_stream_get_device_index(pa_stream* s);
++uint32_t pa_stream_get_device_index(const pa_stream* s);
+ int pa_stream_get_latency(pa_stream* s, pa_usec_t* r_usec, int* negative);
+-pa_stream_state_t pa_stream_get_state(pa_stream* p);
++pa_stream_state_t pa_stream_get_state(const pa_stream* p);
+ pa_stream* pa_stream_new(pa_context*  c, const char*  name, const pa_sample_spec*  ss, const pa_channel_map *  map);
+ pa_stream* pa_stream_new_with_proplist(pa_context* c, const char* name, const pa_sample_spec* ss, const pa_channel_map* map, pa_proplist* p);
+ pa_proplist* pa_proplist_new(void);
+-int pa_proplist_contains(pa_proplist* p, const char* key);
++int pa_proplist_contains(const pa_proplist* p, const char* key);
+ void pa_proplist_free(pa_proplist* p);
+-const char* pa_proplist_gets(pa_proplist* p, const char* key);
++const char* pa_proplist_gets(const pa_proplist* p, const char* key);
+ int pa_proplist_sets(pa_proplist* p, const char* key, const char* value);
+-size_t pa_stream_readable_size(pa_stream *p);
++size_t pa_stream_readable_size(const pa_stream *p);
+ int pa_stream_peek(pa_stream* p, const void** data, size_t* nbytes);
+ void pa_stream_set_read_callback(pa_stream* p, pa_stream_request_cb_t cb, void* userdata);
+ void pa_stream_set_state_callback(pa_stream* s, pa_stream_notify_cb_t cb, void* userdata);
+ int pa_stream_write(pa_stream* p, const void* data, size_t nbytes, pa_free_cb_t free_cb, int64_t offset, pa_seek_mode_t seek);
+ void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
+ void pa_stream_unref(pa_stream* s);
+-int pa_context_errno(pa_context *c);
++int pa_context_errno(const pa_context *c);
+ const char* pa_strerror(int error);
+ pa_cvolume* pa_cvolume_set(pa_cvolume* a, unsigned  channels, pa_volume_t v);
diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template
index 610b2a88b07..05adb3bfeec 100644
--- a/srcpkgs/qt5/template
+++ b/srcpkgs/qt5/template
@@ -1,7 +1,7 @@
 # Template file for 'qt5'
 pkgname=qt5
 version=5.13.0
-revision=4
+revision=5
 wrksrc="qt-everywhere-src-${version}"
 build_style=gnu-configure
 hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config

From c146308e9049bd6002631c10723a8913b6beb8c7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 11/23] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From e5f0a4568db756953950df59d5b671bb63dd6896 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 12/23] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From 2c593a9a8e0166566b20f583bb69b8259afb825b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 13/23] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From ad94cf7598b275f41d933dd0e7dfe5d202e14c8f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 14/23] beignet: patch and rebuild for llvm-9.0.0

---
 srcpkgs/beignet/patches/llvm8.patch |  56 ++++++++
 srcpkgs/beignet/patches/llvm9.patch | 196 ++++++++++++++++++++++++++++
 srcpkgs/beignet/template            |   2 +-
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm8.patch
 create mode 100644 srcpkgs/beignet/patches/llvm9.patch

diff --git a/srcpkgs/beignet/patches/llvm8.patch b/srcpkgs/beignet/patches/llvm8.patch
new file mode 100644
index 00000000000..15128d1a115
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm8.patch
@@ -0,0 +1,56 @@
+From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
+From: Jan Beich <jbeich@FreeBSD.org>
+Date: Wed, 30 Jan 2019 12:42:34 +0000
+Subject: [PATCH] lang/beignet: unbreak with llvm80
+
+Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
+
+unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
+ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
+
+Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
+
+backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+
+--- backend/src/CMakeLists.txt.orig	2017-09-22 08:05:22 UTC
++++ backend/src/CMakeLists.txt
+@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
+ endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
+ 
+ add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
++target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
+ 
+ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
+   find_library(TERMINFO NAMES tinfo ncurses)
+--- backend/src/llvm/llvm_gen_backend.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_gen_backend.cpp
+@@ -3073,14 +3073,22 @@ namespace gbe
+ 
+ 
+   static unsigned getChildNo(BasicBlock *bb) {
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     return term->getNumSuccessors();
+   }
+ 
+   // return NULL if index out-range of children number
+   static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
+ 
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     unsigned childNo = term->getNumSuccessors();
+     BasicBlock *child = NULL;
+     if(index < childNo) {
diff --git a/srcpkgs/beignet/patches/llvm9.patch b/srcpkgs/beignet/patches/llvm9.patch
new file mode 100644
index 00000000000..83942a73472
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm9.patch
@@ -0,0 +1,196 @@
+Source: FreeBSD
+
+Regressed by https://github.com/llvm/llvm-project/commit/2e97d2aa1bd3
+
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::addMatcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&, clang::ast_matchers::MatchFinder::MatchCallback*)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::~MatchFinder()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxMethodDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxRecordDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unaryOperator
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructorDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxOperatorCallExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::expr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::allOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::anyOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::eachOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unless
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::varDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::callExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::castExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::internal::hasAnyNameFunc(llvm::ArrayRef<llvm::StringRef const*>)
+ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
+c++: error: linker command failed with exit code 1 (use -v to see invocation)
+
+Regressed by https://github.com/llvm/llvm-project/commit/13680223b9d8
+
+backend/src/llvm/llvm_intrinsic_lowering.cpp:80:19: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Constant *'
+        Constant* FCache = M->getOrInsertFunction(NewFn,
+                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:85:18: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:127:18: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_profiling.cpp:166:27: error: no
+      matching function for call to 'cast'
+      builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+                          ^~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_device_enqueue.cpp:401:52: error:
+      no matching function for call to 'cast'
+              CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                                                   ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+                                           ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+      llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+      'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+                                             ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+backend/src/llvm/llvm_profiling.cpp:188:25: error: no
+      matching function for call to 'cast'
+    builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+                        ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+                                           ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+      llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+      'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+                                             ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+
+--- CMake/FindLLVM.cmake.orig	2017-09-22 08:05:22 UTC
++++ CMake/FindLLVM.cmake
+@@ -116,6 +116,9 @@ macro(add_one_lib name)
+ endmacro()
+ 
+ #Assume clang lib path same as llvm lib path
++if (LLVM_VERSION_NODOT VERSION_GREATER 80)
++add_one_lib("clang-cpp")
++endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
+ add_one_lib("clangCodeGen")
+ add_one_lib("clangFrontend")
+ add_one_lib("clangSerialization")
+--- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_intrinsic_lowering.cpp
+@@ -77,7 +77,11 @@ namespace gbe {
+         std::vector<Type *> ParamTys;
+         for (Value** I = ArgBegin; I != ArgEnd; ++I)
+           ParamTys.push_back((*I)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
++#else
+         Constant* FCache = M->getOrInsertFunction(NewFn,
++#endif
+                                         FunctionType::get(RetTy, ParamTys, false));
+ 
+         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
+--- backend/src/llvm/llvm_sampler_fix.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_sampler_fix.cpp
+@@ -82,7 +82,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+@@ -124,7 +128,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+--- backend/src/llvm/llvm_profiling.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_profiling.cpp
+@@ -163,10 +163,18 @@ namespace gbe
+       // __gen_ocl_store_timestamp(int nth, int type);
+       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++      builder->CreateCall(module->getOrInsertFunction(
++#else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
+               IntegerType::getInt32Ty(module->getContext()),
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              IntegerType::getInt32Ty(module->getContext())),
++#else
+               IntegerType::getInt32Ty(module->getContext()))),
++#endif
+               ArrayRef<Value*>(Args));
+ #else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+@@ -185,10 +193,18 @@ namespace gbe
+     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+ 
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++    builder->CreateCall(module->getOrInsertFunction(
++#else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+             ptrTy,
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++            IntegerType::getInt32Ty(module->getContext())),
++#else
+             IntegerType::getInt32Ty(module->getContext()))),
++#endif
+             ArrayRef<Value*>(Args2));
+ #else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+--- backend/src/llvm/llvm_device_enqueue.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_device_enqueue.cpp
+@@ -398,8 +398,13 @@ namespace gbe {
+               std::vector<Type *> ParamTys;
+               for (Value** iter = args.begin(); iter != args.end(); ++iter)
+                 ParamTys.push_back((*iter)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
++                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
++#else
+               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
++#endif
+               CI->replaceAllUsesWith(newCI);
+               deadInsnSet.insert(CI);
+             }
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 107560784f57cbf92d72ca006a0f2eafc97ccb3f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 15/23] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From d1a7e808d57e958d5427445e3a4b09a988a1610f Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 16/23] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index c7c0e3f275a..61f5c7bb0db 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.4.6
-revision=5
+revision=6
 _libclangmm_commit="2b2f2ead1f685a9efb28ee2c0ff3cbe452a724dd"
 _tiny_commit="54b95a21cf35f8467e21038f523fd3342a77de4c"
 wrksrc="jucipp-v${version}"

From 6d847b61d89f7565febfb49c4fd9fac473105ef1 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 17/23] rtags: rebuild for clang-9.0.0

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

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

From fe729e7922d358b0add28306064cfe1ed2732505 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 18/23] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 48748a27b0887c74e7de867d06230886202cb186 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 19/23] ccls: rebuild for clang-9.0.0

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

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

From 989b08d75a68f348d7f0784f796576132c74655d Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 20/23] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From afefde042c1b927b33758bfe37f7405d674e16e6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 21/23] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From fb93783658f40b3a3c1544e7985a6e7d8f965bbd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 22/23] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 4f1e710a62b6f43cf12c15a8ddb9d00a7757f425 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 24 Sep 2019 14:02:01 +0200
Subject: [PATCH 23/23] afl: update to 2.55b + clang 8/9 fix

[ci skip]
---
 srcpkgs/afl/template | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/afl/template b/srcpkgs/afl/template
index 9842510d59f..59d0f7325ef 100644
--- a/srcpkgs/afl/template
+++ b/srcpkgs/afl/template
@@ -1,7 +1,8 @@
 # Template file for 'afl'
 pkgname=afl
-version=2.52b
+version=2.55b
 revision=1
+wrksrc="AFL-${version}"
 build_style=gnu-makefile
 # x86 only currently
 archs="i686* x86_64*"
@@ -9,17 +10,17 @@ hostmakedepends="llvm clang"
 short_desc="American fuzzy lop - a brute-force fuzzer"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Apache-2.0"
-homepage="http://lcamtuf.coredump.cx/afl/"
-distfiles="http://lcamtuf.coredump.cx/afl/releases/afl-${version}.tgz"
-checksum=43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045
+homepage="https://github.com/google/AFL/"
+distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
+checksum=ca96fa6fac76f1ee104762cc9313be37a398f936f2b0e8a9f66e94244ae6babc
 
 nostrip_files="small_archive.a small_exec.elf"
 
 do_build() {
 	make PREFIX=/usr
 
-	CFLAGS="${CFLAGS} -fPIC" \
-	CXXFLAGS="${CXXFLAGS} -fPIC" \
+	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
+	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
 	LDFLAGS="${LDFLAGS} -pie" \
 	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
 }

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (40 preceding siblings ...)
  2019-09-24 16:52 ` voidlinux-github
@ 2019-09-24 18:46 ` voidlinux-github
  2019-09-25 20:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
                   ` (7 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-24 18:46 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-534696014

Comment:
Chromium built on x86_64.

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (41 preceding siblings ...)
  2019-09-24 18:46 ` llvm9 voidlinux-github
@ 2019-09-25 20:29 ` voidlinux-github
  2019-09-25 20:29 ` voidlinux-github
                   ` (6 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-25 20:29 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [x] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [x] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From cd426ace995b5ad70ce290e5efc6a77b871bdc80 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From b9be3806876d26db07b2ed361a6825f6ab5108ba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index bcbd4332cc7..2bddb207419 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ccdce51762d92a346f56aac6eb7b7719c52cd36a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 30d92b590d59691b59e5a0d19c5d763e1f8244a6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From bde27d03865e51d8b6c55baea0ee1914bf43d51b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 9a43bf251f265079bbd3efe6e7facfaa808df99b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From d0f8905a455e123a6c1e1d66a1609e630570dd99 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From b030559cf0bff666874ced0612a89e3ced8ea724 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 33f56b1aacd158269ecd99ba828f76f4dd46c6be Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From e16bc96e474753acf1796de8de6abbbb52aebea4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 10/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From f9b29e8deff6b8da28522944ec2e51ff21e6798b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 11/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From fdc780c0ae8f1aa535b0c65dc77d1421ef2df17b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 12/22] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From dc9d81af6fac3877e5794205b9561b8ca47a4282 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 13/22] beignet: patch and rebuild for llvm-9.0.0

---
 srcpkgs/beignet/patches/llvm8.patch |  56 ++++++++
 srcpkgs/beignet/patches/llvm9.patch | 196 ++++++++++++++++++++++++++++
 srcpkgs/beignet/template            |   2 +-
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm8.patch
 create mode 100644 srcpkgs/beignet/patches/llvm9.patch

diff --git a/srcpkgs/beignet/patches/llvm8.patch b/srcpkgs/beignet/patches/llvm8.patch
new file mode 100644
index 00000000000..15128d1a115
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm8.patch
@@ -0,0 +1,56 @@
+From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
+From: Jan Beich <jbeich@FreeBSD.org>
+Date: Wed, 30 Jan 2019 12:42:34 +0000
+Subject: [PATCH] lang/beignet: unbreak with llvm80
+
+Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
+
+unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
+ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
+
+Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
+
+backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+
+--- backend/src/CMakeLists.txt.orig	2017-09-22 08:05:22 UTC
++++ backend/src/CMakeLists.txt
+@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
+ endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
+ 
+ add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
++target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
+ 
+ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
+   find_library(TERMINFO NAMES tinfo ncurses)
+--- backend/src/llvm/llvm_gen_backend.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_gen_backend.cpp
+@@ -3073,14 +3073,22 @@ namespace gbe
+ 
+ 
+   static unsigned getChildNo(BasicBlock *bb) {
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     return term->getNumSuccessors();
+   }
+ 
+   // return NULL if index out-range of children number
+   static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
+ 
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     unsigned childNo = term->getNumSuccessors();
+     BasicBlock *child = NULL;
+     if(index < childNo) {
diff --git a/srcpkgs/beignet/patches/llvm9.patch b/srcpkgs/beignet/patches/llvm9.patch
new file mode 100644
index 00000000000..83942a73472
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm9.patch
@@ -0,0 +1,196 @@
+Source: FreeBSD
+
+Regressed by https://github.com/llvm/llvm-project/commit/2e97d2aa1bd3
+
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::addMatcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&, clang::ast_matchers::MatchFinder::MatchCallback*)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::~MatchFinder()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxMethodDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxRecordDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unaryOperator
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructorDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxOperatorCallExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::expr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::allOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::anyOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::eachOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unless
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::varDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::callExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::castExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::internal::hasAnyNameFunc(llvm::ArrayRef<llvm::StringRef const*>)
+ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
+c++: error: linker command failed with exit code 1 (use -v to see invocation)
+
+Regressed by https://github.com/llvm/llvm-project/commit/13680223b9d8
+
+backend/src/llvm/llvm_intrinsic_lowering.cpp:80:19: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Constant *'
+        Constant* FCache = M->getOrInsertFunction(NewFn,
+                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:85:18: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:127:18: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_profiling.cpp:166:27: error: no
+      matching function for call to 'cast'
+      builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+                          ^~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_device_enqueue.cpp:401:52: error:
+      no matching function for call to 'cast'
+              CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                                                   ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+                                           ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+      llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+      'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+                                             ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+backend/src/llvm/llvm_profiling.cpp:188:25: error: no
+      matching function for call to 'cast'
+    builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+                        ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+                                           ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+      llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+      'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+                                             ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+
+--- CMake/FindLLVM.cmake.orig	2017-09-22 08:05:22 UTC
++++ CMake/FindLLVM.cmake
+@@ -116,6 +116,9 @@ macro(add_one_lib name)
+ endmacro()
+ 
+ #Assume clang lib path same as llvm lib path
++if (LLVM_VERSION_NODOT VERSION_GREATER 80)
++add_one_lib("clang-cpp")
++endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
+ add_one_lib("clangCodeGen")
+ add_one_lib("clangFrontend")
+ add_one_lib("clangSerialization")
+--- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_intrinsic_lowering.cpp
+@@ -77,7 +77,11 @@ namespace gbe {
+         std::vector<Type *> ParamTys;
+         for (Value** I = ArgBegin; I != ArgEnd; ++I)
+           ParamTys.push_back((*I)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
++#else
+         Constant* FCache = M->getOrInsertFunction(NewFn,
++#endif
+                                         FunctionType::get(RetTy, ParamTys, false));
+ 
+         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
+--- backend/src/llvm/llvm_sampler_fix.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_sampler_fix.cpp
+@@ -82,7 +82,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+@@ -124,7 +128,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+--- backend/src/llvm/llvm_profiling.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_profiling.cpp
+@@ -163,10 +163,18 @@ namespace gbe
+       // __gen_ocl_store_timestamp(int nth, int type);
+       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++      builder->CreateCall(module->getOrInsertFunction(
++#else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
+               IntegerType::getInt32Ty(module->getContext()),
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              IntegerType::getInt32Ty(module->getContext())),
++#else
+               IntegerType::getInt32Ty(module->getContext()))),
++#endif
+               ArrayRef<Value*>(Args));
+ #else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+@@ -185,10 +193,18 @@ namespace gbe
+     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+ 
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++    builder->CreateCall(module->getOrInsertFunction(
++#else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+             ptrTy,
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++            IntegerType::getInt32Ty(module->getContext())),
++#else
+             IntegerType::getInt32Ty(module->getContext()))),
++#endif
+             ArrayRef<Value*>(Args2));
+ #else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+--- backend/src/llvm/llvm_device_enqueue.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_device_enqueue.cpp
+@@ -398,8 +398,13 @@ namespace gbe {
+               std::vector<Type *> ParamTys;
+               for (Value** iter = args.begin(); iter != args.end(); ++iter)
+                 ParamTys.push_back((*iter)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
++                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
++#else
+               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
++#endif
+               CI->replaceAllUsesWith(newCI);
+               deadInsnSet.insert(CI);
+             }
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 957e8a0ccd546c9f75abd77a27b688ccc229d8da Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 14/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From 2271eaafde29eb507077947188e40063b8abef63 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 15/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 7b4628be28d..dffd1d7119d 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.5.0
-revision=1
+revision=2
 _libclangmm_commit="687b9c231d850504ec515acb9ccab73f26c34063"
 _tiny_commit="a6773276efdbc322f1abb0159301f5502647eb52"
 wrksrc="jucipp-v${version}"

From 14141dd15f397ae05a7c1a706bf6e0fcaf92bb91 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 16/22] rtags: rebuild for clang-9.0.0

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

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

From 1e2259adeceea97394a5f1a388b5b7e7a60ec71a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 17/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 802fb4160856b7bf36548b6b0da5b9e40147d9c6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 18/22] ccls: rebuild for clang-9.0.0

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

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

From a21d4ce71e13bf5d6a6076f7617f8e4f12053ab2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 19/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From dd7323d91caf0add89f62242b6f6e96b2a0472b2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 20/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From baabc65a9b380ac72ab342817f1fe13d7b96a751 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 21/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 36c830571a5259fb52e9dfa4839ff40bbdfd899e Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 24 Sep 2019 14:02:01 +0200
Subject: [PATCH 22/22] afl: update to 2.55b + clang 8/9 fix

[ci skip]
---
 srcpkgs/afl/template | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/afl/template b/srcpkgs/afl/template
index 9842510d59f..59d0f7325ef 100644
--- a/srcpkgs/afl/template
+++ b/srcpkgs/afl/template
@@ -1,7 +1,8 @@
 # Template file for 'afl'
 pkgname=afl
-version=2.52b
+version=2.55b
 revision=1
+wrksrc="AFL-${version}"
 build_style=gnu-makefile
 # x86 only currently
 archs="i686* x86_64*"
@@ -9,17 +10,17 @@ hostmakedepends="llvm clang"
 short_desc="American fuzzy lop - a brute-force fuzzer"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Apache-2.0"
-homepage="http://lcamtuf.coredump.cx/afl/"
-distfiles="http://lcamtuf.coredump.cx/afl/releases/afl-${version}.tgz"
-checksum=43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045
+homepage="https://github.com/google/AFL/"
+distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
+checksum=ca96fa6fac76f1ee104762cc9313be37a398f936f2b0e8a9f66e94244ae6babc
 
 nostrip_files="small_archive.a small_exec.elf"
 
 do_build() {
 	make PREFIX=/usr
 
-	CFLAGS="${CFLAGS} -fPIC" \
-	CXXFLAGS="${CXXFLAGS} -fPIC" \
+	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
+	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
 	LDFLAGS="${LDFLAGS} -pie" \
 	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
 }

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (42 preceding siblings ...)
  2019-09-25 20:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
@ 2019-09-25 20:29 ` voidlinux-github
  2019-09-25 20:31 ` llvm9 voidlinux-github
                   ` (5 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-25 20:29 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [x] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [x] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From cd426ace995b5ad70ce290e5efc6a77b871bdc80 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From b9be3806876d26db07b2ed361a6825f6ab5108ba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index bcbd4332cc7..2bddb207419 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ccdce51762d92a346f56aac6eb7b7719c52cd36a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 30d92b590d59691b59e5a0d19c5d763e1f8244a6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From bde27d03865e51d8b6c55baea0ee1914bf43d51b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 9a43bf251f265079bbd3efe6e7facfaa808df99b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From d0f8905a455e123a6c1e1d66a1609e630570dd99 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From b030559cf0bff666874ced0612a89e3ced8ea724 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 33f56b1aacd158269ecd99ba828f76f4dd46c6be Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From e16bc96e474753acf1796de8de6abbbb52aebea4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 10/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From f9b29e8deff6b8da28522944ec2e51ff21e6798b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 11/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From fdc780c0ae8f1aa535b0c65dc77d1421ef2df17b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 12/22] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From dc9d81af6fac3877e5794205b9561b8ca47a4282 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 13/22] beignet: patch and rebuild for llvm-9.0.0

---
 srcpkgs/beignet/patches/llvm8.patch |  56 ++++++++
 srcpkgs/beignet/patches/llvm9.patch | 196 ++++++++++++++++++++++++++++
 srcpkgs/beignet/template            |   2 +-
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/beignet/patches/llvm8.patch
 create mode 100644 srcpkgs/beignet/patches/llvm9.patch

diff --git a/srcpkgs/beignet/patches/llvm8.patch b/srcpkgs/beignet/patches/llvm8.patch
new file mode 100644
index 00000000000..15128d1a115
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm8.patch
@@ -0,0 +1,56 @@
+From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
+From: Jan Beich <jbeich@FreeBSD.org>
+Date: Wed, 30 Jan 2019 12:42:34 +0000
+Subject: [PATCH] lang/beignet: unbreak with llvm80
+
+Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
+
+unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
+ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
+
+Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
+
+backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+
+--- backend/src/CMakeLists.txt.orig	2017-09-22 08:05:22 UTC
++++ backend/src/CMakeLists.txt
+@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
+ endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
+ 
+ add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
++target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
+ 
+ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
+   find_library(TERMINFO NAMES tinfo ncurses)
+--- backend/src/llvm/llvm_gen_backend.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_gen_backend.cpp
+@@ -3073,14 +3073,22 @@ namespace gbe
+ 
+ 
+   static unsigned getChildNo(BasicBlock *bb) {
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     return term->getNumSuccessors();
+   }
+ 
+   // return NULL if index out-range of children number
+   static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
+ 
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     unsigned childNo = term->getNumSuccessors();
+     BasicBlock *child = NULL;
+     if(index < childNo) {
diff --git a/srcpkgs/beignet/patches/llvm9.patch b/srcpkgs/beignet/patches/llvm9.patch
new file mode 100644
index 00000000000..83942a73472
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm9.patch
@@ -0,0 +1,196 @@
+Source: FreeBSD
+
+Regressed by https://github.com/llvm/llvm-project/commit/2e97d2aa1bd3
+
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::addMatcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&, clang::ast_matchers::MatchFinder::MatchCallback*)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::~MatchFinder()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxMethodDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxRecordDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unaryOperator
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructorDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxOperatorCallExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::expr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::allOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::anyOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::eachOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unless
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::varDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::callExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::castExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::internal::hasAnyNameFunc(llvm::ArrayRef<llvm::StringRef const*>)
+ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
+c++: error: linker command failed with exit code 1 (use -v to see invocation)
+
+Regressed by https://github.com/llvm/llvm-project/commit/13680223b9d8
+
+backend/src/llvm/llvm_intrinsic_lowering.cpp:80:19: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Constant *'
+        Constant* FCache = M->getOrInsertFunction(NewFn,
+                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:85:18: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:127:18: error:
+      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_profiling.cpp:166:27: error: no
+      matching function for call to 'cast'
+      builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+                          ^~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_device_enqueue.cpp:401:52: error:
+      no matching function for call to 'cast'
+              CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                                                   ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+                                           ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+      llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+      'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+                                             ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+backend/src/llvm/llvm_profiling.cpp:188:25: error: no
+      matching function for call to 'cast'
+    builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+                        ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+                                           ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+      llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+      'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+                                             ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+
+--- CMake/FindLLVM.cmake.orig	2017-09-22 08:05:22 UTC
++++ CMake/FindLLVM.cmake
+@@ -116,6 +116,9 @@ macro(add_one_lib name)
+ endmacro()
+ 
+ #Assume clang lib path same as llvm lib path
++if (LLVM_VERSION_NODOT VERSION_GREATER 80)
++add_one_lib("clang-cpp")
++endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
+ add_one_lib("clangCodeGen")
+ add_one_lib("clangFrontend")
+ add_one_lib("clangSerialization")
+--- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_intrinsic_lowering.cpp
+@@ -77,7 +77,11 @@ namespace gbe {
+         std::vector<Type *> ParamTys;
+         for (Value** I = ArgBegin; I != ArgEnd; ++I)
+           ParamTys.push_back((*I)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
++#else
+         Constant* FCache = M->getOrInsertFunction(NewFn,
++#endif
+                                         FunctionType::get(RetTy, ParamTys, false));
+ 
+         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
+--- backend/src/llvm/llvm_sampler_fix.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_sampler_fix.cpp
+@@ -82,7 +82,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+@@ -124,7 +128,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+--- backend/src/llvm/llvm_profiling.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_profiling.cpp
+@@ -163,10 +163,18 @@ namespace gbe
+       // __gen_ocl_store_timestamp(int nth, int type);
+       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++      builder->CreateCall(module->getOrInsertFunction(
++#else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
+               IntegerType::getInt32Ty(module->getContext()),
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              IntegerType::getInt32Ty(module->getContext())),
++#else
+               IntegerType::getInt32Ty(module->getContext()))),
++#endif
+               ArrayRef<Value*>(Args));
+ #else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+@@ -185,10 +193,18 @@ namespace gbe
+     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+ 
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++    builder->CreateCall(module->getOrInsertFunction(
++#else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+             ptrTy,
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++            IntegerType::getInt32Ty(module->getContext())),
++#else
+             IntegerType::getInt32Ty(module->getContext()))),
++#endif
+             ArrayRef<Value*>(Args2));
+ #else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+--- backend/src/llvm/llvm_device_enqueue.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_device_enqueue.cpp
+@@ -398,8 +398,13 @@ namespace gbe {
+               std::vector<Type *> ParamTys;
+               for (Value** iter = args.begin(); iter != args.end(); ++iter)
+                 ParamTys.push_back((*iter)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
++                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
++#else
+               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
++#endif
+               CI->replaceAllUsesWith(newCI);
+               deadInsnSet.insert(CI);
+             }
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..3c42546617b 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake

From 957e8a0ccd546c9f75abd77a27b688ccc229d8da Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 14/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From 2271eaafde29eb507077947188e40063b8abef63 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 15/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 7b4628be28d..dffd1d7119d 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.5.0
-revision=1
+revision=2
 _libclangmm_commit="687b9c231d850504ec515acb9ccab73f26c34063"
 _tiny_commit="a6773276efdbc322f1abb0159301f5502647eb52"
 wrksrc="jucipp-v${version}"

From 14141dd15f397ae05a7c1a706bf6e0fcaf92bb91 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 16/22] rtags: rebuild for clang-9.0.0

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

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

From 1e2259adeceea97394a5f1a388b5b7e7a60ec71a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 17/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From 802fb4160856b7bf36548b6b0da5b9e40147d9c6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 18/22] ccls: rebuild for clang-9.0.0

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

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

From a21d4ce71e13bf5d6a6076f7617f8e4f12053ab2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 19/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From dd7323d91caf0add89f62242b6f6e96b2a0472b2 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 20/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From baabc65a9b380ac72ab342817f1fe13d7b96a751 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 21/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 36c830571a5259fb52e9dfa4839ff40bbdfd899e Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 24 Sep 2019 14:02:01 +0200
Subject: [PATCH 22/22] afl: update to 2.55b + clang 8/9 fix

[ci skip]
---
 srcpkgs/afl/template | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/afl/template b/srcpkgs/afl/template
index 9842510d59f..59d0f7325ef 100644
--- a/srcpkgs/afl/template
+++ b/srcpkgs/afl/template
@@ -1,7 +1,8 @@
 # Template file for 'afl'
 pkgname=afl
-version=2.52b
+version=2.55b
 revision=1
+wrksrc="AFL-${version}"
 build_style=gnu-makefile
 # x86 only currently
 archs="i686* x86_64*"
@@ -9,17 +10,17 @@ hostmakedepends="llvm clang"
 short_desc="American fuzzy lop - a brute-force fuzzer"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Apache-2.0"
-homepage="http://lcamtuf.coredump.cx/afl/"
-distfiles="http://lcamtuf.coredump.cx/afl/releases/afl-${version}.tgz"
-checksum=43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045
+homepage="https://github.com/google/AFL/"
+distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
+checksum=ca96fa6fac76f1ee104762cc9313be37a398f936f2b0e8a9f66e94244ae6babc
 
 nostrip_files="small_archive.a small_exec.elf"
 
 do_build() {
 	make PREFIX=/usr
 
-	CFLAGS="${CFLAGS} -fPIC" \
-	CXXFLAGS="${CXXFLAGS} -fPIC" \
+	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
+	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
 	LDFLAGS="${LDFLAGS} -pie" \
 	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
 }

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (43 preceding siblings ...)
  2019-09-25 20:29 ` voidlinux-github
@ 2019-09-25 20:31 ` voidlinux-github
  2019-09-25 20:52 ` [PR PATCH] [Updated] llvm9 voidlinux-github
                   ` (4 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-25 20:31 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-535200846

Comment:
Rebased, and dropped qt5 rebuild as it'll be done by the 5.13.1 update: https://github.com/void-linux/void-packages/pull/14701 - beignet still broken for some reason

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (45 preceding siblings ...)
  2019-09-25 20:52 ` [PR PATCH] [Updated] llvm9 voidlinux-github
@ 2019-09-25 20:52 ` voidlinux-github
  2019-09-25 20:53 ` llvm9 voidlinux-github
                   ` (2 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-25 20:52 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [x] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [x] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From cd426ace995b5ad70ce290e5efc6a77b871bdc80 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From b9be3806876d26db07b2ed361a6825f6ab5108ba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index bcbd4332cc7..2bddb207419 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ccdce51762d92a346f56aac6eb7b7719c52cd36a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 30d92b590d59691b59e5a0d19c5d763e1f8244a6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From bde27d03865e51d8b6c55baea0ee1914bf43d51b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 9a43bf251f265079bbd3efe6e7facfaa808df99b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From d0f8905a455e123a6c1e1d66a1609e630570dd99 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From b030559cf0bff666874ced0612a89e3ced8ea724 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 33f56b1aacd158269ecd99ba828f76f4dd46c6be Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From e16bc96e474753acf1796de8de6abbbb52aebea4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 10/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From f9b29e8deff6b8da28522944ec2e51ff21e6798b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 11/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From fdc780c0ae8f1aa535b0c65dc77d1421ef2df17b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 12/22] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From dc7d9b451a5b5078a6b8748825b08dd26f2beeff Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 13/22] beignet: patch and unbreak + build for llvm-9.0.0

---
 srcpkgs/beignet/patches/llvm8.patch |  56 ++++++++++++++
 srcpkgs/beignet/patches/llvm9.patch | 111 ++++++++++++++++++++++++++++
 srcpkgs/beignet/template            |   3 +-
 3 files changed, 168 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/beignet/patches/llvm8.patch
 create mode 100644 srcpkgs/beignet/patches/llvm9.patch

diff --git a/srcpkgs/beignet/patches/llvm8.patch b/srcpkgs/beignet/patches/llvm8.patch
new file mode 100644
index 00000000000..15128d1a115
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm8.patch
@@ -0,0 +1,56 @@
+From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
+From: Jan Beich <jbeich@FreeBSD.org>
+Date: Wed, 30 Jan 2019 12:42:34 +0000
+Subject: [PATCH] lang/beignet: unbreak with llvm80
+
+Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
+
+unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
+ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
+
+Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
+
+backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+
+--- backend/src/CMakeLists.txt.orig	2017-09-22 08:05:22 UTC
++++ backend/src/CMakeLists.txt
+@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
+ endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
+ 
+ add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
++target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
+ 
+ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
+   find_library(TERMINFO NAMES tinfo ncurses)
+--- backend/src/llvm/llvm_gen_backend.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_gen_backend.cpp
+@@ -3073,14 +3073,22 @@ namespace gbe
+ 
+ 
+   static unsigned getChildNo(BasicBlock *bb) {
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     return term->getNumSuccessors();
+   }
+ 
+   // return NULL if index out-range of children number
+   static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
+ 
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     unsigned childNo = term->getNumSuccessors();
+     BasicBlock *child = NULL;
+     if(index < childNo) {
diff --git a/srcpkgs/beignet/patches/llvm9.patch b/srcpkgs/beignet/patches/llvm9.patch
new file mode 100644
index 00000000000..bff503800b0
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm9.patch
@@ -0,0 +1,111 @@
+Source: FreeBSD + q66
+
+Mostly FreeBSD other than FindLLVM.cmake changes.
+Linking against clang-cpp does not work for us.
+
+--- CMake/FindLLVM.cmake
++++ CMake/FindLLVM.cmake
+@@ -140,6 +140,7 @@ add_one_lib("clangStaticAnalyzerCore")
+ add_one_lib("clangAnalysis")
+ add_one_lib("clangEdit")
+ add_one_lib("clangAST")
++add_one_lib("clangASTMatchers")
+ add_one_lib("clangParse")
+ add_one_lib("clangSema")
+ add_one_lib("clangLex")
+--- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_intrinsic_lowering.cpp
+@@ -77,7 +77,11 @@ namespace gbe {
+         std::vector<Type *> ParamTys;
+         for (Value** I = ArgBegin; I != ArgEnd; ++I)
+           ParamTys.push_back((*I)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
++#else
+         Constant* FCache = M->getOrInsertFunction(NewFn,
++#endif
+                                         FunctionType::get(RetTy, ParamTys, false));
+ 
+         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
+--- backend/src/llvm/llvm_sampler_fix.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_sampler_fix.cpp
+@@ -82,7 +82,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+@@ -124,7 +128,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+--- backend/src/llvm/llvm_profiling.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_profiling.cpp
+@@ -163,10 +163,18 @@ namespace gbe
+       // __gen_ocl_store_timestamp(int nth, int type);
+       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++      builder->CreateCall(module->getOrInsertFunction(
++#else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
+               IntegerType::getInt32Ty(module->getContext()),
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              IntegerType::getInt32Ty(module->getContext())),
++#else
+               IntegerType::getInt32Ty(module->getContext()))),
++#endif
+               ArrayRef<Value*>(Args));
+ #else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+@@ -185,10 +193,18 @@ namespace gbe
+     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+ 
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++    builder->CreateCall(module->getOrInsertFunction(
++#else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+             ptrTy,
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++            IntegerType::getInt32Ty(module->getContext())),
++#else
+             IntegerType::getInt32Ty(module->getContext()))),
++#endif
+             ArrayRef<Value*>(Args2));
+ #else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+--- backend/src/llvm/llvm_device_enqueue.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_device_enqueue.cpp
+@@ -398,8 +398,13 @@ namespace gbe {
+               std::vector<Type *> ParamTys;
+               for (Value** iter = args.begin(); iter != args.end(); ++iter)
+                 ParamTys.push_back((*iter)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
++                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
++#else
+               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
++#endif
+               CI->replaceAllUsesWith(newCI);
+               deadInsnSet.insert(CI);
+             }
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..eedb7aef1a7 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake
@@ -14,7 +14,6 @@ license="LGPL-2.1-or-later"
 homepage="http://www.freedesktop.org/wiki/Software/Beignet/"
 distfiles="https://01.org/sites/default/files/${pkgname}-${version}-source.tar.gz"
 checksum=c555edba149de23243965a703f39f79fa06f15bcff5a3762b5544b0925010b43
-broken="Doesn't build against libLLVM8; can't be built against libclang 8 and libLLVM7"
 
 post_install() {
 	# remove CL headers, we do use opencl-headers instead.

From 676c7d9578f924483fabb0b5f5f26cf083f51a35 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 14/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From 61d2f04c2fb234a0e86245e576d11b0e44f07ebd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 15/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 7b4628be28d..dffd1d7119d 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.5.0
-revision=1
+revision=2
 _libclangmm_commit="687b9c231d850504ec515acb9ccab73f26c34063"
 _tiny_commit="a6773276efdbc322f1abb0159301f5502647eb52"
 wrksrc="jucipp-v${version}"

From 03859bf894d4a67adb11d0db05e9285bae7036e8 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 16/22] rtags: rebuild for clang-9.0.0

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

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

From 6a1f35e412ca4b7d5eb2e5fdba63f35cfd075206 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 17/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From a697a46a3df27b076fe1d989c8189a305dbf345e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 18/22] ccls: rebuild for clang-9.0.0

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

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

From 1226e0b68a8dfcd94f69819fde576d2ce67be703 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 19/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From 9b5f4e54a0d465372491c088d277c8f910b1ae1c Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 20/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From c9086781f4f9b72b7447cbb1657ee8cebc7149e7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 21/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 1866e4235bd6ca2d9e68aaa6fdded1abe1a98569 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 24 Sep 2019 14:02:01 +0200
Subject: [PATCH 22/22] afl: update to 2.55b + clang 8/9 fix

[ci skip]
---
 srcpkgs/afl/template | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/afl/template b/srcpkgs/afl/template
index 9842510d59f..59d0f7325ef 100644
--- a/srcpkgs/afl/template
+++ b/srcpkgs/afl/template
@@ -1,7 +1,8 @@
 # Template file for 'afl'
 pkgname=afl
-version=2.52b
+version=2.55b
 revision=1
+wrksrc="AFL-${version}"
 build_style=gnu-makefile
 # x86 only currently
 archs="i686* x86_64*"
@@ -9,17 +10,17 @@ hostmakedepends="llvm clang"
 short_desc="American fuzzy lop - a brute-force fuzzer"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Apache-2.0"
-homepage="http://lcamtuf.coredump.cx/afl/"
-distfiles="http://lcamtuf.coredump.cx/afl/releases/afl-${version}.tgz"
-checksum=43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045
+homepage="https://github.com/google/AFL/"
+distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
+checksum=ca96fa6fac76f1ee104762cc9313be37a398f936f2b0e8a9f66e94244ae6babc
 
 nostrip_files="small_archive.a small_exec.elf"
 
 do_build() {
 	make PREFIX=/usr
 
-	CFLAGS="${CFLAGS} -fPIC" \
-	CXXFLAGS="${CXXFLAGS} -fPIC" \
+	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
+	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
 	LDFLAGS="${LDFLAGS} -pie" \
 	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
 }

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

* Re: [PR PATCH] [Updated] llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (44 preceding siblings ...)
  2019-09-25 20:31 ` llvm9 voidlinux-github
@ 2019-09-25 20:52 ` voidlinux-github
  2019-09-25 20:52 ` voidlinux-github
                   ` (3 subsequent siblings)
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-25 20:52 UTC (permalink / raw)
  To: ml

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

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

https://github.com/void-ppc/void-packages llvm9
https://github.com/void-linux/void-packages/pull/14656

llvm9
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [ ] x86_64-musl **[need help]**
- [ ] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [ ] aarch64
- [ ] aarch64-musl
- [ ] armv7l **[need help]**
- [ ] armv6l **[need help]**
- [ ] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [ ] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [x] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [x] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

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

From cd426ace995b5ad70ce290e5efc6a77b871bdc80 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:22:59 +0200
Subject: [PATCH 01/22] llvm8: update to 8.0.1, remove clang, lld etc., set up
 conflicts

---
 srcpkgs/clang             |   1 -
 srcpkgs/clang-analyzer    |   1 -
 srcpkgs/clang-tools-extra |   1 -
 srcpkgs/lld               |   1 -
 srcpkgs/lld-devel         |   1 -
 srcpkgs/lldb              |   1 -
 srcpkgs/lldb-devel        |   1 -
 srcpkgs/llvm8/template    | 183 ++------------------------------------
 8 files changed, 7 insertions(+), 183 deletions(-)
 delete mode 120000 srcpkgs/clang
 delete mode 120000 srcpkgs/clang-analyzer
 delete mode 120000 srcpkgs/clang-tools-extra
 delete mode 120000 srcpkgs/lld
 delete mode 120000 srcpkgs/lld-devel
 delete mode 120000 srcpkgs/lldb
 delete mode 120000 srcpkgs/lldb-devel

diff --git a/srcpkgs/clang b/srcpkgs/clang
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-analyzer
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/clang-tools-extra
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lld-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
deleted file mode 120000
index 8ec3476f9c1..00000000000
--- a/srcpkgs/lldb-devel
+++ /dev/null
@@ -1 +0,0 @@
-llvm8
\ No newline at end of file
diff --git a/srcpkgs/llvm8/template b/srcpkgs/llvm8/template
index f8377dacf93..563b109fdff 100644
--- a/srcpkgs/llvm8/template
+++ b/srcpkgs/llvm8/template
@@ -1,7 +1,7 @@
 # Template file for 'llvm8'
 pkgname=llvm8
-version=8.0.0
-revision=7
+version=8.0.1
+revision=1
 wrksrc="llvm-${version}.src"
 build_style=cmake
 configure_args="
@@ -20,38 +20,15 @@ short_desc="Low Level Virtual Machine"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="NCSA"
 homepage="https://www.llvm.org"
-distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
-https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
- https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
- https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
- https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
-checksum="8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c
- 49918b9f09816554a20ac44c5f85a32dc0a7a00759b3259e78064d674eac0373
- 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37
- 084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b
- 4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b
- b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1"
+distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
+checksum="44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7"
 disable_parallel_builds=yes
 lib32disabled=yes
 
-_lldb_enable=yes
+# all of these provide llvm-config
+conflicts="llvm>=0 llvm3.9>=0 llvm6.0>=0 llvm7>=0 llvm9>=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 libllvm8"
-if [ "$_lldb_enable" = "yes" ]; then
-	# XXX fails to cross compile due to python
-	subpackages+=" lldb lldb-devel"
-fi
-subpackages+=" lld lld-devel"
+subpackages="libllvm8"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
@@ -64,51 +41,6 @@ post_patch() {
 		msg_normal "Applying $i to llvm\n"
 		patch -sNp1 -i ${i}
 	done
-
-	cd ${XBPS_BUILDDIR}/cfe-${version}.src
-	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
-		msg_normal "Applying $i to cfe\n"
-		patch -sNp1 -i ${i}
-	done
-
-	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}/cfe-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
-		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
-	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() {
@@ -131,9 +63,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
 
@@ -175,105 +105,6 @@ do_install() {
 	fi
 }
 
-clang-analyzer_package() {
-	archs=noarch
-	pycompile_dirs="usr/share/scan-view"
-	depends="clang-${version}_${revision} python"
-	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() {
-	depends="clang-${version}_${revision} python"
-	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/modularize
-		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"
-	case "$XBPS_TARGET_MACHINE" in
-		*-musl) depends+=" musl-devel";;
-		*) depends+=" glibc-devel";;
-	esac
-	short_desc+=" - C language family frontend"
-	alternatives="cc:cc:/usr/bin/clang"
-	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*"
-		vmove "usr/share/clang"
-	}
-}
-
-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+=" python-six"
-	short_desc+=" - LLDB debugger"
-	homepage="https://lldb.llvm.org/"
-	pkg_install() {
-		vmove usr/bin/*lldb*
-		vmove usr/lib/liblldb*so.*
-		vman tools/lldb/docs/lldb.1
-		vmove /usr/lib/python*
-		# Depend on python-six instead of conflicting
-		rm "${PKGDESTDIR}/usr/lib/python2.7/site-packages/six.py"
-	}
-}
-
-lldb-devel_package() {
-	depends="lldb>=${version}_${revision}"
-	short_desc+=" - LLDB debugger - development files"
-	pkg_install() {
-		vmove usr/include/lldb
-		vmove "usr/lib/liblldb*.a"
-		vmove "usr/lib/liblldb*.so"
-	}
-}
-
 libllvm8_package() {
 	short_desc+=" - runtime library"
 	pkg_install() {

From b9be3806876d26db07b2ed361a6825f6ab5108ba Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:25:26 +0200
Subject: [PATCH 02/22] New package: llvm9-9.0.0

---
 common/shlibs                                 |   8 +-
 srcpkgs/clang                                 |   1 +
 srcpkgs/clang-analyzer                        |   1 +
 srcpkgs/clang-tools-extra                     |   1 +
 srcpkgs/libllvm9                              |   1 +
 srcpkgs/lld                                   |   1 +
 srcpkgs/lld-devel                             |   1 +
 srcpkgs/lldb                                  |   1 +
 srcpkgs/lldb-devel                            |   1 +
 srcpkgs/llvm9/files/llvm-Config-config.h      |   9 +
 srcpkgs/llvm9/files/llvm-Config-llvm-config.h |   9 +
 .../cfe-001-fix-unwind-chain-inclusion.patch  |  44 +++
 .../cfe/cfe-002-add-musl-triples.patch        |  91 ++++++
 .../cfe-003-ppc64-dynamic-linker-path.patch   |  18 ++
 .../cfe/cfe-004-ppc64-musl-elfv2.patch        |  27 ++
 .../files/patches/cfe/cfe-005-gcc9.patch      |  40 +++
 srcpkgs/llvm9/files/patches/lldb/musl.patch   |  31 ++
 .../files/patches/llvm/llvm-001-musl.patch    |  58 ++++
 .../llvm/llvm-002-musl-ppc64-elfv2.patch      |  31 ++
 .../patches/llvm/llvm-003-secureplt.patch     |  25 ++
 .../patches/llvm/llvm-004-override-opt.patch  |  18 ++
 srcpkgs/llvm9/template                        | 283 ++++++++++++++++++
 srcpkgs/llvm9/update                          |   2 +
 23 files changed, 698 insertions(+), 4 deletions(-)
 create mode 120000 srcpkgs/clang
 create mode 120000 srcpkgs/clang-analyzer
 create mode 120000 srcpkgs/clang-tools-extra
 create mode 120000 srcpkgs/libllvm9
 create mode 120000 srcpkgs/lld
 create mode 120000 srcpkgs/lld-devel
 create mode 120000 srcpkgs/lldb
 create mode 120000 srcpkgs/lldb-devel
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-config.h
 create mode 100644 srcpkgs/llvm9/files/llvm-Config-llvm-config.h
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
 create mode 100644 srcpkgs/llvm9/files/patches/lldb/musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
 create mode 100644 srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
 create mode 100644 srcpkgs/llvm9/template
 create mode 100644 srcpkgs/llvm9/update

diff --git a/common/shlibs b/common/shlibs
index bcbd4332cc7..2bddb207419 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1021,13 +1021,13 @@ 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.8 lldb-8.0.0_1
-libclang.so.8 clang-8.0.0_1
+liblldb.so.9 lldb-9.0.0_1
+libclang.so.9 clang-9.0.0_1
+libclang-cpp.so.9 clang-9.0.0_1
 libLLVM-6.0.so libllvm6.0-6.0.0_1
 libLLVM-7.so libllvm7-7.0.0_1
 libLLVM-8.so libllvm8-8.0.0_1
-libOptRemarks.so.8 libllvm8-8.0.0_1
-libLTO.so.8 libllvm8-8.0.0_1
+libLLVM-9.so libllvm9-9.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
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-analyzer
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/clang-tools-extra
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/libllvm9 b/srcpkgs/libllvm9
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/libllvm9
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld b/srcpkgs/lld
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lld-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb b/srcpkgs/lldb
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel
new file mode 120000
index 00000000000..14540d7bad2
--- /dev/null
+++ b/srcpkgs/lldb-devel
@@ -0,0 +1 @@
+llvm9
\ No newline at end of file
diff --git a/srcpkgs/llvm9/files/llvm-Config-config.h b/srcpkgs/llvm9/files/llvm-Config-config.h
new file mode 100644
index 00000000000..c369b4551f7
--- /dev/null
+++ b/srcpkgs/llvm9/files/llvm-Config-config.h
@@ -0,0 +1,9 @@
+#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/llvm9/files/llvm-Config-llvm-config.h b/srcpkgs/llvm9/files/llvm-Config-llvm-config.h
new file mode 100644
index 00000000000..2fa08c9be69
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 00000000000..04244bcc274
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-002-add-musl-triples.patch
new file mode 100644
index 00000000000..aefc88d48f5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-003-ppc64-dynamic-linker-path.patch
new file mode 100644
index 00000000000..4b9b0b891d5
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-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/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
new file mode 100644
index 00000000000..14dfc007ed3
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-004-ppc64-musl-elfv2.patch
@@ -0,0 +1,27 @@
+--- a/lib/Basic/Targets/PPC.h
++++ b/lib/Basic/Targets/PPC.h
+@@ -376,11 +376,11 @@ 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 = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1";
+     }
++    /* default to elfv2 always, ignore llvm's elfv2 triples */
++    ABI = "elfv2";
+ 
+     if (Triple.getOS() == llvm::Triple::AIX)
+       SuitableAlign = 64;
+--- a/lib/Driver/ToolChains/Clang.cpp
++++ b/lib/Driver/ToolChains/Clang.cpp
+@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
+         break;
+       }
+ 
+-      ABIName = "elfv1";
++      ABIName = "elfv2";
+       break;
+     }
+     case llvm::Triple::ppc64le:
diff --git a/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
new file mode 100644
index 00000000000..f600a6657ef
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/cfe/cfe-005-gcc9.patch
@@ -0,0 +1,40 @@
+From a1445cd0340006d7635101c4c2b27ae51328642c Mon Sep 17 00:00:00 2001
+From: Serge Guelton <sguelton@redhat.com>
+Date: Thu, 19 Sep 2019 00:54:40 +0000
+Subject: [PATCH] Initialize all fields in ABIArgInfo.
+
+Due to usage of an uninitialized fields, we end up with
+a Conditional jump or move depends on uninitialised value
+
+Fixes https://bugs.llvm.org/show_bug.cgi?id=40547
+
+Commited on behalf of Martin Liska <mliska@suse.cz>
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ include/clang/CodeGen/CGFunctionInfo.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
+index 1f81072e23d0..5069d9af42a3 100644
+--- a/include/clang/CodeGen/CGFunctionInfo.h
++++ b/include/clang/CodeGen/CGFunctionInfo.h
+@@ -109,14 +109,12 @@ class ABIArgInfo {
+     UnpaddedCoerceAndExpandType = T;
+   }
+ 
+-  ABIArgInfo(Kind K)
+-      : TheKind(K), PaddingInReg(false), InReg(false) {
+-  }
+-
+ public:
+-  ABIArgInfo()
++  ABIArgInfo(Kind K = Direct)
+       : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+-        TheKind(Direct), PaddingInReg(false), InReg(false) {}
++        TheKind(K), PaddingInReg(false), InAllocaSRet(false),
++        IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
++        InReg(false), CanBeFlattened(false), SignExt(false) {}
+ 
+   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
+                               llvm::Type *Padding = nullptr,
diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm9/files/patches/lldb/musl.patch
new file mode 100644
index 00000000000..37416bb478d
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-001-musl.patch
new file mode 100644
index 00000000000..a0eddbf58be
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
new file mode 100644
index 00000000000..955a9a94626
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
@@ -0,0 +1,31 @@
+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
+@@ -211,11 +211,11 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
+ 
+   switch (TT.getArch()) {
+   case Triple::ppc64le:
+-    return PPCTargetMachine::PPC_ABI_ELFv2;
+   case Triple::ppc64:
+-    if (TT.getEnvironment() == llvm::Triple::ELFv2)
+-      return PPCTargetMachine::PPC_ABI_ELFv2;
+-    return PPCTargetMachine::PPC_ABI_ELFv1;
++    /* default to ELFv2 always, don't care about llvm's stupid broken suffix
++     * triples; people can override the default properly via -mabi like gcc
++     */
++    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/llvm9/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
new file mode 100644
index 00000000000..829196497b2
--- /dev/null
+++ b/srcpkgs/llvm9/files/patches/llvm/llvm-003-secureplt.patch
@@ -0,0 +1,25 @@
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -145,8 +145,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
+   if (isDarwin())
+     HasLazyResolverStubs = true;
+ 
+-  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() ||
+-      TargetTriple.isMusl())
++  if (TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || isTargetLinux())
+     SecurePlt = true;
+ 
+   if (HasSPE && IsPPC64)
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -234,6 +234,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+   if (TT.getArch() == Triple::ppc64)
+     return Reloc::PIC_;
+ 
++  // We force SecurePlt on 32-bit ppc linux which requires PIC
++  if (TT.isOSLinux() && (TT.getArch() == Triple::ppc))
++    return Reloc::PIC_;
++
+   // Rest are static by default.
+   return Reloc::Static;
+ }
diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-004-override-opt.patch
new file mode 100644
index 00000000000..30d1e14e193
--- /dev/null
+++ b/srcpkgs/llvm9/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/llvm9/template b/srcpkgs/llvm9/template
new file mode 100644
index 00000000000..4d4954df6f7
--- /dev/null
+++ b/srcpkgs/llvm9/template
@@ -0,0 +1,283 @@
+# Template file for 'llvm9'
+pkgname=llvm9
+version=9.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="libllvm9"
+short_desc="Low Level Virtual Machine"
+maintainer="q66 <daniel@octaforge.org>"
+license="NCSA"
+homepage="https://www.llvm.org"
+distfiles="https://releases.llvm.org/${version}/llvm-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lldb-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/lld-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/cfe-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/clang-tools-extra-${version}.src.tar.xz
+ https://releases.llvm.org/${version}/compiler-rt-${version}.src.tar.xz"
+checksum="d6a0565cf21f22e9b4353b2eb92622e8365000a9e90a16b09b56f8157eabfe84
+ 1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794
+ 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91
+ 7ba81eef7c22ca5da688fdf9d88c20934d2d6b40bfe150ffd338900890aa4610
+ ea1c86ce352992d7b6f6649bc622f6a2707b9f8b7153e9f9181a35c76aa3ac10
+ 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e"
+disable_parallel_builds=yes
+lib32disabled=yes
+# necessary to override auto default
+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 libllvm9"
+if [ "$_lldb_enable" = "yes" ]; then
+	# XXX fails to cross compile due to python
+	subpackages+=" lldb lldb-devel"
+fi
+subpackages+=" lld lld-devel"
+
+case "$XBPS_TARGET_MACHINE" in
+	armv5*) broken="Tries to assemble VFP instructions with armv5tel arch";;
+esac
+
+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}/cfe-${version}.src
+	for i in ${FILESDIR}/patches/cfe/cfe-*.patch; do
+		msg_normal "Applying $i to cfe\n"
+		patch -sNp1 -i ${i}
+	done
+
+	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}/cfe-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/cfe-${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 [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
+		mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
+	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
+		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_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() {
+	archs=noarch
+	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() {
+	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/modularize
+		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"
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl) depends+=" musl-devel";;
+		*) depends+=" glibc-devel";;
+	esac
+	short_desc+=" - C language family frontend"
+	alternatives="cc:cc:/usr/bin/clang"
+	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*"
+		vmove "usr/share/clang"
+	}
+}
+
+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.*
+		vman tools/lldb/docs/lldb.1
+		vmove /usr/lib/python*
+		# Depend on python3-six instead of conflicting
+		rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py
+	}
+}
+
+lldb-devel_package() {
+	depends="lldb>=${version}_${revision}"
+	short_desc+=" - LLDB debugger - development files"
+	pkg_install() {
+		vmove usr/include/lldb
+		vmove "usr/lib/liblldb*.so"
+	}
+}
+
+libllvm9_package() {
+	short_desc+=" - runtime library"
+	pkg_install() {
+		vmove "usr/lib/libLLVM-*.so*"
+	}
+}
diff --git a/srcpkgs/llvm9/update b/srcpkgs/llvm9/update
new file mode 100644
index 00000000000..3d09eaff373
--- /dev/null
+++ b/srcpkgs/llvm9/update
@@ -0,0 +1,2 @@
+site=https://releases.llvm.org/
+pattern="'\K[\d\.]*(?=')"

From ccdce51762d92a346f56aac6eb7b7719c52cd36a Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:35:25 +0200
Subject: [PATCH 03/22] llvm: update to 9.0.0

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

diff --git a/srcpkgs/llvm/template b/srcpkgs/llvm/template
index bb84697f830..b6212fc8bfd 100644
--- a/srcpkgs/llvm/template
+++ b/srcpkgs/llvm/template
@@ -1,9 +1,9 @@
 # Template file for 'llvm'
 pkgname=llvm
-version=8.0.0
+version=9.0.0
 revision=1
 build_style=meta
-depends="llvm8"
+depends="llvm9"
 short_desc="LLVM meta package"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="Public Domain"

From 30d92b590d59691b59e5a0d19c5d763e1f8244a6 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:51 +0200
Subject: [PATCH 04/22] llvm-libunwind: update to 9.0.0 + fix ppc32

---
 srcpkgs/llvm-libunwind/patches/ppc32.patch | 63 ++++++++++++++++++++++
 srcpkgs/llvm-libunwind/template            |  8 +--
 2 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/llvm-libunwind/patches/ppc32.patch

diff --git a/srcpkgs/llvm-libunwind/patches/ppc32.patch b/srcpkgs/llvm-libunwind/patches/ppc32.patch
new file mode 100644
index 00000000000..1408a0aafb0
--- /dev/null
+++ b/srcpkgs/llvm-libunwind/patches/ppc32.patch
@@ -0,0 +1,63 @@
+This fixes build at least with gcc9 which does not define `__ppc__`.
+
+--- include/__libunwind_config.h
++++ include/__libunwind_config.h
+@@ -49,7 +49,7 @@
+ #  define _LIBUNWIND_CONTEXT_SIZE 167
+ #  define _LIBUNWIND_CURSOR_SIZE 179
+ #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
+-# elif defined(__ppc__)
++# elif defined(__powerpc__)
+ #  define _LIBUNWIND_TARGET_PPC 1
+ #  define _LIBUNWIND_CONTEXT_SIZE 117
+ #  define _LIBUNWIND_CURSOR_SIZE 124
+--- src/UnwindRegistersRestore.S
++++ src/UnwindRegistersRestore.S
+@@ -392,7 +392,7 @@ Lnovec:
+   PPC64_LR(3)
+   bctr
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
+ //
+--- src/UnwindRegistersSave.S
++++ src/UnwindRegistersSave.S
+@@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+   blr
+ 
+ 
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ 
+ //
+ // extern int unw_getcontext(unw_context_t* thread_state)
+--- src/config.h
++++ src/config.h
+@@ -95,12 +95,12 @@
+ #define _LIBUNWIND_BUILD_SJLJ_APIS
+ #endif
+ 
+-#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__)
++#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__powerpc64__)
+ #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__) ||                                \
+-    defined(__ppc__) || defined(__ppc64__) || defined(__powerpc64__) ||        \
++    defined(__powerpc__) || defined(__powerpc64__) ||                          \
+     (!defined(__APPLE__) && defined(__arm__)) ||                               \
+     (defined(__arm64__) || defined(__aarch64__)) ||                            \
+     defined(__mips__)
+--- src/libunwind.cpp
++++ src/libunwind.cpp
+@@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
+ # define REGISTER_KIND Registers_x86_64
+ #elif defined(__powerpc64__)
+ # define REGISTER_KIND Registers_ppc64
+-#elif defined(__ppc__)
++#elif defined(__powerpc__)
+ # define REGISTER_KIND Registers_ppc
+ #elif defined(__aarch64__)
+ # define REGISTER_KIND Registers_arm64
diff --git a/srcpkgs/llvm-libunwind/template b/srcpkgs/llvm-libunwind/template
index e6d02df3b8f..c5dd2da671e 100644
--- a/srcpkgs/llvm-libunwind/template
+++ b/srcpkgs/llvm-libunwind/template
@@ -1,18 +1,18 @@
 # Template file for 'llvm-libunwind'
 pkgname=llvm-libunwind
-version=7.0.1
+version=9.0.0
 revision=1
 build_style=cmake
 wrksrc="libunwind-${version}.src"
-hostmakedepends="llvm7"
-makedepends="llvm7"
+hostmakedepends="llvm9"
+makedepends="llvm9"
 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://www.llvm.org/releases/${version}/libunwind-${version}.src.tar.xz"
-checksum=89c852991dfd9279dbca9d5ac10b53c67ad7d0f54bbab7156e9f057a978b5912
+checksum=976a8d09e1424fb843210eecec00a506b956e6c31adda3b0d199e945be0d0db2
 
 post_install() {
 	vmkdir usr/include

From bde27d03865e51d8b6c55baea0ee1914bf43d51b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:38:01 +0200
Subject: [PATCH 05/22] libcxxabi: update to 9.0.0

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

diff --git a/srcpkgs/libcxxabi/template b/srcpkgs/libcxxabi/template
index fe748223ef3..03b9424deee 100644
--- a/srcpkgs/libcxxabi/template
+++ b/srcpkgs/libcxxabi/template
@@ -1,6 +1,6 @@
 # Template file for 'libcxxabi'
 pkgname=libcxxabi
-version=8.0.0
+version=9.0.0
 revision=1
 wrksrc="${pkgname}-${version}.src"
 build_style=cmake
@@ -8,16 +8,16 @@ 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="llvm8"
-makedepends="llvm8 llvm-libunwind-devel"
+hostmakedepends="llvm9"
+makedepends="llvm9 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://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz
  https://www.llvm.org/releases/${version}/libcxx-${version}.src.tar.xz"
-checksum="c2d6de9629f7c072ac20ada776374e9e3168142f20a46cdb9d6df973922b07cd
- c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2"
+checksum="675041783565c906ac2f7f8b2bc5c40f14d871ecfa8ade34855aa18de95530e9
+ 3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c"
 
 case "$XBPS_TARGET_MACHINE" in
 	armv[67]l)

From 9a43bf251f265079bbd3efe6e7facfaa808df99b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 00:37:15 +0200
Subject: [PATCH 06/22] libcxx: update to 9.0.0 + ppc long double patch

---
 srcpkgs/libcxx/patches/ppc.patch | 22 ++++++++++++++++++++++
 srcpkgs/libcxx/template          |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/libcxx/patches/ppc.patch

diff --git a/srcpkgs/libcxx/patches/ppc.patch b/srcpkgs/libcxx/patches/ppc.patch
new file mode 100644
index 00000000000..adcb0c57b0d
--- /dev/null
+++ b/srcpkgs/libcxx/patches/ppc.patch
@@ -0,0 +1,22 @@
+This ensures `is_iec559` is defined correctly under all long double ABIs,
+including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__`
+is not defined on gcc.
+
+--- include/limits
++++ include/limits
+@@ -426,8 +426,14 @@ protected:
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
+     _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
+ 
+-#if (defined(__ppc__) || defined(__ppc64__))
++#if defined(__powerpc__) || defined(__powerpc64__)
++#if (__LDBL_MAX_EXP__ > __DBL_MAX_EXP__) || (__LDBL_MANT_DIG__ == __DBL_MANT_DIG__)
++    /* IEEE 754 quadruple or double precision */
++    static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
++#else
++    /* 128-bit IBM double-double */
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
++#endif
+ #else
+     static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
+ #endif
diff --git a/srcpkgs/libcxx/template b/srcpkgs/libcxx/template
index df7444a470f..58af53e149e 100644
--- a/srcpkgs/libcxx/template
+++ b/srcpkgs/libcxx/template
@@ -1,13 +1,13 @@
 # Template file for 'libcxx'
 pkgname=libcxx
-version=8.0.0
+version=9.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="llvm8 python"
+hostmakedepends="llvm9 python3"
 makedepends="libcxxabi-devel llvm llvm-libunwind-devel"
 make_build_args="VERBOSE=1"
 short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
@@ -15,7 +15,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
 license="NCSA, MIT"
 homepage="https://libcxx.llvm.org"
 distfiles="https://www.llvm.org/releases/${version}/${pkgname}-${version}.src.tar.xz"
-checksum=c2902675e7c84324fb2c1e45489220f250ede016cc3117186785d9dc291f9de2
+checksum=3c4162972b5d3204ba47ac384aa456855a17b5e97422723d4758251acf1ed28c
 
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"

From d0f8905a455e123a6c1e1d66a1609e630570dd99 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:09 +0200
Subject: [PATCH 07/22] bpftrace: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/bpftrace/template b/srcpkgs/bpftrace/template
index cac5b779664..56d673d38e5 100644
--- a/srcpkgs/bpftrace/template
+++ b/srcpkgs/bpftrace/template
@@ -1,7 +1,7 @@
 # Template file for 'bpftrace'
 pkgname=bpftrace
 version=0.9.2
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DBUILD_TESTING=OFF"  # needs root to run
 hostmakedepends="pkg-config flex"

From b030559cf0bff666874ced0612a89e3ced8ea724 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:28 +0200
Subject: [PATCH 08/22] gnome-builder: rebuild for clang-9.0.0

---
 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 ebed528508f..98a9a3eeff5 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.32.4
-revision=2
+revision=3
 build_style=meson
 configure_args="-Dwith_webkit=true -Dwith_sysprof=true -Dhelp=true"
 hostmakedepends="appdata-tools desktop-file-utils flex gobject-introspection

From 33f56b1aacd158269ecd99ba828f76f4dd46c6be Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:34:51 +0200
Subject: [PATCH 09/22] kdevelop: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/kdevelop/template b/srcpkgs/kdevelop/template
index fefb49159df..ad3c8d13c32 100644
--- a/srcpkgs/kdevelop/template
+++ b/srcpkgs/kdevelop/template
@@ -1,7 +1,7 @@
 # Template file for 'kdevelop'
 pkgname=kdevelop
 version=5.4.1
-revision=1
+revision=2
 build_style=cmake
 hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
 makedepends="apr-util-devel clang grantlee5-devel kcmutils-devel kdevelop-pg-qt

From e16bc96e474753acf1796de8de6abbbb52aebea4 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:13 +0200
Subject: [PATCH 10/22] shiboken2: rebuild for clang-9.0.0 + fix build with
 qt5.13

---
 srcpkgs/shiboken2/patches/qstringlist.patch | 12 ++++++++++++
 srcpkgs/shiboken2/template                  |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/shiboken2/patches/qstringlist.patch

diff --git a/srcpkgs/shiboken2/patches/qstringlist.patch b/srcpkgs/shiboken2/patches/qstringlist.patch
new file mode 100644
index 00000000000..2dc1e3d0885
--- /dev/null
+++ b/srcpkgs/shiboken2/patches/qstringlist.patch
@@ -0,0 +1,12 @@
+Fixes build with Qt 5.13.
+
+--- sources/shiboken2/ApiExtractor/clangparser/clangutils.h
++++ sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+@@ -33,6 +33,7 @@
+ #include <QtCore/QPair>
+ #include <QtCore/QString>
+ #include <QtCore/QVector>
++#include <QtCore/QStringList>
+ 
+ QT_FORWARD_DECLARE_CLASS(QDebug)
+ 
diff --git a/srcpkgs/shiboken2/template b/srcpkgs/shiboken2/template
index 437833aed3f..394d9ba4f94 100644
--- a/srcpkgs/shiboken2/template
+++ b/srcpkgs/shiboken2/template
@@ -1,7 +1,7 @@
 # Template file for 'shiboken2'
 pkgname=shiboken2
 version=5.11.2
-revision=1
+revision=2
 _pkgname="pyside-setup-everywhere-src-${version}"
 wrksrc="$_pkgname"
 configure_args="-DUSE_PYTHON_VERSION=3 -DCMAKE_INSTALL_PREFIX=/usr

From f9b29e8deff6b8da28522944ec2e51ff21e6798b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 01:36:34 +0200
Subject: [PATCH 11/22] codelite: rebuild for lldb-9.0.0

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

diff --git a/srcpkgs/codelite/template b/srcpkgs/codelite/template
index cb2ef04fca4..9ca8123dafe 100644
--- a/srcpkgs/codelite/template
+++ b/srcpkgs/codelite/template
@@ -1,7 +1,7 @@
 # Template file for 'codelite'
 pkgname=codelite
 version=13.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DWITH_PCH=0
  $(vopt_if sftp -DENABLE_SFTP=1)

From fdc780c0ae8f1aa535b0c65dc77d1421ef2df17b Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:18:19 +0200
Subject: [PATCH 12/22] libGL: patch and rebuild for llvm-9.0.0

---
 ...1a6b776e0f874e0e14d9943ac2b06bcc4aad.patch | 26 +++++++++++++++++++
 srcpkgs/libGL/template                        |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch

diff --git a/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
new file mode 100644
index 00000000000..d0db64c76e0
--- /dev/null
+++ b/srcpkgs/libGL/patches/3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad.patch
@@ -0,0 +1,26 @@
+From 3fd21a6b776e0f874e0e14d9943ac2b06bcc4aad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Fri, 28 Jun 2019 11:07:39 +0200
+Subject: [PATCH] targets/opencl: Add clangASTMatchers library as dependency
+
+Fixes link failure since clang r364424 "[clang/DIVar] Emit the flag for
+params that have unmodified value", clangCodeGen depends on
+clangASTMatchers now.
+
+Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
+---
+ src/gallium/targets/opencl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
+index 317ad8dab4a..650a2054cfb 100644
+--- src/gallium/targets/opencl/meson.build
++++ src/gallium/targets/opencl/meson.build
+@@ -51,6 +51,7 @@ libopencl = shared_library(
+     cpp.find_library('clangSema', dirs : llvm_libdir),
+     cpp.find_library('clangAnalysis', dirs : llvm_libdir),
+     cpp.find_library('clangAST', dirs : llvm_libdir),
++    cpp.find_library('clangASTMatchers', dirs : llvm_libdir),
+     cpp.find_library('clangEdit', dirs : llvm_libdir),
+     cpp.find_library('clangLex', dirs : llvm_libdir),
+     cpp.find_library('clangBasic', dirs : llvm_libdir),
diff --git a/srcpkgs/libGL/template b/srcpkgs/libGL/template
index 832417cc645..9fa3577dcbb 100644
--- a/srcpkgs/libGL/template
+++ b/srcpkgs/libGL/template
@@ -1,7 +1,7 @@
 # Template file for 'libGL'
 pkgname=libGL
 version=19.1.7
-revision=1
+revision=2
 wrksrc="mesa-${version}"
 build_style=meson
 configure_args="-Dshared-glapi=true -Dgbm=true -Degl=true

From dc7d9b451a5b5078a6b8748825b08dd26f2beeff Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:19:49 +0200
Subject: [PATCH 13/22] beignet: patch and unbreak + build for llvm-9.0.0

---
 srcpkgs/beignet/patches/llvm8.patch |  56 ++++++++++++++
 srcpkgs/beignet/patches/llvm9.patch | 111 ++++++++++++++++++++++++++++
 srcpkgs/beignet/template            |   3 +-
 3 files changed, 168 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/beignet/patches/llvm8.patch
 create mode 100644 srcpkgs/beignet/patches/llvm9.patch

diff --git a/srcpkgs/beignet/patches/llvm8.patch b/srcpkgs/beignet/patches/llvm8.patch
new file mode 100644
index 00000000000..15128d1a115
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm8.patch
@@ -0,0 +1,56 @@
+From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
+From: Jan Beich <jbeich@FreeBSD.org>
+Date: Wed, 30 Jan 2019 12:42:34 +0000
+Subject: [PATCH] lang/beignet: unbreak with llvm80
+
+Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
+
+unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
+ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
+
+Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
+
+backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
+      unknown type name 'TerminatorInst'
+    TerminatorInst *term = bb->getTerminator();
+    ^
+
+--- backend/src/CMakeLists.txt.orig	2017-09-22 08:05:22 UTC
++++ backend/src/CMakeLists.txt
+@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
+ endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
+ 
+ add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
++target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
+ 
+ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
+   find_library(TERMINFO NAMES tinfo ncurses)
+--- backend/src/llvm/llvm_gen_backend.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_gen_backend.cpp
+@@ -3073,14 +3073,22 @@ namespace gbe
+ 
+ 
+   static unsigned getChildNo(BasicBlock *bb) {
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     return term->getNumSuccessors();
+   }
+ 
+   // return NULL if index out-range of children number
+   static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
+ 
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     unsigned childNo = term->getNumSuccessors();
+     BasicBlock *child = NULL;
+     if(index < childNo) {
diff --git a/srcpkgs/beignet/patches/llvm9.patch b/srcpkgs/beignet/patches/llvm9.patch
new file mode 100644
index 00000000000..bff503800b0
--- /dev/null
+++ b/srcpkgs/beignet/patches/llvm9.patch
@@ -0,0 +1,111 @@
+Source: FreeBSD + q66
+
+Mostly FreeBSD other than FindLLVM.cmake changes.
+Linking against clang-cpp does not work for us.
+
+--- CMake/FindLLVM.cmake
++++ CMake/FindLLVM.cmake
+@@ -140,6 +140,7 @@ add_one_lib("clangStaticAnalyzerCore")
+ add_one_lib("clangAnalysis")
+ add_one_lib("clangEdit")
+ add_one_lib("clangAST")
++add_one_lib("clangASTMatchers")
+ add_one_lib("clangParse")
+ add_one_lib("clangSema")
+ add_one_lib("clangLex")
+--- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_intrinsic_lowering.cpp
+@@ -77,7 +77,11 @@ namespace gbe {
+         std::vector<Type *> ParamTys;
+         for (Value** I = ArgBegin; I != ArgEnd; ++I)
+           ParamTys.push_back((*I)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
++#else
+         Constant* FCache = M->getOrInsertFunction(NewFn,
++#endif
+                                         FunctionType::get(RetTy, ParamTys, false));
+ 
+         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
+--- backend/src/llvm/llvm_sampler_fix.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_sampler_fix.cpp
+@@ -82,7 +82,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+@@ -124,7 +128,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+--- backend/src/llvm/llvm_profiling.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_profiling.cpp
+@@ -163,10 +163,18 @@ namespace gbe
+       // __gen_ocl_store_timestamp(int nth, int type);
+       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++      builder->CreateCall(module->getOrInsertFunction(
++#else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
+               IntegerType::getInt32Ty(module->getContext()),
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              IntegerType::getInt32Ty(module->getContext())),
++#else
+               IntegerType::getInt32Ty(module->getContext()))),
++#endif
+               ArrayRef<Value*>(Args));
+ #else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+@@ -185,10 +193,18 @@ namespace gbe
+     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+ 
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++    builder->CreateCall(module->getOrInsertFunction(
++#else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+             ptrTy,
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++            IntegerType::getInt32Ty(module->getContext())),
++#else
+             IntegerType::getInt32Ty(module->getContext()))),
++#endif
+             ArrayRef<Value*>(Args2));
+ #else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+--- backend/src/llvm/llvm_device_enqueue.cpp.orig	2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_device_enqueue.cpp
+@@ -398,8 +398,13 @@ namespace gbe {
+               std::vector<Type *> ParamTys;
+               for (Value** iter = args.begin(); iter != args.end(); ++iter)
+                 ParamTys.push_back((*iter)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
++                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
++#else
+               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
++#endif
+               CI->replaceAllUsesWith(newCI);
+               deadInsnSet.insert(CI);
+             }
diff --git a/srcpkgs/beignet/template b/srcpkgs/beignet/template
index f56b3d1a0ae..eedb7aef1a7 100644
--- a/srcpkgs/beignet/template
+++ b/srcpkgs/beignet/template
@@ -1,7 +1,7 @@
 # Template file for 'beignet'
 pkgname=beignet
 version=1.3.2
-revision=4
+revision=5
 archs="i686* x86_64*"
 wrksrc="Beignet-${version}-Source"
 build_style=cmake
@@ -14,7 +14,6 @@ license="LGPL-2.1-or-later"
 homepage="http://www.freedesktop.org/wiki/Software/Beignet/"
 distfiles="https://01.org/sites/default/files/${pkgname}-${version}-source.tar.gz"
 checksum=c555edba149de23243965a703f39f79fa06f15bcff5a3762b5544b0925010b43
-broken="Doesn't build against libLLVM8; can't be built against libclang 8 and libLLVM7"
 
 post_install() {
 	# remove CL headers, we do use opencl-headers instead.

From 676c7d9578f924483fabb0b5f5f26cf083f51a35 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:36 +0200
Subject: [PATCH 14/22] libclc-git: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/libclc-git/template b/srcpkgs/libclc-git/template
index 20ee5f6b589..40c42db08ed 100644
--- a/srcpkgs/libclc-git/template
+++ b/srcpkgs/libclc-git/template
@@ -1,7 +1,7 @@
 # Template file for 'libclc-git'
 pkgname=libclc-git
 version=20181127
-revision=1
+revision=2
 _git_hash=1ecb16dd7d8b8e9151027faab996f27b2ac508e3
 wrksrc="libclc-${_git_hash}"
 build_style=configure

From 61d2f04c2fb234a0e86245e576d11b0e44f07ebd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:20:57 +0200
Subject: [PATCH 15/22] juCi++: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/juCi++/template b/srcpkgs/juCi++/template
index 7b4628be28d..dffd1d7119d 100644
--- a/srcpkgs/juCi++/template
+++ b/srcpkgs/juCi++/template
@@ -1,7 +1,7 @@
 # Template file for 'juCi++'
 pkgname=juCi++
 version=1.5.0
-revision=1
+revision=2
 _libclangmm_commit="687b9c231d850504ec515acb9ccab73f26c34063"
 _tiny_commit="a6773276efdbc322f1abb0159301f5502647eb52"
 wrksrc="jucipp-v${version}"

From 03859bf894d4a67adb11d0db05e9285bae7036e8 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:21:37 +0200
Subject: [PATCH 16/22] rtags: rebuild for clang-9.0.0

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

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

From 6a1f35e412ca4b7d5eb2e5fdba63f35cfd075206 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:02 +0200
Subject: [PATCH 17/22] bcc: rebuild for llvm-9.0.0

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

diff --git a/srcpkgs/bcc/template b/srcpkgs/bcc/template
index 807f1425c1d..9bb274fb468 100644
--- a/srcpkgs/bcc/template
+++ b/srcpkgs/bcc/template
@@ -1,7 +1,7 @@
 # Template file for 'bcc'
 pkgname=bcc
 version=0.10.0
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DREVISION=${version}"
 hostmakedepends="flex"

From a697a46a3df27b076fe1d989c8189a305dbf345e Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:22:36 +0200
Subject: [PATCH 18/22] ccls: rebuild for clang-9.0.0

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

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

From 1226e0b68a8dfcd94f69819fde576d2ce67be703 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:02 +0200
Subject: [PATCH 19/22] clazy: rebuild for clang-9.0.0

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

diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template
index 81f3176a363..5281f5f5507 100644
--- a/srcpkgs/clazy/template
+++ b/srcpkgs/clazy/template
@@ -1,7 +1,7 @@
 # Template file for 'clazy'
 pkgname=clazy
 version=1.5
-revision=2
+revision=3
 build_style=cmake
 hostmakedepends="python"
 makedepends="clang llvm"

From 9b5f4e54a0d465372491c088d277c8f910b1ae1c Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:16 +0200
Subject: [PATCH 20/22] include-what-you-use: rebuild for clang-9.0.0

---
 srcpkgs/include-what-you-use/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/include-what-you-use/template b/srcpkgs/include-what-you-use/template
index 5ebf9a70d2a..331c4441fa2 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.12
-revision=1
+revision=2
 wrksrc="${pkgname}"
 build_style=cmake
 configure_args="-DIWYU_LLVM_ROOT_PATH=${XBPS_CROSS_BASE}/usr "

From c9086781f4f9b72b7447cbb1657ee8cebc7149e7 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 23 Sep 2019 19:23:42 +0200
Subject: [PATCH 21/22] qtcreator: patch and rebuild for clang-9.0.0

[ci skip]
---
 srcpkgs/qtcreator/patches/clang9.patch | 11 +++++++++++
 srcpkgs/qtcreator/template             |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/qtcreator/patches/clang9.patch

diff --git a/srcpkgs/qtcreator/patches/clang9.patch b/srcpkgs/qtcreator/patches/clang9.patch
new file mode 100644
index 00000000000..25a1a861746
--- /dev/null
+++ b/srcpkgs/qtcreator/patches/clang9.patch
@@ -0,0 +1,11 @@
+--- src/plugins/clangformat/clangformatutils.cpp
++++ src/plugins/clangformat/clangformatutils.cpp
+@@ -60,7 +60,7 @@ static clang::format::FormatStyle qtcStyle()
+     style.AllowShortBlocksOnASingleLine = false;
+     style.AllowShortCaseLabelsOnASingleLine = false;
+     style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline;
+-    style.AllowShortIfStatementsOnASingleLine = false;
++    style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never;
+     style.AllowShortLoopsOnASingleLine = false;
+     style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None;
+     style.AlwaysBreakBeforeMultilineStrings = false;
diff --git a/srcpkgs/qtcreator/template b/srcpkgs/qtcreator/template
index 8240353ee61..efa09bbf07e 100644
--- a/srcpkgs/qtcreator/template
+++ b/srcpkgs/qtcreator/template
@@ -1,7 +1,7 @@
 # Template file for 'qtcreator'
 pkgname=qtcreator
 version=4.9.2
-revision=3
+revision=4
 wrksrc="qt-creator-opensource-src-${version}"
 build_style=qmake
 make_install_args="INSTALL_ROOT=\${DESTDIR}/usr"

From 1866e4235bd6ca2d9e68aaa6fdded1abe1a98569 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 24 Sep 2019 14:02:01 +0200
Subject: [PATCH 22/22] afl: update to 2.55b + clang 8/9 fix

[ci skip]
---
 srcpkgs/afl/template | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/afl/template b/srcpkgs/afl/template
index 9842510d59f..59d0f7325ef 100644
--- a/srcpkgs/afl/template
+++ b/srcpkgs/afl/template
@@ -1,7 +1,8 @@
 # Template file for 'afl'
 pkgname=afl
-version=2.52b
+version=2.55b
 revision=1
+wrksrc="AFL-${version}"
 build_style=gnu-makefile
 # x86 only currently
 archs="i686* x86_64*"
@@ -9,17 +10,17 @@ hostmakedepends="llvm clang"
 short_desc="American fuzzy lop - a brute-force fuzzer"
 maintainer="Orphaned <orphan@voidlinux.org>"
 license="Apache-2.0"
-homepage="http://lcamtuf.coredump.cx/afl/"
-distfiles="http://lcamtuf.coredump.cx/afl/releases/afl-${version}.tgz"
-checksum=43614b4b91c014d39ef086c5cc84ff5f068010c264c2c05bf199df60898ce045
+homepage="https://github.com/google/AFL/"
+distfiles="https://github.com/google/AFL/archive/v${version}.tar.gz"
+checksum=ca96fa6fac76f1ee104762cc9313be37a398f936f2b0e8a9f66e94244ae6babc
 
 nostrip_files="small_archive.a small_exec.elf"
 
 do_build() {
 	make PREFIX=/usr
 
-	CFLAGS="${CFLAGS} -fPIC" \
-	CXXFLAGS="${CXXFLAGS} -fPIC" \
+	CFLAGS="${CFLAGS//-fstack-clash-protection} -fPIC" \
+	CXXFLAGS="${CXXFLAGS//-fstack-clash-protection} -fPIC" \
 	LDFLAGS="${LDFLAGS} -pie" \
 	make PREFIX=/usr CC=clang CXX=clang++ -C llvm_mode
 }

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (46 preceding siblings ...)
  2019-09-25 20:52 ` voidlinux-github
@ 2019-09-25 20:53 ` voidlinux-github
  2019-09-26 17:41 ` llvm9 voidlinux-github
  2019-09-26 18:08 ` [PR PATCH] [Merged]: llvm9 voidlinux-github
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-25 20:53 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-535216302

Comment:
Beignet fixed. I think this makes all the packages

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

* Re: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (47 preceding siblings ...)
  2019-09-25 20:53 ` llvm9 voidlinux-github
@ 2019-09-26 17:41 ` voidlinux-github
  2019-09-26 18:08 ` [PR PATCH] [Merged]: llvm9 voidlinux-github
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-26 17:41 UTC (permalink / raw)
  To: ml

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

New comment by q66 on void-packages repository

https://github.com/void-linux/void-packages/pull/14656#issuecomment-535611913

Comment:
This is ready to land

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

* Re: [PR PATCH] [Merged]: llvm9
  2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
                   ` (48 preceding siblings ...)
  2019-09-26 17:41 ` llvm9 voidlinux-github
@ 2019-09-26 18:08 ` voidlinux-github
  49 siblings, 0 replies; 51+ messages in thread
From: voidlinux-github @ 2019-09-26 18:08 UTC (permalink / raw)
  To: ml

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

There's a merged pull request on the void-packages repository

llvm9
https://github.com/void-linux/void-packages/pull/14656

Description:
This adds llvm9, strips down llvm8 to a minimum (and updates it to 8.0.1), and bumps a bunch of other packages that should be bumped.

Platform testing:

- [x] x86_64 **[need help]**
- [x] x86_64-musl **[need help]**
- [x] i686 **[need help]**
- [x] ppc64le
- [x] ppc64le-musl
- [x] ppc64
- [x] ppc64-musl
- [x] ppc
- [x] ppc-musl
- [x] aarch64
- [x] aarch64-musl
- [x] armv7l **[need help]**
- [x] armv6l **[need help]**
- [x] armv7l-musl **[need help]**

To bump + test:

- [x] llvm
- [x] libcxxabi
- [x] libcxx
- [x] llvm-libunwind
- [x] libGL
- [x] beignet **[need help, x86 only]**
- [x] libclc-git
- [x] juCi++
- [x] kdevelop
- [x] rtags
- [x] bcc
- [x] ccls
- [x] clazy
- [x] include-what-you-use
- [x] shiboken2
- [x] codelite
- [x] gnome-builder
- [x] bpftrace
- [x] qtcreator
- [x] qt5 **[to be bumped by 5.13.1 update]**

rebuild but not bump (no target llvm/clang dependency):

- [x] ardour
- [x] afl **[need help, x86 only]**
- [x] blender
- [x] firefox
- [x] firefox-esr
- [x] icecat
- [x] thunderbird
- [x] chromium **[need help, won't build here]**
- [x] godot
- [x] ispc **[need help, x86 only]**
- [x] yosys
- [x]  rdedup
- [x]  pijul

Rust will need to be bumped but we'll do that as a part of the upcoming Rust update to avoid building twice.

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

end of thread, other threads:[~2019-09-26 18:08 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-22 22:50 [PR PATCH] llvm9 voidlinux-github
2019-09-22 23:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
2019-09-22 23:29 ` voidlinux-github
2019-09-22 23:40 ` llvm9 voidlinux-github
2019-09-22 23:52 ` llvm9 voidlinux-github
2019-09-23  0:34 ` [PR PATCH] [Updated] llvm9 voidlinux-github
2019-09-23  0:34 ` voidlinux-github
2019-09-23  0:35 ` llvm9 voidlinux-github
2019-09-23  1:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
2019-09-23  1:29 ` voidlinux-github
2019-09-23  2:34 ` voidlinux-github
2019-09-23  2:34 ` voidlinux-github
2019-09-23 15:54 ` voidlinux-github
2019-09-23 15:54 ` voidlinux-github
2019-09-23 15:56 ` llvm9 voidlinux-github
2019-09-23 20:19 ` [PR PATCH] [Updated] llvm9 voidlinux-github
2019-09-23 20:19 ` voidlinux-github
2019-09-23 20:51 ` voidlinux-github
2019-09-23 20:51 ` voidlinux-github
2019-09-23 22:17 ` voidlinux-github
2019-09-23 22:17 ` voidlinux-github
2019-09-24  1:14 ` voidlinux-github
2019-09-24  1:14 ` voidlinux-github
2019-09-24 11:34 ` llvm9 voidlinux-github
2019-09-24 11:34 ` llvm9 voidlinux-github
2019-09-24 11:35 ` llvm9 voidlinux-github
2019-09-24 11:37 ` llvm9 voidlinux-github
2019-09-24 11:38 ` llvm9 voidlinux-github
2019-09-24 11:43 ` llvm9 voidlinux-github
2019-09-24 11:46 ` llvm9 voidlinux-github
2019-09-24 12:02 ` [PR PATCH] [Updated] llvm9 voidlinux-github
2019-09-24 12:02 ` voidlinux-github
2019-09-24 12:03 ` llvm9 voidlinux-github
2019-09-24 12:10 ` llvm9 voidlinux-github
2019-09-24 12:11 ` llvm9 voidlinux-github
2019-09-24 12:44 ` llvm9 voidlinux-github
2019-09-24 12:53 ` llvm9 voidlinux-github
2019-09-24 12:58 ` llvm9 voidlinux-github
2019-09-24 13:10 ` llvm9 voidlinux-github
2019-09-24 14:01 ` llvm9 voidlinux-github
2019-09-24 16:52 ` [PR PATCH] [Updated] llvm9 voidlinux-github
2019-09-24 16:52 ` voidlinux-github
2019-09-24 18:46 ` llvm9 voidlinux-github
2019-09-25 20:29 ` [PR PATCH] [Updated] llvm9 voidlinux-github
2019-09-25 20:29 ` voidlinux-github
2019-09-25 20:31 ` llvm9 voidlinux-github
2019-09-25 20:52 ` [PR PATCH] [Updated] llvm9 voidlinux-github
2019-09-25 20:52 ` voidlinux-github
2019-09-25 20:53 ` llvm9 voidlinux-github
2019-09-26 17:41 ` llvm9 voidlinux-github
2019-09-26 18:08 ` [PR PATCH] [Merged]: llvm9 voidlinux-github

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).