summaryrefslogtreecommitdiff
path: root/sys-devel/clang
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/clang')
-rw-r--r--sys-devel/clang/Manifest15
-rw-r--r--sys-devel/clang/clang-10.0.0.9999.ebuild2
-rw-r--r--sys-devel/clang/clang-5.0.2.ebuild323
-rw-r--r--sys-devel/clang/clang-8.0.1.ebuild2
-rw-r--r--sys-devel/clang/clang-9.0.0.9999.ebuild8
-rw-r--r--sys-devel/clang/files/5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch136
-rw-r--r--sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch76
-rw-r--r--sys-devel/clang/files/5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch37
-rw-r--r--sys-devel/clang/files/9.0.0/0001-clang-unittest-Import-LLVMTestingSupport-if-necessar.patch39
9 files changed, 588 insertions, 50 deletions
diff --git a/sys-devel/clang/Manifest b/sys-devel/clang/Manifest
index 61b1303b6fef..78e593a6d502 100644
--- a/sys-devel/clang/Manifest
+++ b/sys-devel/clang/Manifest
@@ -1,15 +1,21 @@
+AUX 5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch 6888 BLAKE2B e6d9907b05f99fb21008e7533f348348a3fe81249e6bcd0c473b82ba2dbb3651f7c27ba8c84053eb9c5832de1df4de7632971fc48d47aa9fff673f76e5688263 SHA512 6d1f35f39c15b11ce631477eefcca7ade90cb08e5992839273f97c339ef6bf0deecf9625fdacbad6e8cc61e4fd213e0e1c582c407ac051d99545962e310344fe
+AUX 5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch 2846 BLAKE2B a5d3081767621f774b4c873611506a6ab9518acbab48839e142dc920b2059ac32258ffa0d9c04a6d8450d355680e98a62b406ac876785f9241ee4111f472b86d SHA512 c714adfa4bb62f89be07216a0e2601ba9729791228a42020d5069e821c629077df4581f82236c3dfb5dbcfb54ff124e7b4f1241512a03ae8e3f7ac40b27acd7d
+AUX 5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch 1376 BLAKE2B baa36d2b05118859ffc5af12e9b5a8ed0dac3c262736ef2bab5f89049267dca5a94e134b078c06f09cafcc678fb8adefcf84f940806b594777a1f05a1e216a80 SHA512 f4e31053c03429528fc193a4550784b21d60fa0487700c1f416952c5d92b71988ca481b53c00f95f0c8c39f5f30e9ddd5cc6bee5334294fd3e4df24b8a450e69
AUX 6.0.1/0002-test-Fix-Cross-DSO-CFI-Android-sanitizer-test-for-rt.patch 1256 BLAKE2B e71f32b08defa1ba59b574e9314e272107638676f1b1469a448efced144c680ffde4d76e34fa3fa5786859bf6e04050bd23150d7c0b98f8849f5d9355eacb646 SHA512 260096c1c7e6ba6f35537873cb6ba83f2271cb50446c50f6f1a5c88138c23508df16c99cac8664b5be0d56f2e0fe288f51a27424ff0b56c317d7a7e07562e0fc
AUX 6.0.1/darwin_prefix-include-paths.patch 690 BLAKE2B cfb96eb259fb7d557d215be08ea3babcae6dc1353171fad7f297f787d476d28768c7c1bbe6efc7404ea638f1dc6b4b36e1c17e141faf82be623bbd96d5e09118 SHA512 5f8ecabaf43853964bffeb3953b205bea7e8928fd53637d01842723ac8344e19cc639f6f06c199f2be88b73e60b6eab1987bc5ee7dfeaea5e710eacab90f3533
AUX 7.0.1/0001-clangd-Fix-detecting-atomics-in-stand-alone-builds.patch 1244 BLAKE2B 0a5f0b4af299ae49b13eac0e6ff06ce84264baf05bc09437b481830d4cfafab68ec2a3adf5814fcd8efbe91770e2dda0ce5fa5e10fcefc10d6fbe2c17ca067b6 SHA512 cec3d531b7d6121f7fc5da731d7d89d03a7d1a38e32abd5d7812790ffa62e6d3b9f18084983702203502905d447ad89bd4e2a7f3ca51ee7d696ebe623b035ac6
-AUX 9.0.0/0001-clang-unittest-Import-LLVMTestingSupport-if-necessar.patch 1324 BLAKE2B 83a02461f65f2fc660e2ad0a07ec0d75c56da04e7ad849bdb80aeec9200b2cdbfd5f283710294bfa0f4abf26bfa24da2961ac9decd9d50d9d51fbb148fc5d573 SHA512 03669ad470bd85237673c217aea0deca6080d374e2b31531c17da6594959c323dde7e187fcc3ba6ae387b03a9252d89d75caafb8ef715b49b9ba9f2cdd5c242d
+DIST cfe-5.0.2.src.tar.xz 11459216 BLAKE2B 80d9b2ab70b00c0dfd5c5386a44e0c15d8252e6175c9da55a0519c4f9b8192e32e215110d7d3808225786e2c7f906f2dfbe11dd09bdf21574e99709ae237ed0b SHA512 9931afceb5569ad6caec85d506180c810f7fea94af8c997143b0a37cbf413fcea0d92520478610627eeee1efb65fde684066ace0dfcbbf7b61ecd709d22dd0b1
DIST cfe-6.0.1.src.tar.xz 11905772 BLAKE2B abb60e9f9827d1d8a24f0aaf8a1d1e32979293cc401258d230f93290e633645747fd0344af189ac7081b06be2cada503364e1e432b37110ade4b3578e40c7605 SHA512 f64ba9290059f6e36fee41c8f32bf483609d31c291fcd2f77d41fecfdf3c8233a5e23b93a1c73fed03683823bd6e72757ed993dd32527de3d5f2b7a64bb031b9
DIST cfe-7.1.0.src.tar.xz 12487872 BLAKE2B ca6ec9e45b94823de1dabf9e68f0c97cdd40b5d2a5e5e15d4b2393f6d7fbdee72a541b957cc22ce4cb726d8ee7190228320941d5713aeb59695673b9e9070ceb SHA512 1cd0b80f32aa4de1118c0c676ba96b1fc78b7ff929b01b6589dfe9b4669e599ac8cfb8f5a0abcd3487594193a7dec06b29530ec3fc03042c20a160f0477a79fd
DIST cfe-8.0.0.src.tar.xz 12868468 BLAKE2B 3cb96c95c4d9713feb7011e4f1ca24be3e7f6c9b458f6cd9e6905f99737312ca44cb701ed5871e47dd583145e5898d53a65c4cda6456af3d4ca31b670ed84409 SHA512 98e540222719716985e5d8439116e47469cb01201ea91d1da7e46cb6633da099688d9352c3b65e5c5f660cbbae353b3d79bb803fc66b3be663f2b04b1feed1c3
DIST cfe-8.0.1.src.tar.xz 12810056 BLAKE2B 88cee0b6daa477ca0473c76efc45beb634f6194ecd3f45aaec3791e26b203c5dbd33c649435e0d97924096a72c727d76915bffc0b7ea305f24d5e5f06389c4a0 SHA512 1227b2d32052c70b4b494659849000188fce46fc31a71f3352ba8457ac0b0b17e4bc7c8589874c8586d55aa808ee6c1fceb7df501aafa33599f8df7bfd2b791d
+DIST clang-tools-extra-5.0.2.src.tar.xz 646272 BLAKE2B 8a15a0c3ed9e8c31706d744017aa8be52616037790075c2314c3a613c9e1aa86b0b980c4e3bd9a775b234440f17436392196b41f1691ab25a33b432a25affb68 SHA512 241d85652e7c3ad5d77754ad9a694bddab3c14098067da4119223007c5a4a765d1cd7e7c7dba91666ccd5506f8703c82c9ee487f28249a00c2c4edbd0d1f2640
DIST clang-tools-extra-6.0.1.src.tar.xz 757256 BLAKE2B 1d91d7459a34e7251007af91db1803ee6d04f1ef3e0fcf134a7e0d1d3456b094a80339ee60db3f0bdd12961f3a05caee7edfc5c6b9c48d49cd55a5dc3c102c3a SHA512 cf29d117b6dabcb7a8e5f6dab5016ce5a5c8f475679001a43fd5c935f2c368f37cdef50aae2080a1e4524f647f6d83458d4a5dec5b45d03fb374f463caf7c3f5
DIST clang-tools-extra-7.1.0.src.tar.xz 901328 BLAKE2B 20865cf188cf08e4eae969d1083d9d69f57159c3dceb71e3e00a3f4dd96814b99e25fe633eb46801923d64cc9f884da24a417c21af71f0b3535bda0cce7d73da SHA512 8c22136324808b42601915e8163e06a90db078693f9e12369050bca6bab8cb971efaddcda82c5abf08e67ba7a5be1ac32e1bef0aff29a1b433e80eca8eba3e7b
DIST clang-tools-extra-8.0.0.src.tar.xz 1996156 BLAKE2B 26c839669ce4cf531a56e8527c9d507ce458861c00aaf563fa5e58cfa2fa3897d820643746802198c8e77c9e46fc8f4b833fc3746b32d8adc0d4a09dbe3ace7c SHA512 434e4cb7b76f89b0a0af25f05f32f2f2e8edb9e9f14547be845df75f5032c1d9dbf475be408bb989c476ec667c10af54a15d40e42559b05e52d24c5fd416b517
DIST clang-tools-extra-8.0.1.src.tar.xz 1994068 BLAKE2B 7d312c1a958d9c5b24515067cbb1db3a92b34cdf77c2345c08ef2f327d2ae4ca7f05252d72ede6569e25cda34225963a8d415cc64279e39d542449ba56eae9c9 SHA512 d39962c30ee9d8a1679d8007009b48dea2c8aaeb283bed781a9e22a1a57b8186c2cfe058da046658882ace1c84a30ddf9b4cb75bce988891189e8423b6c6a72c
+DIST llvm-5.0.2-manpages.tar.bz2 93977 BLAKE2B 8c5e8899e0df9d6037fb7d5c373de6492ccdc9fd2c26cc7dfbd8fb2b9e68418ca8fdf42cdc303c361e649cc6939bf5229cbad017bdccbd5d791e92752328252f SHA512 568615bce5a75d42e4b6d592557472d366d49a99f8e81be10ae679804f1fe674c7fd0bbdac09af44fc67ee5aa34c4ed2153c2767c536ac8e45dd15c811c92dcb
+DIST llvm-5.0.2.src.tar.xz 23451868 BLAKE2B b7082be2e4ad557b29b9f6869811f262adcf5c73d552faf91b339bede75cf5eab58afefa12fa779a38be71fe2b8f4ea297c3213ee4e8370cc01972c59249d91c SHA512 3588be5ed969c3f7f6f16f56a12a6af2814d3d3c960d4a36ffebb0446cc75f19220bccee7fc605f9b01f5d5c188a905a046193cc12dec42dd5922048b5c27fe1
DIST llvm-6.0.1-manpages.tar.bz2 102656 BLAKE2B 9088ca0bdda69f63354e61b7495df54505d5db2504bc61860a7260343722ec8cdd5e937d0843263a5bf5077b9cf386c337fa127039b996bab10d2ca5c2caeb59 SHA512 c468e97a2d5610aee9e72cb795e4e65375a079d733550f05380230fb44ba0ed67d407ad06e2340b66f13d19c06583b657e8d01fcdca2146ae43964cea309e0b3
DIST llvm-6.0.1.src.tar.xz 25306628 BLAKE2B 60232d4d22f8096b565cc8d81fea0639f24f14e8fc4f66ade69fa15479181f07f655f26dff3fa24bf105762b495da316c5c9352db234bd0af6b9c3fff6d4d881 SHA512 cbbb00eb99cfeb4aff623ee1a5ba075e7b5a76fc00c5f9f539ff28c108598f5708a0369d5bd92683def5a20c2fe60cab7827b42d628dbfcc79b57e0e91b84dd9
DIST llvm-7.1.0-manpages.tar.bz2 120786 BLAKE2B b52a7afe7c5c170894e910ef2c651a5f38f0bd41147a2c63dc5b8a92f0ec37512e913e68efce51e1643e8f20cf0f3f088d31d19c541d2ff361ecb7d89b234b6c SHA512 78a526d889a8e62accf422655acbb4d17e3c22b0f0830003db0068b3c01c367ac32ce4f4be4cbb2966274440865557c25795205af2a59a054a6f6964294d289f
@@ -18,10 +24,11 @@ DIST llvm-8.0.0-manpages.tar.bz2 140542 BLAKE2B e6c58865ace0b8848ffe825e931a639d
DIST llvm-8.0.0.src.tar.xz 30503732 BLAKE2B d89bdeb0ec7d885e49cfe5ae025da84f00502d409710c0807a3cdd58dbd47c50cf6a635593569483150f7f2ecb0de0310bd6785cb7625219bf9f6224a0d68e1c SHA512 1602343b451b964f5d8c2d6b0654d89384c80d45883498c5f0e2f4196168dd4a1ed2a4dadb752076020243df42ffe46cb31d82ffc145d8e5874163cbb9686a1f
DIST llvm-8.0.1-manpages.tar.bz2 140915 BLAKE2B 13ac9e172728d643dac1d12ac06909b6db3dd9a1a380a92a07867e3cb835f94b265da5d75c4712b5409405a65795d2cb6b32da4098e38cbb95d7023b56bcbbc1 SHA512 23994a2374659fbbf8d9b5160f4d77e9be7c4c9fc14963e8186bbede78b0ee9257f6b6a9c484bc75d72443d65bb24e598841e64af500336283de0f454d6a2073
DIST llvm-8.0.1.src.tar.xz 30477608 BLAKE2B 4319c837b36111401e3b0f9659b8d875c89463bcc7816df1aefe1e3ff989860bbaa92504718f8e15416cfd9f3491c13777cd5cb661877b237b342b0e515b93f5 SHA512 82e120be5cabdfd5111aebbea68a663fe229c8861d73802d6ab09a3bf48f60de333e07e61f8fb61beaa14ac2bea24fcd74fa6f761acaf62469f536b79fcb1e16
-EBUILD clang-10.0.0.9999.ebuild 9234 BLAKE2B 1249c11cdc4b4ca21cc3e2e82c30dc081125a8800b908807209db4f886e08873b25053ff4cc47b8314ae17ac25e5b8f831ecb724bc90038071cd19b9964e41f3 SHA512 d4c9fe45b4c37f3c192f975231d5f79fa86a186d5182af79d72f8d0b0691276c75772093a350338980370a00ed936ee3928f8ba446865a6ba3dc70490f0c25a8
+EBUILD clang-10.0.0.9999.ebuild 9334 BLAKE2B dd945ca1a7827587a40f0cb329a9eefe5205e9ea89cdc58d74c3a3a9b6a7c159173f6042c8779224f98a2ee528027d3c83deca068aa6ac9127cc02fe58baaff5 SHA512 56cf98e5f53399da6eb12cacec63f8387fe0de9be0330162eb9eee2e27446ab91fd90457d81b466f21c0971c27ec29b859c997dd8cf3976bf934c3ce0525e0e6
+EBUILD clang-5.0.2.ebuild 10452 BLAKE2B 2f0af78f8cdaf88e643bccc474ff186db268307373cfe5130c09c2f07753c5eaa92220ab4f117ae1396ae5ff7cb13fb42765bcc44f7e0aa3decd1c7ce1c93dd2 SHA512 3dc65b62475430748da620f6dcd83943b5de88a28d666b321f107439a8cec88694285c6cf2cd90e0cca78b8f75d3c7af98ca70099500dfd1a59685aadb4fc630
EBUILD clang-6.0.1.ebuild 10272 BLAKE2B 7f179071a60dad773c4fedd95aae8c7529e84f891f6001808576bf6523baebe92eee713522c03accdcbeff76afc0c0a1329e159eef2cd307a2ff4ba6b598edc1 SHA512 508dc2b7c6758f63e931f83ec851ccf6e07433719e4e8dcb1f366c736bd22cb4fc19723dc2f05f7ff90f1828fc41a71d808d4f7f8332625134294516dc52ce79
EBUILD clang-7.1.0.ebuild 10355 BLAKE2B 6f698e87585d2ca5ec9f204022f13dbc9a44a91f78ddfb38e7981af84a19d619b9185124d627b6c00951e323393c864c12f32d60b465f635f1e70ec1f36a441f SHA512 e298008b3eaaf5efb51a04a6322adcbb6e7d16d8b4dba7d5c1ccd0e13ac2c9798b362c9be19087aa1b52a8cdb3ff291c91ed88d1cc7e8195312ee6da17d3e304
EBUILD clang-8.0.0.ebuild 10158 BLAKE2B 5864138aa69d8cb51fd0d378516aa83a50b30fa57945a95e159740f42949ccc4f9551c2a851170cbdacd2e93982a76fb34f883657c48d4839bbe865b906fbe01 SHA512 f4eca2292f261751a243bb9b50a2b8aaabb6e0f331ab50ebf88e6b1bc5b172c0e0a0b4efa0db87282d8cbfd0f13942e95f986d75ce9ee0d935a75194b7a1a313
-EBUILD clang-8.0.1.ebuild 10254 BLAKE2B 9ef4c42bd061aeb0b069eb21be3614c98a7ff2a6fa9d3ec7c9e805441b6bc620548e495946d96d693d23875a2f21c263c73a6ad88b07f909ff2f1a4c1814aaa6 SHA512 96187f3fa42e810ba107c83f2857c7d73dd93c4548fc2162a461e518439cceb5437e5101da143bb4c24db4b10fe044b59e92fc462494dd0bdc274c5e41b03973
-EBUILD clang-9.0.0.9999.ebuild 9378 BLAKE2B 398f15cf6abc57c7b64560f338d87bb8fccae689b95cfcc864df1bfc88f24cd6c33425e60ea37e1bc67151f8bdfec21fdf9a66856259f271ba697fc7f1400dd5 SHA512 471cff8f8b198707b4eb4000b0715481b9852c178e89055e9ee6694cb2e289506049ba04a63296e30a4c2b3b879caf3da0f6b8393c4f6a9a3031bcbed3d60eb8
+EBUILD clang-8.0.1.ebuild 10257 BLAKE2B 5fc7abba028f8604a99b4ed725d25edf504012c10b1dc62c3ef2bbeb6f56c96a1087344f5ccef0593ca8b96e9b7fb58bc3dda194fe09f9ea16ef83a53c974184 SHA512 dbe4c1ca84567d7fecd0ff52177a32657f4da4410183bd11cf7ab153de267041cd19f1994c49d617a5ba334b40731e1c3f99740cebeab304fec471efee89879a
+EBUILD clang-9.0.0.9999.ebuild 9276 BLAKE2B 2c0cfc102e3ad8f0da02c12ffa789880b05d0c0b6f264017896ae7b19d0116a55f708e29aedfeca990c651f0308a897bd4a317f9f590d6680ca9f0305d1a8434 SHA512 751382164fc4d5fd70919275f289792804aca26e025158eedfa0691361a7e11b6526c643b4b68735bf18aa9e8ba9df4744748d8fc1d83085cc9131573c1baa43
MISC metadata.xml 1377 BLAKE2B 8b580be2bcaddb98c2d2b8defd1730c69a7478248f7d241dd00f533d36d750a3f45c1e55161a4fd2731b6211a22c658046cf8ad5a87028c32928dfe0cd4a862f SHA512 b08ea2bd3454abb09abfa92b62e6dae4f4e10db0266c1e4895bef0f6a2d2fadea0b36b9b861831389413e1cca0e3c412b4cf474fc8c4170902b40deeab06686a
diff --git a/sys-devel/clang/clang-10.0.0.9999.ebuild b/sys-devel/clang/clang-10.0.0.9999.ebuild
index 423e55170bfd..801d601ba134 100644
--- a/sys-devel/clang/clang-10.0.0.9999.ebuild
+++ b/sys-devel/clang/clang-10.0.0.9999.ebuild
@@ -109,6 +109,8 @@ multilib_src_configure() {
local clang_version=$(ver_cut 1-3 "${llvm_version}")
local mycmakeargs=(
+ # ensure that the correct llvm-config is used
+ -DLLVM_CONFIG="$(type -P "${CHOST}-llvm-config")"
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}"
-DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
# relative to bindir
diff --git a/sys-devel/clang/clang-5.0.2.ebuild b/sys-devel/clang/clang-5.0.2.ebuild
new file mode 100644
index 000000000000..68bde97b3892
--- /dev/null
+++ b/sys-devel/clang/clang-5.0.2.ebuild
@@ -0,0 +1,323 @@
+# 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 llvm \
+ multilib-minimal pax-utils prefix python-single-r1 toolchain-funcs
+
+MY_P=cfe-${PV/_/}.src
+EXTRA_P=clang-tools-extra-${PV/_/}.src
+LLVM_P=llvm-${PV/_/}.src
+
+DESCRIPTION="C language family frontend for LLVM"
+HOMEPAGE="https://llvm.org/"
+SRC_URI="https://releases.llvm.org/${PV/_//}/${MY_P}.tar.xz
+ https://releases.llvm.org/${PV/_//}/${EXTRA_P}.tar.xz
+ test? ( https://releases.llvm.org/${PV/_//}/${LLVM_P}.tar.xz )
+ !doc? ( https://dev.gentoo.org/~mgorny/dist/llvm/llvm-${PV}-manpages.tar.bz2 )"
+
+# Keep in sync with sys-devel/llvm
+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_}" )
+LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
+
+LICENSE="UoI-NCSA"
+SLOT="$(ver_cut 1)"
+KEYWORDS="amd64 ~arm64 ~ppc64 x86 ~amd64-fbsd ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="debug default-compiler-rt default-libcxx doc +static-analyzer
+ test xml z3 kernel_FreeBSD ${ALL_LLVM_TARGETS[*]}"
+
+RDEPEND="
+ ~sys-devel/llvm-${PV}:${SLOT}=[debug=,${LLVM_TARGET_USEDEPS// /,},${MULTILIB_USEDEP}]
+ static-analyzer? (
+ dev-lang/perl:*
+ z3? ( <sci-mathematics/z3-4.6:0= )
+ )
+ xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
+ ${PYTHON_DEPS}"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx )
+ xml? ( virtual/pkgconfig )
+ !!<dev-python/configparser-3.3.0.2
+ ${PYTHON_DEPS}"
+RDEPEND="${RDEPEND}
+ !<sys-devel/llvm-4.0.0_rc:0
+ !sys-devel/clang:0"
+PDEPEND="
+ ~sys-devel/clang-runtime-${PV}
+ default-compiler-rt? ( =sys-libs/compiler-rt-${PV%_*}* )
+ default-libcxx? ( >=sys-libs/libcxx-${PV} )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+ || ( ${ALL_LLVM_TARGETS[*]} )"
+
+# We need extra level of indirection for CLANG_RESOURCE_DIR
+S=${WORKDIR}/x/y/${MY_P}
+
+# least intrusive of all
+CMAKE_BUILD_TYPE=RelWithDebInfo
+
+# Multilib notes:
+# 1. ABI_* flags control ABIs libclang* is built for only.
+# 2. clang is always capable of compiling code for all ABIs for enabled
+# target. However, you will need appropriate crt* files (installed
+# e.g. by sys-devel/gcc and sys-libs/glibc).
+# 3. ${CHOST}-clang wrappers are always installed for all ABIs included
+# in the current profile (i.e. alike supported by sys-devel/gcc).
+#
+# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need
+# multilib clang* libraries (not runtime, not wrappers).
+
+pkg_setup() {
+ LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup
+ python-single-r1_pkg_setup
+}
+
+src_unpack() {
+ # create extra parent dir for CLANG_RESOURCE_DIR
+ mkdir -p x/y || die
+ cd x/y || die
+
+ einfo "Unpacking ${MY_P}.tar.xz ..."
+ tar -xf "${DISTDIR}/${MY_P}.tar.xz" || die
+ einfo "Unpacking ${EXTRA_P}.tar.xz ..."
+ tar -xf "${DISTDIR}/${EXTRA_P}.tar.xz" || die
+
+ mv "${EXTRA_P}" "${S}"/tools/extra || die
+ if use test; then
+ einfo "Unpacking parts of ${LLVM_P}.tar.xz ..."
+ tar -xf "${DISTDIR}/${LLVM_P}.tar.xz" \
+ "${LLVM_P}"/utils/{lit,unittest} || die
+ mv "${LLVM_P}" "${WORKDIR}"/llvm || die
+ fi
+
+ if ! use doc; then
+ einfo "Unpacking llvm-${PV}-manpages.tar.bz2 ..."
+ tar -xf "${DISTDIR}/llvm-${PV}-manpages.tar.bz2" || die
+ fi
+}
+
+src_prepare() {
+ # fix finding compiler-rt libs
+ eapply "${FILESDIR}"/5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch
+ # fix setting LD_LIBRARY_PATH for tests on *BSD
+ eapply "${FILESDIR}"/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch
+ # add Prefix include paths for Darwin
+ eapply "${FILESDIR}"/6.0.1/darwin_prefix-include-paths.patch
+
+ cd tools/extra || die
+ # fix setting LD_LIBRARY_PATH for tests on *BSD (extra part)
+ eapply "${FILESDIR}"/5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch
+ cd ../.. || die
+
+ cmake-utils_src_prepare
+ eprefixify lib/Frontend/InitHeaderSearch.cpp
+}
+
+multilib_src_configure() {
+ local llvm_version=$(llvm-config --version) || die
+ local clang_version=$(ver_cut 1-3 "${llvm_version}")
+
+ local mycmakeargs=(
+ # ensure that the correct llvm-config is used
+ -DLLVM_CONFIG="$(type -P "${CHOST}-llvm-config")"
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}"
+ -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
+ # relative to bindir
+ -DCLANG_RESOURCE_DIR="../../../../lib/clang/${clang_version}"
+
+ -DBUILD_SHARED_LIBS=ON
+ -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
+ -DLLVM_BUILD_TESTS=$(usex test)
+
+ # these are not propagated reliably, so redefine them
+ -DLLVM_ENABLE_EH=ON
+ -DLLVM_ENABLE_RTTI=ON
+
+ -DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml)
+ # libgomp support fails to find headers without explicit -I
+ # furthermore, it provides only syntax checking
+ -DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
+
+ # override default stdlib and rtlib
+ -DCLANG_DEFAULT_CXX_STDLIB=$(usex default-libcxx libc++ "")
+ -DCLANG_DEFAULT_RTLIB=$(usex default-compiler-rt compiler-rt "")
+
+ -DCLANG_ENABLE_ARCMT=$(usex static-analyzer)
+ -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
+ # z3 is not multilib-friendly
+ -DCLANG_ANALYZER_BUILD_Z3=$(multilib_native_usex z3)
+ )
+ use test && mycmakeargs+=(
+ -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
+ )
+
+ if multilib_is_native_abi; then
+ mycmakeargs+=(
+ # normally copied from LLVM_INCLUDE_DOCS but the latter
+ # is lacking value in stand-alone builds
+ -DCLANG_INCLUDE_DOCS=$(usex doc)
+ -DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=$(usex doc)
+ )
+ use doc && mycmakeargs+=(
+ -DLLVM_BUILD_DOCS=ON
+ -DLLVM_ENABLE_SPHINX=ON
+ -DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html"
+ -DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra"
+ -DSPHINX_WARNINGS_AS_ERRORS=OFF
+ )
+ use z3 && mycmakeargs+=(
+ -DZ3_INCLUDE_DIR="${EPREFIX}/usr/include/z3"
+ )
+ else
+ mycmakeargs+=(
+ -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF
+ )
+ fi
+
+ if [[ -n ${EPREFIX} ]]; then
+ mycmakeargs+=(
+ -DGCC_INSTALL_PREFIX="${EPREFIX}/usr"
+ )
+ fi
+
+ if tc-is-cross-compiler; then
+ [[ -x "/usr/bin/clang-tblgen" ]] \
+ || die "/usr/bin/clang-tblgen not found or usable"
+ mycmakeargs+=(
+ -DCMAKE_CROSSCOMPILING=ON
+ -DCLANG_TABLEGEN=/usr/bin/clang-tblgen
+ )
+ 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
+
+ # provide a symlink for tests
+ if [[ ! -L ${WORKDIR}/lib/clang ]]; then
+ mkdir -p "${WORKDIR}"/lib || die
+ ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die
+ fi
+}
+
+multilib_src_test() {
+ # respect TMPDIR!
+ local -x LIT_PRESERVES_TMP=1
+ cmake-utils_src_make check-clang
+ # clang-tidy requires [static-analyzer] and tests are not split
+ # correctly, so they are all disabled when static-analyzer is off
+ if multilib_is_native_abi && use static-analyzer; then
+ cmake-utils_src_make check-clang-tools
+ fi
+}
+
+src_install() {
+ MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/clang/Config/config.h
+ )
+
+ multilib-minimal_src_install
+
+ # Move runtime headers to /usr/lib/clang, where they belong
+ mv "${ED%/}"/usr/include/clangrt "${ED%/}"/usr/lib/clang || die
+ # move (remaining) wrapped headers back
+ mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT}/include || die
+
+ # Apply CHOST and version suffix to clang tools
+ # note: we use two version components here (vs 3 in runtime path)
+ local llvm_version=$(llvm-config --version) || die
+ local clang_version=$(ver_cut 1-2 "${llvm_version}")
+ local clang_full_version=$(ver_cut 1-3 "${llvm_version}")
+ local clang_tools=( clang clang++ clang-cl clang-cpp )
+ local abi i
+
+ # cmake gives us:
+ # - clang-X.Y
+ # - clang -> clang-X.Y
+ # - clang++, clang-cl, clang-cpp -> clang
+ # we want to have:
+ # - clang-X.Y
+ # - clang++-X.Y, clang-cl-X.Y, clang-cpp-X.Y -> clang-X.Y
+ # - clang, clang++, clang-cl, clang-cpp -> clang*-X.Y
+ # also in CHOST variant
+ for i in "${clang_tools[@]:1}"; do
+ rm "${ED%/}/usr/lib/llvm/${SLOT}/bin/${i}" || die
+ dosym "clang-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}-${clang_version}"
+ dosym "${i}-${clang_version}" "/usr/lib/llvm/${SLOT}/bin/${i}"
+ done
+
+ # now create target symlinks for all supported ABIs
+ for abi in $(get_all_abis); do
+ local abi_chost=$(get_abi_CHOST "${abi}")
+ for i in "${clang_tools[@]}"; do
+ dosym "${i}-${clang_version}" \
+ "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}-${clang_version}"
+ dosym "${abi_chost}-${i}-${clang_version}" \
+ "/usr/lib/llvm/${SLOT}/bin/${abi_chost}-${i}"
+ done
+ done
+
+ # Remove unnecessary headers on FreeBSD, bug #417171
+ if use kernel_FreeBSD; then
+ rm "${ED}"usr/lib/clang/${clang_full_version}/include/{std,float,iso,limits,tgmath,varargs}*.h || die
+ fi
+}
+
+multilib_src_install() {
+ cmake-utils_src_install
+
+ # move headers to /usr/include for wrapping & ABI mismatch checks
+ # (also drop the version suffix from runtime headers)
+ rm -rf "${ED%/}"/usr/include || die
+ mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die
+ mv "${ED%/}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang "${ED%/}"/usr/include/clangrt || die
+}
+
+multilib_src_install_all() {
+ python_fix_shebang "${ED}"
+ if use static-analyzer; then
+ python_optimize "${ED}"usr/lib/llvm/${SLOT}/share/scan-view
+ fi
+
+ # install pre-generated manpages
+ if ! use doc; then
+ insinto "/usr/lib/llvm/${SLOT}/share/man/man1"
+ doins "${WORKDIR}/x/y/llvm-${PV}-manpages/clang"/*.1
+ fi
+
+ docompress "/usr/lib/llvm/${SLOT}/share/man"
+ # match 'html' non-compression
+ use doc && docompress -x "/usr/share/doc/${PF}/tools-extra"
+ # +x for some reason; TODO: investigate
+ use static-analyzer && fperms a-x "/usr/lib/llvm/${SLOT}/share/man/man1/scan-build.1"
+}
+
+pkg_postinst() {
+ if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+ eselect compiler-shadow update all
+ fi
+
+ elog "You can find additional utility scripts in:"
+ elog " ${EROOT}/usr/lib/llvm/${SLOT}/share/clang"
+ elog "To use these scripts, you will need Python 2.7. Some of them are vim"
+ elog "integration scripts (with instructions inside)."
+}
+
+pkg_postrm() {
+ if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+ eselect compiler-shadow clean all
+ fi
+}
diff --git a/sys-devel/clang/clang-8.0.1.ebuild b/sys-devel/clang/clang-8.0.1.ebuild
index 29864fec9519..b3eea9c9d31f 100644
--- a/sys-devel/clang/clang-8.0.1.ebuild
+++ b/sys-devel/clang/clang-8.0.1.ebuild
@@ -31,7 +31,7 @@ LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/?}
LICENSE="UoI-NCSA"
SLOT="$(ver_cut 1)"
-KEYWORDS="amd64 ~arm ~arm64 ppc64 x86 ~amd64-fbsd ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-fbsd ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos"
IUSE="debug default-compiler-rt default-libcxx doc +static-analyzer
test xml z3 kernel_FreeBSD ${ALL_LLVM_TARGETS[*]}"
RESTRICT="!test? ( test )"
diff --git a/sys-devel/clang/clang-9.0.0.9999.ebuild b/sys-devel/clang/clang-9.0.0.9999.ebuild
index 4fac61d4c534..92eaa1de0a74 100644
--- a/sys-devel/clang/clang-9.0.0.9999.ebuild
+++ b/sys-devel/clang/clang-9.0.0.9999.ebuild
@@ -63,12 +63,6 @@ S=${WORKDIR}/x/y/${P}
# least intrusive of all
CMAKE_BUILD_TYPE=RelWithDebInfo
-PATCHES=(
- # fix linking in non-native build (without tools-extra)
- # https://bugs.llvm.org/show_bug.cgi?id=43281
- "${FILESDIR}"/9.0.0/0001-clang-unittest-Import-LLVMTestingSupport-if-necessar.patch
-)
-
# Multilib notes:
# 1. ABI_* flags control ABIs libclang* is built for only.
# 2. clang is always capable of compiling code for all ABIs for enabled
@@ -114,6 +108,8 @@ multilib_src_configure() {
local clang_version=$(ver_cut 1-3 "${llvm_version}")
local mycmakeargs=(
+ # ensure that the correct llvm-config is used
+ -DLLVM_CONFIG="$(type -P "${CHOST}-llvm-config")"
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}"
-DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man"
# relative to bindir
diff --git a/sys-devel/clang/files/5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch b/sys-devel/clang/files/5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch
new file mode 100644
index 000000000000..7d53cbdef3f3
--- /dev/null
+++ b/sys-devel/clang/files/5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch
@@ -0,0 +1,136 @@
+From 19e3dc0ce4949cc7f869b4552c6a7f28cd59c3b7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Thu, 17 Nov 2016 14:19:18 +0100
+Subject: [PATCH] [Driver] Use arch type to find compiler-rt libraries (on
+ Linux)
+
+Use llvm::Triple::getArchTypeName() when looking for compiler-rt
+libraries, rather than the exact arch string from the triple. This is
+more correct as it matches the values used when building compiler-rt
+(builtin-config-ix.cmake) which are the subset of the values allowed
+in triples.
+
+For example, this fixes an issue when the compiler set for
+i686-pc-linux-gnu triple would not find an i386 compiler-rt library,
+while this is the exact arch that is detected by compiler-rt. The same
+applies to any other i?86 variant allowed by LLVM.
+
+This also makes the special case for MSVC unnecessary, since now i386
+will be used reliably for all 32-bit x86 variants.
+---
+ lib/Driver/ToolChain.cpp | 5 +----
+ .../usr/i686-unknown-linux/lib/.keep | 0
+ .../usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o | 0
+ test/Driver/linux-ld.c | 21 +++++++++++++++++++++
+ test/Driver/nostdlib.c | 2 +-
+ test/Driver/print-libgcc-file-name-clangrt.c | 10 ++++++++--
+ test/Driver/windows-cross.c | 2 +-
+ 7 files changed, 32 insertions(+), 8 deletions(-)
+ create mode 100644 test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep
+ create mode 100644 test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o
+
+diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
+index 6adc0386ee..7e4222f087 100644
+--- a/lib/Driver/ToolChain.cpp
++++ b/lib/Driver/ToolChain.cpp
+@@ -283,15 +283,12 @@ static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
+ const llvm::Triple &Triple = TC.getTriple();
+ bool IsWindows = Triple.isOSWindows();
+
+- if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86)
+- return "i386";
+-
+ if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
+ return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows)
+ ? "armhf"
+ : "arm";
+
+- return TC.getArchName();
++ return llvm::Triple::getArchTypeName(TC.getArch());
+ }
+
+ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
+diff --git a/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep b/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep
+new file mode 100644
+index 0000000000..e69de29bb2
+diff --git a/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o
+new file mode 100644
+index 0000000000..e69de29bb2
+diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
+index e5aa870866..92b199b9d4 100644
+--- a/test/Driver/linux-ld.c
++++ b/test/Driver/linux-ld.c
+@@ -71,6 +71,27 @@
+ // CHECK-LD-RT: libclang_rt.builtins-x86_64.a"
+ //
+ // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
++// RUN: --target=i686-unknown-linux \
++// RUN: --gcc-toolchain="" \
++// RUN: --sysroot=%S/Inputs/basic_linux_tree \
++// RUN: --rtlib=compiler-rt \
++// RUN: | FileCheck --check-prefix=CHECK-LD-RT-I686 %s
++// CHECK-LD-RT-I686-NOT: warning:
++// CHECK-LD-RT-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
++// CHECK-LD-RT-I686: "--eh-frame-hdr"
++// CHECK-LD-RT-I686: "-m" "elf_i386"
++// CHECK-LD-RT-I686: "-dynamic-linker"
++// CHECK-LD-RT-I686: "{{.*}}/usr/lib/gcc/i686-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0"
++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../../../i686-unknown-linux/lib"
++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../.."
++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/lib"
++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib"
++// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a"
++// CHECK-LD-RT-I686: "-lc"
++// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a"
++//
++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+ // RUN: --target=arm-linux-androideabi \
+ // RUN: --gcc-toolchain="" \
+ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+diff --git a/test/Driver/nostdlib.c b/test/Driver/nostdlib.c
+index a9ef665c57..c9793d968c 100644
+--- a/test/Driver/nostdlib.c
++++ b/test/Driver/nostdlib.c
+@@ -27,5 +27,5 @@
+ //
+ // CHECK-LINUX-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt'
+ // CHECK-LINUX-NOSTDLIB: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+-// CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.builtins-i686.a"
++// CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.builtins-i386.a"
+ // CHECK-MSVC-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt'
+diff --git a/test/Driver/print-libgcc-file-name-clangrt.c b/test/Driver/print-libgcc-file-name-clangrt.c
+index 9f8120c31d..28c758881d 100644
+--- a/test/Driver/print-libgcc-file-name-clangrt.c
++++ b/test/Driver/print-libgcc-file-name-clangrt.c
+@@ -6,6 +6,12 @@
+ // CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a
+
+ // RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
++// RUN: --target=i386-pc-linux \
++// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s
++// CHECK-CLANGRT-I386: libclang_rt.builtins-i386.a
++
++// Check whether alternate arch values map to the correct library.
++//
++// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
+ // RUN: --target=i686-pc-linux \
+-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s
+-// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a
++// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s
+diff --git a/test/Driver/windows-cross.c b/test/Driver/windows-cross.c
+index 5a2fe52b09..78b4981c9d 100644
+--- a/test/Driver/windows-cross.c
++++ b/test/Driver/windows-cross.c
+@@ -59,7 +59,7 @@
+ // RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE-X86
+
+ // CHECK-SANITIZE-ADDRESS-EXE-X86: "-fsanitize=address"
+-// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic-i686.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk-i686.lib" "--undefined" "___asan_seh_interceptor"
++// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic-i386.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib" "--undefined" "___asan_seh_interceptor"
+
+ // RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \
+ // RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-TSAN
+--
+2.11.0
+
diff --git a/sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch b/sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch
new file mode 100644
index 000000000000..1751a4f479f0
--- /dev/null
+++ b/sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch
@@ -0,0 +1,76 @@
+From 4650c277d616e5d297baf28682eb792e2e0144b1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 1 Apr 2018 23:20:56 +0200
+Subject: [PATCH] [test] Fix clang-test for FreeBSD and NetBSD
+
+Lit tries to inject the shared library paths, but no action is taken
+when platform.system() is not recognized, results in an environment
+variable with an empty name, which is illegal.
+
+The patch fixes this mechanism for FreeBSD and NetBSD, and gives an
+warning on other platforms, so that the latecomers don't have to spend
+time on debugging lit.
+
+Thanks Zhihao Yuan for the patch!
+
+Differential Revision: https://reviews.llvm.org/D39162
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316411 91177308-0d34-0410-b5e6-96231b3b80d8
+
+(rebased for release_50 branch)
+---
+ test/Unit/lit.cfg | 41 ++++++++++++++++++++---------------------
+ 1 file changed, 20 insertions(+), 21 deletions(-)
+
+diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg
+index 90eb2ac604..2cabf4bba1 100644
+--- a/test/Unit/lit.cfg
++++ b/test/Unit/lit.cfg
+@@ -87,24 +87,23 @@ if config.test_exec_root is None:
+ lit_config.load_config(config, site_cfg)
+ raise SystemExit
+
+-shlibpath_var = ''
+-if platform.system() == 'Linux':
+- shlibpath_var = 'LD_LIBRARY_PATH'
+-elif platform.system() == 'Darwin':
+- shlibpath_var = 'DYLD_LIBRARY_PATH'
+-elif platform.system() == 'Windows':
+- shlibpath_var = 'PATH'
+-
+-# in stand-alone builds, shlibdir is clang's build tree
+-# while llvm_libs_dir is installed LLVM (and possibly older clang)
+-llvm_shlib_dir = getattr(config, 'shlibdir', None)
+-if not llvm_shlib_dir:
+- lit_config.fatal('No shlibdir set!')
+-# Point the dynamic loader at dynamic libraries in 'lib'.
+-llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
+-if not llvm_libs_dir:
+- lit_config.fatal('No LLVM libs dir set!')
+-shlibpath = os.path.pathsep.join((llvm_shlib_dir, llvm_libs_dir,
+- config.environment.get(shlibpath_var,'')))
+-
+-config.environment[shlibpath_var] = shlibpath
++def find_shlibpath_var():
++ if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
++ yield 'LD_LIBRARY_PATH'
++ elif platform.system() == 'Darwin':
++ yield 'DYLD_LIBRARY_PATH'
++ elif platform.system() == 'Windows':
++ yield 'PATH'
++
++for shlibpath_var in find_shlibpath_var():
++ # in stand-alone builds, shlibdir is clang's build tree
++ # while llvm_libs_dir is installed LLVM (and possibly older clang)
++ shlibpath = os.path.pathsep.join(
++ (config.shlibdir,
++ config.llvm_libs_dir,
++ config.environment.get(shlibpath_var, '')))
++ config.environment[shlibpath_var] = shlibpath
++ break
++else:
++ lit_config.warning("unable to inject shared library path on '{}'"
++ .format(platform.system()))
+--
+2.17.0.rc2
+
diff --git a/sys-devel/clang/files/5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch b/sys-devel/clang/files/5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch
new file mode 100644
index 000000000000..cbdb0b807aaf
--- /dev/null
+++ b/sys-devel/clang/files/5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch
@@ -0,0 +1,37 @@
+From 5c5bb3948697f2ca184a03dedd5666eb2de547ba Mon Sep 17 00:00:00 2001
+From: Dimitry Andric <dimitry@andric.com>
+Date: Sat, 20 Jan 2018 14:34:33 +0000
+Subject: [PATCH] Assume the shared library path variable is LD_LIBRARY_PATH on
+ systems except Darwin and Windows. This prevents inserting an environment
+ variable with an empty name (which is illegal and leads to a Python
+ exception) on any of the BSDs.
+
+git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@323040 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ test/Unit/lit.cfg | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg
+index fc63afdb..b40e1cae 100644
+--- a/test/Unit/lit.cfg
++++ b/test/Unit/lit.cfg
+@@ -19,13 +19,12 @@ config.test_exec_root = config.test_source_root
+ # ;-separated list of subdirectories).
+ config.test_format = lit.formats.GoogleTest('.', 'Tests')
+
+-shlibpath_var = ''
+-if platform.system() == 'Linux':
+- shlibpath_var = 'LD_LIBRARY_PATH'
+-elif platform.system() == 'Darwin':
++if platform.system() == 'Darwin':
+ shlibpath_var = 'DYLD_LIBRARY_PATH'
+ elif platform.system() == 'Windows':
+ shlibpath_var = 'PATH'
++else:
++ shlibpath_var = 'LD_LIBRARY_PATH'
+
+ # Point the dynamic loader at dynamic libraries in 'lib'.
+ shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir,
+--
+2.17.0.rc2
+
diff --git a/sys-devel/clang/files/9.0.0/0001-clang-unittest-Import-LLVMTestingSupport-if-necessar.patch b/sys-devel/clang/files/9.0.0/0001-clang-unittest-Import-LLVMTestingSupport-if-necessar.patch
deleted file mode 100644
index 67ae5a8e4dcf..000000000000
--- a/sys-devel/clang/files/9.0.0/0001-clang-unittest-Import-LLVMTestingSupport-if-necessar.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From bfb5b0cb86cf90d9fa794f873644aa642b652c43 Mon Sep 17 00:00:00 2001
-From: Michal Gorny <mgorny@gentoo.org>
-Date: Thu, 12 Sep 2019 13:06:12 +0000
-Subject: [PATCH] [clang] [unittest] Import LLVMTestingSupport if necessary
-
-Add LLVMTestingSupport directory from LLVM_MAIN_SRC_DIR when building
-clang stand-alone and LLVMTestingSupport library is not present. This
-is needed to fix stand-alone builds without clang-tools-extra.
-
-Differential Revision: https://reviews.llvm.org/D67452
-
-llvm-svn: 371733
----
- clang/unittests/CMakeLists.txt | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt
-index 9a41000cf43..4c222e24599 100644
---- a/unittests/CMakeLists.txt
-+++ b/unittests/CMakeLists.txt
-@@ -1,6 +1,15 @@
- add_custom_target(ClangUnitTests)
- set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests")
-
-+if(CLANG_BUILT_STANDALONE)
-+ # LLVMTestingSupport library is needed for some of the unittests.
-+ if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
-+ AND NOT TARGET LLVMTestingSupport)
-+ add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
-+ lib/Testing/Support)
-+ endif()
-+endif()
-+
- # add_clang_unittest(test_dirname file1.cpp file2.cpp)
- #
- # Will compile the list of files together and link against the clang
---
-2.23.0
-