summaryrefslogtreecommitdiff
path: root/sys-devel/llvm
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-10-07 11:03:14 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-10-07 11:03:14 +0100
commit957235cf19a691360c720f7913672adda4258ed0 (patch)
tree812bba7928f4293ead05a7ee9c1ac39c5ef9f12e /sys-devel/llvm
parent62f67115b5c46134c34f88f4b1cbdacc19384c0a (diff)
gentoo resync : 07.10.2018
Diffstat (limited to 'sys-devel/llvm')
-rw-r--r--sys-devel/llvm/Manifest3
-rw-r--r--sys-devel/llvm/files/7.0.0/0001-X86-Stop-X86DomainReassignment-from-creating-copies-.patch110
-rw-r--r--sys-devel/llvm/llvm-6.0.1-r2.ebuild270
-rw-r--r--sys-devel/llvm/llvm-7.0.0-r1.ebuild264
4 files changed, 647 insertions, 0 deletions
diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
index 0ac5c8e2441c..8b9c879401b2 100644
--- a/sys-devel/llvm/Manifest
+++ b/sys-devel/llvm/Manifest
@@ -2,6 +2,7 @@ AUX 4.0.1/0001-cmake-Pass-Wl-z-nodelete-on-Linux-to-prevent-unloadi.patch 2408 B
AUX 5.0.2/0001-Fix-return-type-in-ORC-readMem-client-interface.patch 1299 BLAKE2B 486ead622d4885f9e218a6fb44496ace574950e9946455050ffdde7bfac56c0893a5dc62fa6ffe6e8e18cdd706073454f8e1f2bc75a8ad98cf5246449ffe4df2 SHA512 3e17e72508242172c59547eaa2a8238bd145cfb888d4323818a943f075645b9bc5a272656e39f37d9f7997a16491b6a3a3b5c51101465369d8570a0d078cd335
AUX 6.0.1/0001-cmake-Append-Wl-rpath-link-conditionally-to-GNULD.patch 1575 BLAKE2B 3a650b244c2b97fa6e76327348a7bb00ace08b18441a59af238ccf0cdea4409e2d0b46c0a381737d7d0879dbc5eb0f71007fee0c9f0f5b92369453223d25397d SHA512 f09bf2b2bbac1f875f32f8761697717fbbfda2939fcccb8b03ecb8e4e65377c875355a3523d54f81c53d11bfaf3557f80000918bea003cfdba0662469283563a
AUX 6.0.1/0002-llvm-mc-Produce-R_X86_64_PLT32-for-call-jmp-foo.patch 13865 BLAKE2B 03f677e386115c3c7333db39664f75b2b4c22e18c2e487e515dc2a55acaa1bf569d2945ae620420b4b4323fb2e4fb7d3c3313dcc7e648942afa25d055d36efc7 SHA512 2820793ef29f08b55b7d94ef700085dce02c6a029c5877a77c5296e9a05dfc9946d10ee66d2d3d8a150cd511e3346d2acf259b873aeed25c1b0aaefebe95790d
+AUX 7.0.0/0001-X86-Stop-X86DomainReassignment-from-creating-copies-.patch 4263 BLAKE2B f0b073f90968b008ce758a43f00a4268dad1037f949704f3d86741319b6972d1ad69bed0944152f21b837486404948c1f290babc90a4da5ac0c300f0d2a868ee SHA512 efcb4b4bf0320304df680e6b69d8db1e732539e6cde0d9f11566e00533ecf8383d1520edca0a69c96e1722b33dcc8bc33da23470faf59774724cedc9f522d9b1
AUX 9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch 2626 BLAKE2B 6c3afe6941568119b6bbce1c66be913a29a2ac7853a881804c1c22e981075f1677ca7e4744738ad858f58a58c1a7295aeb5f1d87b3a2b2adfb971a54d76c04fb SHA512 34a84427c34fa8886f55e05cf0ffce258cdee8e98190e070eb40dc555a30784c49ebe4f946f7ea51b7d00fceb8071fc745007250dc5b5a61c4d2bb9910672ec5
AUX 9999/musl-fixes.patch 1258 BLAKE2B fe275412bc908884239ea71de9a9ddf1d2f64debaa1a9ada18170195a7775c41571600ed3666343bf967aff5f9117900f73155f60de5077bc4584cfc2f782f53 SHA512 314dcbe846a66312c9f1634f4ff3f4670b3db1d3210bb550f1d3877a423333ba042da2e90c8736918a36be4d4faf58dab8d3236d4f26df5af7f7f019b0e0ec8f
DIST cfe-3.4.2.src.tar.gz 10612313 BLAKE2B 6a5d9f20d181b217f3ca72b6585bd953150cc0d207a203feb24aa9cb9b2e341ac6a2e152a1c40baf2d53e5a52c4e4e86a518a329bdda39c08986b3437b04cee8 SHA512 e01fa8e312e9b3b7b3cb572ac21349161aaa50078ecfe7bded273b75db4a0c44acde524f8fdfcbeec54c61eeeb8339e9917d1f205a8fda18e34fe7ccbe89c36d
@@ -51,7 +52,9 @@ EBUILD llvm-3.9.1-r1.ebuild 16317 BLAKE2B a4edb45656ae073f618d899787a339b0c5e7f8
EBUILD llvm-4.0.1-r1.ebuild 6985 BLAKE2B e280f2ce69aeef46f6043c9ebb49205788045d796c294fe071d1776c63850ccb84378fa2bd7fc1f3023677672895dcd618073e6d3b67a95800dd247ceac6bdd5 SHA512 0a0c1f83f350cb8c86a39bcbc6b1678c12e3936369a3f24bae4b7aa5014896c09a45986e059f280eb5737a08c6d2dd1491fa6a11cf441d100c0a6506c2118410
EBUILD llvm-5.0.2.ebuild 7795 BLAKE2B d09a6cf50eb4da309e68ff7ac347da1ecea7c8f7f994cf7b69b5c98823d373a5e0e4023271a8b5b920d0eba79d5a70f865d2b4d50bf148731f93abf0991ed94d SHA512 3ce3fd983255ce1c1762c4e9186b06f26d4fc7cbf409709c9326b8ee6d9fab9e0a090560de3af87e544b4ae2ae631f55c76160de6a77109a0b02677345172ef1
EBUILD llvm-6.0.1-r1.ebuild 7997 BLAKE2B d25f6f3d2814b66db41936b808d72f625f432393619d1a7658fa959918244c00ba94f63b959f0e2feddd71b7b0f1f8fd6fa0549cedfb5a4d0962c5c3aeb52293 SHA512 e8228d1f4d63052f3b5c56f8d2d36ada7815aa1758ea0264e92eec341a87b64db97d682fdf55e4fa2da11f0caf4e349083c0040bbc7ed6eae71ea40e50c8a7b8
+EBUILD llvm-6.0.1-r2.ebuild 8169 BLAKE2B 214212c5960b9a2e6b8c2d1506ac4f59227ba31a6b52c310d7557a1523a09cf74d9ed0433e68d828419eddf1ea42e75588d6e8de694a0e0a469eca60317c7d98 SHA512 9db6c08277904689064bd492e9c5a63873ee6df9c34577a62f66aaebc110c071f63b7b1864e821e9ce2389f66b7a582d280deb3403ff3a890d3c47e1148f3cc2
EBUILD llvm-6.0.1.ebuild 7820 BLAKE2B 0077de543904f588bf856b4f279d1ced9a06bfe77da0e7149469ff960b4d0c7c1e557d92074c4c0570a7054a0b14d8663d2a502678884581fb35060f8bb0397f SHA512 b1fc081efff6cc0c77230058b261c5880fe57641544b21e03ff55ab993d64c00b4df1b12a5af5fa4b5f5528a1bb0c04a3f056be2aa8b528fbac29ec484e7f35b
+EBUILD llvm-7.0.0-r1.ebuild 7891 BLAKE2B e7739e453a169c9f15d11adc298e8c3bc3140bd2d1b2506a2be1338a8e7018c732e5ed2d320c15e55c7e1ae8c58d1ff7b0e6c7c9d54e941bae41e5d633bcb930 SHA512 1975529ea2dff95e5353367091153d04226525df77b50b4a065ed03dc12b257ab295fc543a975842a3cbb2891ad3bad537679b3b3a496174985cd09bb925522c
EBUILD llvm-7.0.0.ebuild 7719 BLAKE2B 31abb64164994fbddbf699efc8eaf27a6ae56d3bfe62c41d92df150f2522d2cfb45e0846d16577bc595bce6c6643b5db8b1ec7792a04b191fbb3f1481597af4f SHA512 76b0087874525dc4402a9c79aa35051af61d9cd59d01ed1d2f3488eff36aec972ad822c657aaa599012ec79be7952b2ad51722ad16ab8cc770c8b6b3db096aa9
EBUILD llvm-7.0.9999.ebuild 7406 BLAKE2B 19b08c7a3f6c7c6939764baa622bea7dea09362d281874ebcaa235563b60154c56b6e7e80bc87767442277192ed6a5d725a9694f872d6e2e449cb11c728157a5 SHA512 5e613af19834c142a45a688468587efb4f9198c1aefc9772048ed1775d27dbb9336c0f2f362433d7b1e6fc57151025083037dbbaed8ad407710b534df55f1e58
EBUILD llvm-9999.ebuild 8533 BLAKE2B b77410643fbcfc2bbc9884ee13c40fb7bb262c4935301d9e09e02743117c654c246783121c06aa7e241ba5964012b917dbfb90f527f98291f176ec0388db5fd2 SHA512 44006ca5a022656b53fcc006f3e8adbc5828e183a69b2952bb556c580ea92d755b01ffedc8a4736b22ded70df8d51df0dcb5b906211503aaef7a97e715295232
diff --git a/sys-devel/llvm/files/7.0.0/0001-X86-Stop-X86DomainReassignment-from-creating-copies-.patch b/sys-devel/llvm/files/7.0.0/0001-X86-Stop-X86DomainReassignment-from-creating-copies-.patch
new file mode 100644
index 000000000000..f38907cdd4c1
--- /dev/null
+++ b/sys-devel/llvm/files/7.0.0/0001-X86-Stop-X86DomainReassignment-from-creating-copies-.patch
@@ -0,0 +1,110 @@
+From 72da952b396f43d2ce6ca20a0f0d75212fea6b28 Mon Sep 17 00:00:00 2001
+From: Craig Topper <craig.topper@intel.com>
+Date: Mon, 1 Oct 2018 07:08:41 +0000
+Subject: [PATCH] [X86] Stop X86DomainReassignment from creating copies between
+ GR8/GR16 physical registers and k-registers.
+
+We can only copy between a k-register and a GR32/GR64 register.
+
+This patch detects that the copy will be illegal and prevents the domain reassignment from happening for that closure.
+
+This probably isn't the best fix, and we should probably figure out how to handle this correctly.
+
+Fixes PR38803.
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343443 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/Target/X86/X86DomainReassignment.cpp | 21 +++++++++++
+ test/CodeGen/X86/pr38803.ll | 48 ++++++++++++++++++++++++
+ 2 files changed, 69 insertions(+)
+ create mode 100644 test/CodeGen/X86/pr38803.ll
+
+diff --git a/lib/Target/X86/X86DomainReassignment.cpp b/lib/Target/X86/X86DomainReassignment.cpp
+index 5196446b39e..62588e9509d 100644
+--- a/lib/Target/X86/X86DomainReassignment.cpp
++++ b/lib/Target/X86/X86DomainReassignment.cpp
+@@ -217,6 +217,27 @@ public:
+ InstrCOPYReplacer(unsigned SrcOpcode, RegDomain DstDomain, unsigned DstOpcode)
+ : InstrReplacer(SrcOpcode, DstOpcode), DstDomain(DstDomain) {}
+
++ bool isLegal(const MachineInstr *MI,
++ const TargetInstrInfo *TII) const override {
++ if (!InstrConverterBase::isLegal(MI, TII))
++ return false;
++
++ // Don't allow copies to/flow GR8/GR16 physical registers.
++ // FIXME: Is there some better way to support this?
++ unsigned DstReg = MI->getOperand(0).getReg();
++ if (TargetRegisterInfo::isPhysicalRegister(DstReg) &&
++ (X86::GR8RegClass.contains(DstReg) ||
++ X86::GR16RegClass.contains(DstReg)))
++ return false;
++ unsigned SrcReg = MI->getOperand(1).getReg();
++ if (TargetRegisterInfo::isPhysicalRegister(SrcReg) &&
++ (X86::GR8RegClass.contains(SrcReg) ||
++ X86::GR16RegClass.contains(SrcReg)))
++ return false;
++
++ return true;
++ }
++
+ double getExtraCost(const MachineInstr *MI,
+ MachineRegisterInfo *MRI) const override {
+ assert(MI->getOpcode() == TargetOpcode::COPY && "Expected a COPY");
+diff --git a/test/CodeGen/X86/pr38803.ll b/test/CodeGen/X86/pr38803.ll
+new file mode 100644
+index 00000000000..a1ca27d89b0
+--- /dev/null
++++ b/test/CodeGen/X86/pr38803.ll
+@@ -0,0 +1,48 @@
++; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
++; RUN: llc < %s -mcpu=skylake-avx512 -mtriple=x86_64-unknown-unknown | FileCheck %s
++
++@b = local_unnamed_addr global i32 0, align 4
++@c = local_unnamed_addr global i32 0, align 4
++@d = local_unnamed_addr global float 0.000000e+00, align 4
++
++define float @_Z3fn2v() {
++; CHECK-LABEL: _Z3fn2v:
++; CHECK: # %bb.0: # %entry
++; CHECK-NEXT: pushq %rax
++; CHECK-NEXT: .cfi_def_cfa_offset 16
++; CHECK-NEXT: callq _Z1av
++; CHECK-NEXT: # kill: def $al killed $al def $eax
++; CHECK-NEXT: kmovd %eax, %k1
++; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
++; CHECK-NEXT: vmovss %xmm0, %xmm0, %xmm0 {%k1} {z}
++; CHECK-NEXT: cmpl $0, {{.*}}(%rip)
++; CHECK-NEXT: je .LBB0_2
++; CHECK-NEXT: # %bb.1: # %if.then
++; CHECK-NEXT: vcvtsi2ssl {{.*}}(%rip), %xmm1, %xmm1
++; CHECK-NEXT: kmovd %eax, %k1
++; CHECK-NEXT: vxorps %xmm2, %xmm2, %xmm2
++; CHECK-NEXT: vmovss %xmm2, %xmm0, %xmm1 {%k1}
++; CHECK-NEXT: vmovss %xmm1, {{.*}}(%rip)
++; CHECK-NEXT: .LBB0_2: # %if.end
++; CHECK-NEXT: popq %rax
++; CHECK-NEXT: .cfi_def_cfa_offset 8
++; CHECK-NEXT: retq
++entry:
++ %call = tail call zeroext i1 @_Z1av()
++ %cond = select i1 %call, float 7.500000e-01, float 0.000000e+00
++ %0 = load i32, i32* @c, align 4
++ %tobool2 = icmp eq i32 %0, 0
++ br i1 %tobool2, label %if.end, label %if.then
++
++if.then: ; preds = %entry
++ %1 = load i32, i32* @b, align 4
++ %2 = sitofp i32 %1 to float
++ %conv5 = select i1 %call, float 0.000000e+00, float %2
++ store float %conv5, float* @d, align 4
++ br label %if.end
++
++if.end: ; preds = %entry, %if.then
++ ret float %cond
++}
++
++declare zeroext i1 @_Z1av()
+--
+2.19.0
+
diff --git a/sys-devel/llvm/llvm-6.0.1-r2.ebuild b/sys-devel/llvm/llvm-6.0.1-r2.ebuild
new file mode 100644
index 000000000000..d20789791507
--- /dev/null
+++ b/sys-devel/llvm/llvm-6.0.1-r2.ebuild
@@ -0,0 +1,270 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+# (needed due to CMAKE_BUILD_TYPE != Gentoo)
+CMAKE_MIN_VERSION=3.7.0-r1
+PYTHON_COMPAT=( python2_7 )
+
+inherit cmake-utils eapi7-ver flag-o-matic multilib-minimal \
+ multiprocessing pax-utils python-any-r1 toolchain-funcs
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="https://llvm.org/"
+SRC_URI="https://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz
+ !doc? ( https://dev.gentoo.org/~mgorny/dist/llvm/${P}-manpages.tar.bz2 )"
+
+# Keep in sync with CMakeLists.txt
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
+ NVPTX PowerPC Sparc SystemZ X86 XCore )
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
+
+# Additional licenses:
+# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
+# 2. ARM backend: LLVM Software Grant by ARM.
+# 3. MD5 code: public-domain.
+# 4. Tests (not installed):
+# a. gtest: BSD.
+# b. YAML tests: MIT.
+
+LICENSE="UoI-NCSA rc BSD public-domain
+ llvm_targets_ARM? ( LLVM-Grant )"
+SLOT="$(ver_cut 1)"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-fbsd ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="debug doc gold libedit +libffi ncurses test xar xml
+ kernel_Darwin ${ALL_LLVM_TARGETS[*]}"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ sys-libs/zlib:0=
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )
+ xar? ( app-arch/xar )
+ xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${RDEPEND}
+ dev-lang/perl
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ kernel_Darwin? (
+ <sys-libs/libcxx-$(ver_cut 1-3).9999
+ >=sys-devel/binutils-apple-5.1
+ )
+ doc? ( dev-python/sphinx )
+ gold? ( sys-libs/binutils-libs )
+ libffi? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ${PYTHON_DEPS}"
+# There are no file collisions between these versions but having :0
+# installed means llvm-config there will take precedence.
+RDEPEND="${RDEPEND}
+ !sys-devel/llvm:0"
+PDEPEND="sys-devel/llvm-common
+ gold? ( >=sys-devel/llvmgold-${SLOT} )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ || ( ${ALL_LLVM_TARGETS[*]} )"
+
+S=${WORKDIR}/${P/_/}.src
+
+# least intrusive of all
+CMAKE_BUILD_TYPE=RelWithDebInfo
+
+src_prepare() {
+ # Fix llvm-config for shared linking and sane flags
+ # https://bugs.gentoo.org/show_bug.cgi?id=565358
+ eapply "${FILESDIR}"/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch
+
+ # Fix appending -Wl,-rpath-link on non-Linux (-> FreeBSD).
+ eapply "${FILESDIR}"/6.0.1/0001-cmake-Append-Wl-rpath-link-conditionally-to-GNULD.patch
+
+ # Fix assembly compatibility with binutils-2.31.1
+ # https://bugs.gentoo.org/663442
+ eapply "${FILESDIR}"/6.0.1/0002-llvm-mc-Produce-R_X86_64_PLT32-for-call-jmp-foo.patch
+
+ # Fix x86 codegen bug triggered by Chromium
+ # https://bugs.gentoo.org/664868
+ eapply "${FILESDIR}"/7.0.0/0001-X86-Stop-X86DomainReassignment-from-creating-copies-.patch
+
+ # disable use of SDK on OSX, bug #568758
+ sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
+
+ # User patches + QA
+ cmake-utils_src_prepare
+}
+
+multilib_src_configure() {
+ local ffi_cflags ffi_ldflags
+ if use libffi; then
+ ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
+ ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
+ fi
+
+ local libdir=$(get_libdir)
+ local mycmakeargs=(
+ # disable appending VCS revision to the version to improve
+ # direct cache hit ratio
+ -DLLVM_APPEND_VC_REV=OFF
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}"
+ -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+
+ -DBUILD_SHARED_LIBS=ON
+ -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
+ -DLLVM_BUILD_TESTS=$(usex test)
+
+ -DLLVM_ENABLE_FFI=$(usex libffi)
+ -DLLVM_ENABLE_LIBEDIT=$(usex libedit)
+ -DLLVM_ENABLE_TERMINFO=$(usex ncurses)
+ -DLLVM_ENABLE_LIBXML2=$(usex xml)
+ -DLLVM_ENABLE_ASSERTIONS=$(usex debug)
+ -DLLVM_ENABLE_EH=ON
+ -DLLVM_ENABLE_RTTI=ON
+
+ -DWITH_POLLY=OFF # TODO
+
+ -DLLVM_HOST_TRIPLE="${CHOST}"
+
+ -DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
+ -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+ # used only for llvm-objdump tool
+ -DHAVE_LIBXAR=$(multilib_native_usex xar 1 0)
+
+ # disable OCaml bindings (now in dev-ml/llvm-ocaml)
+ -DOCAMLFIND=NO
+ )
+
+# Note: go bindings have no CMake rules at the moment
+# but let's kill the check in case they are introduced
+# if ! multilib_is_native_abi || ! use go; then
+ mycmakeargs+=(
+ -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND
+ )
+# fi
+
+ use test && mycmakeargs+=(
+ -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
+ )
+
+ if multilib_is_native_abi; then
+ mycmakeargs+=(
+ -DLLVM_BUILD_DOCS=$(usex doc)
+ -DLLVM_ENABLE_OCAMLDOC=OFF
+ -DLLVM_ENABLE_SPHINX=$(usex doc)
+ -DLLVM_ENABLE_DOXYGEN=OFF
+ -DLLVM_INSTALL_UTILS=ON
+ )
+ use doc && mycmakeargs+=(
+ -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
+ -DLLVM_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html"
+ -DSPHINX_WARNINGS_AS_ERRORS=OFF
+ )
+ use gold && mycmakeargs+=(
+ -DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include
+ )
+ fi
+
+ if tc-is-cross-compiler; then
+ local tblgen="${EPREFIX}/usr/lib/llvm/${SLOT}/bin/llvm-tblgen"
+ [[ -x "${tblgen}" ]] \
+ || die "${tblgen} not found or usable"
+ mycmakeargs+=(
+ -DCMAKE_CROSSCOMPILING=ON
+ -DLLVM_TABLEGEN="${tblgen}"
+ )
+ fi
+
+ # workaround BMI bug in gcc-7 (fixed in 7.4)
+ # https://bugs.gentoo.org/649880
+ # apply only to x86, https://bugs.gentoo.org/650506
+ if tc-is-gcc && [[ ${MULTILIB_ABI_FLAG} == abi_x86* ]] &&
+ [[ $(gcc-major-version) -eq 7 && $(gcc-minor-version) -lt 4 ]]
+ then
+ local CFLAGS="${CFLAGS} -mno-bmi"
+ local CXXFLAGS="${CXXFLAGS} -mno-bmi"
+ fi
+
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+ cmake-utils_src_configure
+}
+
+multilib_src_compile() {
+ cmake-utils_src_compile
+
+ pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
+ pax-mark m "${BUILD_DIR}"/bin/lli
+ pax-mark m "${BUILD_DIR}"/bin/lli-child-target
+
+ if use test; then
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests
+ pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests
+ fi
+}
+
+multilib_src_test() {
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ cmake-utils_src_make check
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/lib/llvm/${SLOT}/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ local LLVM_LDPATHS=()
+ multilib-minimal_src_install
+
+ # move wrapped headers back
+ mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT}/include || die
+}
+
+multilib_src_install() {
+ cmake-utils_src_install
+
+ # move headers to /usr/include for wrapping
+ rm -rf "${ED%/}"/usr/include || die
+ mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die
+
+ LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" )
+}
+
+multilib_src_install_all() {
+ local revord=$(( 9999 - ${SLOT} ))
+ cat <<-_EOF_ > "${T}/10llvm-${revord}" || die
+ PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin"
+ # we need to duplicate it in ROOTPATH for Portage to respect...
+ ROOTPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin"
+ MANPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
+ LDPATH="$( IFS=:; echo "${LLVM_LDPATHS[*]}" )"
+_EOF_
+ doenvd "${T}/10llvm-${revord}"
+
+ # install pre-generated manpages
+ if ! use doc; then
+ # (doman does not support custom paths)
+ insinto "/usr/lib/llvm/${SLOT}/share/man/man1"
+ doins "${WORKDIR}/${P}-manpages/llvm"/*.1
+ fi
+
+ docompress "/usr/lib/llvm/${SLOT}/share/man"
+}
+
+pkg_postinst() {
+ elog "You can find additional opt-viewer utility scripts in:"
+ elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/opt-viewer"
+ elog "To use these scripts, you will need Python 2.7 along with the following"
+ elog "packages:"
+ elog " dev-python/pygments (for opt-viewer)"
+ elog " dev-python/pyyaml (for all of them)"
+}
diff --git a/sys-devel/llvm/llvm-7.0.0-r1.ebuild b/sys-devel/llvm/llvm-7.0.0-r1.ebuild
new file mode 100644
index 000000000000..49fdc4c05a6c
--- /dev/null
+++ b/sys-devel/llvm/llvm-7.0.0-r1.ebuild
@@ -0,0 +1,264 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+# (needed due to CMAKE_BUILD_TYPE != Gentoo)
+CMAKE_MIN_VERSION=3.7.0-r1
+PYTHON_COMPAT=( python2_7 )
+
+inherit cmake-utils eapi7-ver flag-o-matic multilib-minimal \
+ multiprocessing pax-utils python-any-r1 toolchain-funcs
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="https://llvm.org/"
+SRC_URI="https://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz
+ !doc? ( https://dev.gentoo.org/~mgorny/dist/llvm/${P}-manpages.tar.bz2 )"
+
+# Keep in sync with CMakeLists.txt
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430
+ NVPTX PowerPC Sparc SystemZ X86 XCore )
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" )
+
+# Additional licenses:
+# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
+# 2. ARM backend: LLVM Software Grant by ARM.
+# 3. MD5 code: public-domain.
+# 4. Tests (not installed):
+# a. gtest: BSD.
+# b. YAML tests: MIT.
+
+LICENSE="UoI-NCSA rc BSD public-domain
+ llvm_targets_ARM? ( LLVM-Grant )"
+SLOT="$(ver_cut 1)"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-fbsd ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="debug doc exegesis gold libedit +libffi ncurses test xar xml
+ kernel_Darwin ${ALL_LLVM_TARGETS[*]}"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ sys-libs/zlib:0=
+ exegesis? ( dev-libs/libpfm:= )
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )
+ xar? ( app-arch/xar )
+ xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${RDEPEND}
+ dev-lang/perl
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+ )
+ kernel_Darwin? (
+ <sys-libs/libcxx-$(ver_cut 1-3).9999
+ >=sys-devel/binutils-apple-5.1
+ )
+ doc? ( dev-python/sphinx )
+ gold? ( sys-libs/binutils-libs )
+ libffi? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ${PYTHON_DEPS}"
+# There are no file collisions between these versions but having :0
+# installed means llvm-config there will take precedence.
+RDEPEND="${RDEPEND}
+ !sys-devel/llvm:0"
+PDEPEND="sys-devel/llvm-common
+ gold? ( >=sys-devel/llvmgold-${SLOT} )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ || ( ${ALL_LLVM_TARGETS[*]} )"
+
+S=${WORKDIR}/${P/_/}.src
+
+# least intrusive of all
+CMAKE_BUILD_TYPE=RelWithDebInfo
+
+src_prepare() {
+ # Fix llvm-config for shared linking and sane flags
+ # https://bugs.gentoo.org/show_bug.cgi?id=565358
+ eapply "${FILESDIR}"/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch
+
+ # Fix x86 codegen bug triggered by Chromium
+ # https://bugs.gentoo.org/664868
+ eapply "${FILESDIR}"/7.0.0/0001-X86-Stop-X86DomainReassignment-from-creating-copies-.patch
+
+ # disable use of SDK on OSX, bug #568758
+ sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
+
+ # User patches + QA
+ cmake-utils_src_prepare
+}
+
+multilib_src_configure() {
+ local ffi_cflags ffi_ldflags
+ if use libffi; then
+ ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi)
+ ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi)
+ fi
+
+ local libdir=$(get_libdir)
+ local mycmakeargs=(
+ # disable appending VCS revision to the version to improve
+ # direct cache hit ratio
+ -DLLVM_APPEND_VC_REV=OFF
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}"
+ -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+
+ -DBUILD_SHARED_LIBS=ON
+ -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
+ -DLLVM_BUILD_TESTS=$(usex test)
+
+ -DLLVM_ENABLE_FFI=$(usex libffi)
+ -DLLVM_ENABLE_LIBEDIT=$(usex libedit)
+ -DLLVM_ENABLE_TERMINFO=$(usex ncurses)
+ -DLLVM_ENABLE_LIBXML2=$(usex xml)
+ -DLLVM_ENABLE_ASSERTIONS=$(usex debug)
+ -DLLVM_ENABLE_LIBPFM=$(usex exegesis)
+ -DLLVM_ENABLE_EH=ON
+ -DLLVM_ENABLE_RTTI=ON
+
+ -DWITH_POLLY=OFF # TODO
+
+ -DLLVM_HOST_TRIPLE="${CHOST}"
+
+ -DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
+ -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+ # used only for llvm-objdump tool
+ -DHAVE_LIBXAR=$(multilib_native_usex xar 1 0)
+
+ # disable OCaml bindings (now in dev-ml/llvm-ocaml)
+ -DOCAMLFIND=NO
+ )
+
+# Note: go bindings have no CMake rules at the moment
+# but let's kill the check in case they are introduced
+# if ! multilib_is_native_abi || ! use go; then
+ mycmakeargs+=(
+ -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND
+ )
+# fi
+
+ use test && mycmakeargs+=(
+ -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
+ )
+
+ if multilib_is_native_abi; then
+ mycmakeargs+=(
+ -DLLVM_BUILD_DOCS=$(usex doc)
+ -DLLVM_ENABLE_OCAMLDOC=OFF
+ -DLLVM_ENABLE_SPHINX=$(usex doc)
+ -DLLVM_ENABLE_DOXYGEN=OFF
+ -DLLVM_INSTALL_UTILS=ON
+ )
+ use doc && mycmakeargs+=(
+ -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
+ -DLLVM_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html"
+ -DSPHINX_WARNINGS_AS_ERRORS=OFF
+ )
+ use gold && mycmakeargs+=(
+ -DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include
+ )
+ fi
+
+ if tc-is-cross-compiler; then
+ local tblgen="${EPREFIX}/usr/lib/llvm/${SLOT}/bin/llvm-tblgen"
+ [[ -x "${tblgen}" ]] \
+ || die "${tblgen} not found or usable"
+ mycmakeargs+=(
+ -DCMAKE_CROSSCOMPILING=ON
+ -DLLVM_TABLEGEN="${tblgen}"
+ )
+ fi
+
+ # workaround BMI bug in gcc-7 (fixed in 7.4)
+ # https://bugs.gentoo.org/649880
+ # apply only to x86, https://bugs.gentoo.org/650506
+ if tc-is-gcc && [[ ${MULTILIB_ABI_FLAG} == abi_x86* ]] &&
+ [[ $(gcc-major-version) -eq 7 && $(gcc-minor-version) -lt 4 ]]
+ then
+ local CFLAGS="${CFLAGS} -mno-bmi"
+ local CXXFLAGS="${CXXFLAGS} -mno-bmi"
+ fi
+
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+ cmake-utils_src_configure
+}
+
+multilib_src_compile() {
+ cmake-utils_src_compile
+
+ pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld
+ pax-mark m "${BUILD_DIR}"/bin/lli
+ pax-mark m "${BUILD_DIR}"/bin/lli-child-target
+
+ if use test; then
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests
+ pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests
+ fi
+}
+
+multilib_src_test() {
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ cmake-utils_src_make check
+}
+
+src_install() {
+ local MULTILIB_CHOST_TOOLS=(
+ /usr/lib/llvm/${SLOT}/bin/llvm-config
+ )
+
+ local MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/llvm/Config/llvm-config.h
+ )
+
+ local LLVM_LDPATHS=()
+ multilib-minimal_src_install
+
+ # move wrapped headers back
+ mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT}/include || die
+}
+
+multilib_src_install() {
+ cmake-utils_src_install
+
+ # move headers to /usr/include for wrapping
+ rm -rf "${ED%/}"/usr/include || die
+ mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die
+
+ LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" )
+}
+
+multilib_src_install_all() {
+ local revord=$(( 9999 - ${SLOT} ))
+ newenvd - "10llvm-${revord}" <<-_EOF_
+ PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin"
+ # we need to duplicate it in ROOTPATH for Portage to respect...
+ ROOTPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin"
+ MANPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
+ LDPATH="$( IFS=:; echo "${LLVM_LDPATHS[*]}" )"
+ _EOF_
+
+ # install pre-generated manpages
+ if ! use doc; then
+ # (doman does not support custom paths)
+ insinto "/usr/lib/llvm/${SLOT}/share/man/man1"
+ doins "${WORKDIR}/${P}-manpages/llvm"/*.1
+ fi
+
+ docompress "/usr/lib/llvm/${SLOT}/share/man"
+}
+
+pkg_postinst() {
+ elog "You can find additional opt-viewer utility scripts in:"
+ elog " ${EROOT%/}/usr/lib/llvm/${SLOT}/share/opt-viewer"
+ elog "To use these scripts, you will need Python 2.7 along with the following"
+ elog "packages:"
+ elog " dev-python/pygments (for opt-viewer)"
+ elog " dev-python/pyyaml (for all of them)"
+}