public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/heroxbd:master commit in: sys-devel/llvm/files/cmake/, sys-devel/llvm/files/, ...
@ 2015-12-21  4:31 Benda XU
  0 siblings, 0 replies; only message in thread
From: Benda XU @ 2015-12-21  4:31 UTC (permalink / raw
  To: gentoo-commits

commit:     54f0d5937f1587c16d68927a9a471d06612714e3
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 12 08:23:13 2015 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Thu Nov 12 08:23:13 2015 +0000
URL:        https://gitweb.gentoo.org/dev/heroxbd.git/commit/?id=54f0d593

sys-devel/llvm: add.

 sys-devel/llvm/Manifest                            | 119 +++++
 .../0001-r600-Add-some-intrinsic-definitions.patch |  64 +++
 ...t_global_size-and-get_local_size-intrinsi.patch |  27 +
 ...clang-3.1-gentoo-runtime-gcc-detection-v3.patch |  29 ++
 .../llvm/files/clang-3.3-gcc-header-path.patch     |  90 ++++
 .../llvm/files/clang-3.3-gentoo-install.patch      |  71 +++
 .../llvm/files/clang-3.4-darwin_build_fix.patch    |  47 ++
 .../clang-3.4-darwin_prefix-include-paths.patch    |  18 +
 .../llvm/files/clang-3.4-gentoo-install.patch      |  80 +++
 .../llvm/files/clang-3.5-gentoo-install.patch      |  57 +++
 ...clang-3.5-gentoo-runtime-gcc-detection-v3.patch |  42 ++
 sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch    |  25 +
 .../llvm/files/clang-3.6-gentoo-install.patch      |  48 ++
 .../llvm/files/clang-3.7-strip_doc_refs.patch      |  42 ++
 ...rt-overriding-Sphinx-HTML-doc-install-dir.patch |  36 ++
 ...n-ordering-dep-between-HTML-man-Sphinx-ta.patch |  32 ++
 .../cmake/0004-cmake-Do-not-install-libgtest.patch |  28 ++
 ...g-runtime-into-usr-lib-without-suffix-3.8.patch |  37 ++
 ...clang-runtime-into-usr-lib-without-suffix.patch |  52 ++
 ...make-Make-CLANG_LIBDIR_SUFFIX-overridable.patch |  28 ++
 ...ll-compiler-rt-into-usr-lib-without-suffi.patch |  25 +
 .../files/cmake/llvm-3.7.0-ocaml-multilib.patch    |  43 ++
 .../llvm-3.8-allow_custom_cmake_build_types.patch  |  14 +
 .../llvm/files/llvm-2.6-commandguide-nops.patch    |  30 ++
 sys-devel/llvm/files/llvm-2.7-nodoctargz.patch     |  47 ++
 sys-devel/llvm/files/llvm-2.8-alignof.patch        |  59 +++
 sys-devel/llvm/files/llvm-2.8-darwin8.patch        |  15 +
 .../llvm/files/llvm-2.9-Operator.h-c++0x.patch     |  57 +++
 sys-devel/llvm/files/llvm-2.9-gcc4.7.patch         |  14 +
 sys-devel/llvm/files/llvm-2.9-nodoctargz.patch     |  39 ++
 .../llvm-3.0-PPCCompilationCallbackC_static.patch  |  27 +
 sys-devel/llvm/files/llvm-3.0-PPC_macro.patch      |  43 ++
 sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch  |  10 +
 sys-devel/llvm/files/llvm-3.0-ocaml_install.patch  |  16 +
 sys-devel/llvm/files/llvm-3.0-set_soname.patch     |  12 +
 .../llvm-3.1-ExecutionEngine_tests_xfail_arm.patch |  27 +
 .../files/llvm-3.1-docs-pod-markup-fixes.patch     |  28 ++
 .../llvm/files/llvm-3.1-fix_debug_line_info.patch  |  65 +++
 .../llvm/files/llvm-3.1-ivybridge_support.patch    |  13 +
 sys-devel/llvm/files/llvm-3.2-nodoctargz.patch     |  45 ++
 sys-devel/llvm/files/llvm-3.3-R600_debug.patch     |  22 +
 .../llvm/files/llvm-3.3-cmake-modulepath.patch     |  24 +
 sys-devel/llvm/files/llvm-3.3-gentoo-install.patch | 141 ++++++
 sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch |  30 ++
 .../llvm/files/llvm-3.3-r2-gentoo-install.patch    | 117 +++++
 .../llvm/files/llvm-3.4-cmake-configparser.patch   |  35 ++
 sys-devel/llvm/files/llvm-3.4-fix_varargs.patch    | 148 ++++++
 sys-devel/llvm/files/llvm-3.4-gentoo-install.patch |  96 ++++
 sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch        |  43 ++
 sys-devel/llvm/files/llvm-3.5-gentoo-install.patch |  83 ++++
 .../files/llvm-3.5.0-fix_LLVMExports_cmake.patch   |  39 ++
 sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch      |  14 +
 sys-devel/llvm/files/llvm-3.6-gentoo-install.patch |  82 ++++
 .../llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch |  35 ++
 sys-devel/llvm/files/llvm-3.7-nodoctargz.patch     |  49 ++
 sys-devel/llvm/llvm-2.8-r2.ebuild                  | 168 +++++++
 sys-devel/llvm/llvm-2.9-r2.ebuild                  | 175 +++++++
 sys-devel/llvm/llvm-3.0-r2.ebuild                  | 181 +++++++
 sys-devel/llvm/llvm-3.1-r2.ebuild                  | 191 ++++++++
 sys-devel/llvm/llvm-3.2.ebuild                     | 206 ++++++++
 sys-devel/llvm/llvm-3.3-r3.ebuild                  | 500 +++++++++++++++++++
 sys-devel/llvm/llvm-3.4.2.ebuild                   | 543 +++++++++++++++++++++
 sys-devel/llvm/llvm-3.5.0.ebuild                   | 530 ++++++++++++++++++++
 sys-devel/llvm/llvm-3.5.1.ebuild                   | 530 ++++++++++++++++++++
 sys-devel/llvm/llvm-3.5.2.ebuild                   | 532 ++++++++++++++++++++
 sys-devel/llvm/llvm-3.6.0.ebuild                   | 534 ++++++++++++++++++++
 sys-devel/llvm/llvm-3.6.1.ebuild                   | 541 ++++++++++++++++++++
 sys-devel/llvm/llvm-3.6.2.ebuild                   | 541 ++++++++++++++++++++
 sys-devel/llvm/llvm-3.7.0-r1.ebuild                | 509 +++++++++++++++++++
 sys-devel/llvm/llvm-3.7.0.ebuild                   | 492 +++++++++++++++++++
 sys-devel/llvm/llvm-9999.ebuild                    | 508 +++++++++++++++++++
 sys-devel/llvm/metadata.xml                        |  28 ++
 72 files changed, 9268 insertions(+)

diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
new file mode 100644
index 0000000..715e76b
--- /dev/null
+++ b/sys-devel/llvm/Manifest
@@ -0,0 +1,119 @@
+AUX cl-patches/0001-r600-Add-some-intrinsic-definitions.patch 2450 SHA256 b0a718800c8969e174f3a22e61c15a370376f477e031fe97fff6aaab152f9867 SHA512 d23f9645d3e3364b1e9ce522eb15022fd3f2a685741db88b117b409ee33a07344a8e9ba9d89dc3535e5289edf79c6beb7ff144659f4e725b1a8f2c4256f9aad0 WHIRLPOOL c549806dbe5309dc441b65c942de488c6afc8c511d060d5c1459a4f99b97a357acbec51ce51bd704e5e1e74437cd413755f15377ad6b96c235242bc370af096f
+AUX cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch 1189 SHA256 172bbb3cb1214e61ee2684c133317bb997e94a34c91dae94d4848cbd0c216436 SHA512 cf711149c421b4258bc64b81018d0a9474d8b4e4128d0cc0cea788b54c93e9512397b2310db8a1834c3507b4d893d5743dbc53183ac0daca23da55601b976c16 WHIRLPOOL 8e6bd9f005a6a941c55d7c8d9b127826191944fab9e404f8ed958efd07017f5f9301273739f869a73f15fc2a79af9dc18687ff85403acf24e175a464838b3f2e
+AUX clang-3.1-gentoo-runtime-gcc-detection-v3.patch 1457 SHA256 f4b22281d21e39bc4681519cec90243c0e50262ce56ae68b0a8d9e7d92ce0375 SHA512 81c582791f4b0b1ccfcf3e8c82fbb68312320c5287402236d8c6d2d76767bbba031094c26d2b7bd9581c473896b78dda5a6284c5a87726e1bc0c539ae9294763 WHIRLPOOL bb68797804c89f8797561964697a72a015daf2c951d92f490f8c83f38aac6f50ce1527f39b53ccc6a3d93f84ec8f868e40340a5472b9e7ee4c34ceaa4b9ca845
+AUX clang-3.3-gcc-header-path.patch 4309 SHA256 56e51c30b91f0ff264c27e332c5375672c035b8271a64860b9e940c918ebf7ac SHA512 568c82c34b56bd18e34122975a420f38ae9f190c9efec00383aa0802c1810297b1fef94a21093775ee20c4b30ad5800b4bbebd26e5cbc9358b11ce7b5165ac41 WHIRLPOOL 2ea6ba49110d6f0bb1f3c6f93f6788463cfcf67b19d9397a69ab4066d3fc1106d544bedc24668a5e515df561e992a7d59a27253a08fae02e622aad36962ace8f
+AUX clang-3.3-gentoo-install.patch 2815 SHA256 76a3ce245b1fb9cc5d391934755d27e248bdcbb9581ab7931287e75bf626aad5 SHA512 8105461ff031a7dc00e2a8ca9939afb56525bdc065beff7bb06f22525cb6ecf6b8196a1e0ac11fa3895dc29b4f04c24f61c5492859f23785285517775f3d69b6 WHIRLPOOL dbb5fc2596bee19ec9fff0c14b4a9e087a6ba4e3af115da956c43772cf44f2f480a21f86b15ec3890d74cc3fa3b9cb4e3bdbee341677fb8e79a640b0a5c8f6fa
+AUX clang-3.4-darwin_build_fix.patch 1876 SHA256 b2fe85911006affc8ac5fc68496c45845872cf4b37445910b8d10a5bfbe77fcc SHA512 54841b590e14b84f90b00ec782785181018196d076764e4048960d1321d18aac388e1220bdc70b10432dfb5fcad5a43af6c33124ec93df8bc3a724cceeee9260 WHIRLPOOL 8c1373a558619be095427d7986246524e5f7c1239ee706234debc2add1f03626d630a1e5216bdc7127f0b833eca791fae666765a27d394ecc55d394492f424ab
+AUX clang-3.4-darwin_prefix-include-paths.patch 710 SHA256 f76311dfc5fa734a3a72fa516f695486595963824d5b6891fd1454d71c27fa0b SHA512 e130d7392b82ffc40ec96c0ee45d53cf032c761e00a7a2382af1f826e2a892b12069a7f5407307e1828fb741e522b8e10728d593d839e1b5648ccf9460feff0e WHIRLPOOL d2b24e224cb90be9615994d64af92b139325b2630cc43851370b8989d0eb7ee8f43ad421e3036041a30ec1fb30c1e3ddaf09d54f461484963a2bd8ea2fba24c6
+AUX clang-3.4-gentoo-install.patch 3228 SHA256 051799f114102aa46717dc4a7224c878f7511b69a06090c501abe157c6025c5d SHA512 35127c66182ee1f698bf96731c11679c3fe162d9dcb524c06467598b374fcce94dd0484723acc0072ab1565c581e2fc74d6b7246484bfd9bf1511eb419a85c9b WHIRLPOOL 3d1644da31e9278bf0983bcaf1947b99570e71366b6cc868020c5978037795c27ae211c4d32562dfc1933ff2a4e9f8c0aab0248ac9c6c69fc954a830502d3f68
+AUX clang-3.5-gentoo-install.patch 2166 SHA256 e359a219f2d0d2b88094bbb5ab91fd50d9662686f77e85b7ccfb8d1c4a6fd39d SHA512 07e5b3d4131a7d58577bcb99a82c585258c98a38e71b7e8dda058b467a558471e1ddeec5c9f5492f5d17e280cd4b09e49338e0926dd2534583bc8a2772bce26d WHIRLPOOL 5582b2015b4d3e845a45bfda08c156683df11685170f253f79ccf016f2e771b016d213417d83068f01a41bd8e0148474711cd6f9b7187e758322e9ebb9c390dd
+AUX clang-3.5-gentoo-runtime-gcc-detection-v3.patch 1694 SHA256 24691db819d08f87f0144a67900ae6797c0df4d180b55acc5c377d890ac2e72e SHA512 a34f694560ef0c7366ad0dc243a479afc74b6122d624b8681538da69c70d0d1869245a89c61d49add890c5f76134281470f5e75a59e6fc9ac963230fc56fe8e6 WHIRLPOOL 4f4af09e08c7d5af89558e77d0a2a4542f77ae505e9020ca6e48e20ef71c4db6016ed0211b2a303b756994f62949c91c216cc2f81b16ff65c71414d354977c8f
+AUX clang-3.6-fbsd-gcc49.patch 1016 SHA256 550862df82d47bd54e8adad7b8ee5bc8eaf14ed4bc100d09ba01d5416ac624b5 SHA512 4d9fcb9626774ea1a06494ee55efb5d6232a33874996a90fa29003ac53f9b9dad2885281a9f9bc15fdf0f0817c351cb6d8a4151e5f6ea12e28d383ded1429018 WHIRLPOOL c0140413a4944989efc5ef9c6ba33d10f43add5e1d8c7a8438cb04c18e764c3db26d65330d6a1570940a93cf4d43de6bb1f5a5640384faed3ea43abfa52b3d5d
+AUX clang-3.6-gentoo-install.patch 1660 SHA256 74cce23945897ce2cfd3931b08695d534973e32a0d104ff942b2f5c500ec4ad7 SHA512 77e2a2dd82fd13292edced8c9bba911579f2b4984a64223e8c80f41b5605220f1433beb6f40e0746163d894d4405296e1f40584eb069f960866df97e6057b569 WHIRLPOOL 4784e8da4e04406a1261c9a539280c90936141b6061e567c70f9e4b566d45e0275b2513d66c03a5473fee6f434e0cf0242e7ac21eafe59a8c26c7c6bf7040876
+AUX clang-3.7-strip_doc_refs.patch 2213 SHA256 5b1e7cc9264d55d3c8213cbf4c6701ad01652da1159ba0bf620cbe7a3382cfdd SHA512 dbe382a64e01c148b6e33734c1b423148584a15037c651cc56691146a1419559006a605c9bfb4ae72d23702ea48f1f40903bd0faf95c1d0ac3c8bd68c4238cdf WHIRLPOOL 5c884f67413af976f1146a2705c1096a7425ca90d13686b9f71f2230447ebe1d1bd39a93e32ef01b4ec6178fbd199b05bcf8d0a6780637914f3bac86955409c3
+AUX cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch 1404 SHA256 c9692562264ee6a25c3a2f25c990fab763aee36014de3ef95aa1d35a89aa0c0b SHA512 41dfe489adc0a45e4ffd5961c973fe94934d542b1474bb2dba4320b75ed6ff22ce0ac4b590ff20e626ea7c14617c9703ce1fd4d8d6bf1bd3b26ab0adeea373f0 WHIRLPOOL a9d84dc513118cab6310ea46c7b2e67654c81cd3c783d5db8e9ea3657fc1658e80fe4663399d4e35f99294ea9a98fb422e9077a6c8b73a3a98bbc8b282d1e9ad
+AUX cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch 954 SHA256 6518c1a1fdce0371aa1a9dab790c0999440e7971ab2613f6d348250ace9310d2 SHA512 e4721c13add5f65126a3d84b9b66ce7086f435c9d2a729edca7bfc3c6f185afb2b5422c7f5045c1a3a4f82c5e3d5616b647bfad9975bb73ecf228235f1d9f588 WHIRLPOOL f35f09b2d29de42dba9c28825af5feec562860f25206589b0a9dcd1daea27c317da1385bdaa5c562b2f4c0613071c3bc1fbfcddece97cd13debaddd14324d552
+AUX cmake/0004-cmake-Do-not-install-libgtest.patch 835 SHA256 ed1531681603507fc674babd1f117063dcceb856151c20fd967d667d0dd83f2d SHA512 156f3b56e1bfe17804d3543a109567dcc10bac7a77f440d97bb900cc61f1e7bfe195ea3cf97bffbae7b132ebe31ad9d1acf5aca462a4aa01575909971ffdcf06 WHIRLPOOL d8bdc2032cec631c89d77a8fd231a0c22eeb5f9c99b8fda1068fb0e9fc10c81dc2d1bc71e8254ebea6392cfe3700427879841f7a6fcca3cd4c72ec1f1cdd56b0
+AUX cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix-3.8.patch 1754 SHA256 fa820a6403b34aaad9eddc370b6715b605c35b143355f098c0b37dd0c488277f SHA512 e9f46d482e85bad1a69cc88b4c47766dc7a250bcc86227b8a5ed54d5f4d184621e8acd52b405df10edf47d253b254a5c52dbe674fa87a75004c57e0094d02614 WHIRLPOOL e14c2110d76a3ec72eadf3fa3b19f0e0695b3321f6a928f845e99d2dea5072550a367727e8b9b43cdadf837d211aca538550e441ab018ae580c838d1250f4f93
+AUX cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch 2251 SHA256 eb5c750e910b8088ec7e7fe2fa1cf367f4db738dbe681fa41c35e989db312c3b SHA512 6fc2a0a8d0b015c852f2ee2ca8038da0e64d7388f8909f52e871bcf0a25e8b5ac2a0a163411e83c24a71445a8e84d9ac9cc6acea543fd407ac8a46eb4ca13c0f WHIRLPOOL e193fe49bfe4657caa08deda88d8d5ec9270a9cbdeb9a08279efe9571a19ff2dbcd6e5eedb8ddc473a763ae60eebf7a38bc3366959569b78a9e15c46f2f4d360
+AUX cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch 1031 SHA256 a0da8be64c575ec5a353ee33c530569c754df65cf6df04e5abbc29bcda1fccca SHA512 1948de3e7fb38517e00909f285541bcf3d75cb9c51ce7a2dfb7485346dd3409200bf82081a3a83d7e6843fb4cdbac12395ac6b9049f45201c94fc0ffa09d1ad9 WHIRLPOOL 8282dace8d2ba9d111b57b68e0116e92cafe2c070cc82d52518c6a6b4be3dcd37882bb505fcb3b01817eb577261c4f7f1b152bb12def6be52ea9c1625a15c29a
+AUX cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch 1106 SHA256 010816607be72e178c21f7b5b8fbe2e70697feb70c4d78e03b498672bff1cc5c SHA512 0081071254eebfa2f550b98290b661664c31ce5e28222d491d9f3522c4822878b50ba6f08c24e1a3f97cc9b1d437e76d50fb94939e37432d048e22825068936a WHIRLPOOL 38f09fcc2db0453974b76c12ca287718d778153496e6fe9237b92026bd6dcddf96dde69c5e406781c9da90fcb0de39327e1c4cb8ab847935e2626697e3acc9f7
+AUX cmake/llvm-3.7.0-ocaml-multilib.patch 1863 SHA256 0dcb28109edc6dc9f962c39f32efe67f4716f8169b45d13e899a5d2b88741f9b SHA512 7ecae37559602e91392473066e8e311bb5b1a04ba0c00324c39dcd4b40f28a5c57514f4774fbebb63778f0c82d62ba865e5b785efc9f4e90b7db9377e21a0576 WHIRLPOOL 4c42d612bc859763fffee629c024c195e1f0aa6c22690c29b23fcc0de4b57c95e6636c56e258ea614d11d0807034d01eea915ecfdc13ff69dc70c69593fd9c73
+AUX cmake/llvm-3.8-allow_custom_cmake_build_types.patch 563 SHA256 e2e8b2bce270eb2bf5edfa67bcec9cbff114a9f4cacbaad8d66f998b5d8b9a2f SHA512 bd3e5ebd4be947f561da8d19ebf50a31d2dcfdb2ab0080fdcf514f02ea23d411643bf5556d1d788d7f53c71b6503f457e9f6a68c82f0650a86e4b0ddc4aaa9b9 WHIRLPOOL 65ce41d820b969a0596655fe6f7e55edcb4fd16972c4608c9c2ad7ae522d2c522009b2af430185c08a007a34908470e058dae5d1b084eac1c6db2ba39e0d08e1
+AUX llvm-2.6-commandguide-nops.patch 975 SHA256 0e36fb43e020fa380230a8c6f2a79b9a19e12e857e833ef856e2b41aaa283649 SHA512 6842285e499b86581ca12fd94f5335e0dcd7afcaf0cdc5042ee8d84d0da6aba6659652eb639027bcad7caf77b0c994ac7e181a15bc609c4b3882e0f391c8cd33 WHIRLPOOL bf1212a8fd06214dba0916a73266842558bed740220d68e3447701ffeba1b3020ca4b4ab5c6d57772a60a6e09f153232f680b1e0b11cbd5d430bd9ef693d2926
+AUX llvm-2.7-nodoctargz.patch 1878 SHA256 983657329ebede731b397ba0256d729b3958f39faea64c9f7d065ab8d2a3e7fd SHA512 3f9dd34437c6dba8246cdf5c8563889f805f3c8e579190c4f0fb06f72bf5aa112ecbfa18467a35eceaadcd470544f434f319f048cb58d6631170788b10fcc75b WHIRLPOOL 63182867bf8f0bd6ca1b7d97229fd13952526d59587192727348026e8a759f1c6b79db044760465e2424851fdbdf79e4122c5bb0285b505d20f151334063e8d1
+AUX llvm-2.8-alignof.patch 2522 SHA256 a9f7add4f4002bf9af438c0c4d1ca86875d6214a5044334325a60cdcbc8a3cdc SHA512 188bdf29b60ce0f83010ef33cd28c4cb710d238fe678be731ce1d099c7df5577f51162c95e06d996e9c90535ace41fecd3eff6570214a313fe165c0945c42832 WHIRLPOOL 65dd1cf8eb106af0516a5f302a08c51bfa884e35dd5efffbbcf97e1212a6b9356c6caea4472dce8e54a5a30dc5c6ba73be29e64b1b060e63a9ce7d816066ccea
+AUX llvm-2.8-darwin8.patch 576 SHA256 6db04d9bb5fe65f8a92972988477328a7358e325abca32f30a716ff454d0fe21 SHA512 a7716ade819779bc2b8922cb6b072b85c0edef95cdc85b3b6dca18a51c7d4c48b4a8428341c2de85ac6fb0045849feada36f610a6e706eb80dfe64bb4e414d3f WHIRLPOOL 86dae6d234a8d93dd2714a9cd8ea45f7749cf1993d003da1c3a9a15cbc6e44603cd9b364a5095c5e7fb2df899d418bca29e1b50aad5ecc66829b944dff9d5488
+AUX llvm-2.9-Operator.h-c++0x.patch 2062 SHA256 1c37346b0f412556dc979fd510585f3e20d2d45319ec095dbdec37a582d590c7 SHA512 215214df015c87efa92f8896b9239e5d7385edae1f637bd837584f21a919b9be15f0608274242172c684905f080685e8de770fc16c54c42bed416e6c8e94d2de WHIRLPOOL df4a1ee6d150f95add3a6f33f5b9648dde89ace1012702e88ce5337748a0e1f826073b1b034def46e1971bc1fa5c1841d1dc2eafbf5b428803cd0d5f80c4594d
+AUX llvm-2.9-gcc4.7.patch 542 SHA256 9472566d91344ce87e235c68e4e08786c493cddb3383f2bd2f0bd5a1ef153cf6 SHA512 6011f0cd56dffb068342b0f272898218a751f077a970cca34ceaf6e3b43b0c1e7440eed1a73b925e91d0ce0090beba4d8935496449e84609123388860f92d0a5 WHIRLPOOL 4d9a8154fb0f7e2cb1498e8fa010be6f586736180bd46fe54e9b148d1a0f7ce52e4772d17a7481e45490a12dc2c10f5e6a1a7b886914206a5d3102e174cf5240
+AUX llvm-2.9-nodoctargz.patch 1569 SHA256 62f1b080364d94e528bb34f0063562d16a59395aa7f97277bba88fbd93e00b84 SHA512 3a995897f25bfb97908bd8a379249a7b04dc0d8b64aef693272b87c88eff3494d5eac0a66c786e0cc1b8d4fc6b2c555ff8d09bbcd2e29c5e6f3bfbbdeba79044 WHIRLPOOL 254f121f0a5a1974600b1240074f9f8f9bfa760e5bf34f27697c27cf65646e412279b3c523dc3ee88305f73747881c20f60258dbd90bc6a2c380dcc3000ba329
+AUX llvm-3.0-PPCCompilationCallbackC_static.patch 1046 SHA256 f197920fb1ffbebeb2f43689619d637c5102bfc73295a8edb139cca46094ec5b SHA512 29a46adf9c2205475e2fd74ce15a3094b43905f28c484961ad81c78f54e3c4d56fb4005080db7e9671654738fa25901d5bbd1f0a6ae861a5e9b6d38053a6a65e WHIRLPOOL 8ba25aca05b21e2a8a6e25f5c07aa46175b03a4233e6fe102c619b7c60d5558d28e80dbc9c0892a1ecda1e2effd50211cc145c8389e644a27282cd108671e2a7
+AUX llvm-3.0-PPC_macro.patch 1825 SHA256 e56947d9744549ef6903238653c6569b5f91a1eb1bd84ec5d69d32ce5b20d6e4 SHA512 552a6a980cb2c05b6c6924d234efdcf375d12e72829a0372d3a4754d6bfa54f022d98e08b6f286d7dd496f2e74e4f6f9e5f81994a9d183cc39a4a01170b2c57e WHIRLPOOL f40fc9c6d75d7c05c66271c74011c320e302a0502970c38312cbf57a75f06a291900e62a09e3127d0dba7f0569a89d1e35225ca4e2e2b702063c0fb4f05878f6
+AUX llvm-3.0-gold_LTO_link.patch 442 SHA256 62dc70a1d1f581b7f768ca728dcca688a741e03e64566d5f38e02e33c6372ab8 SHA512 6daf346d5fb93cb9ed498164ef42c2c565e6e4e68bd820fed54f53afea4b1a580560836cf484e370a1566603d8799c0f359f589ea99b9d920bc587145391a65c WHIRLPOOL afc7dceed1de3db657f45ec58fb6befd9ec9e79e6c55dc3fcbc26e19c5e0b9d9c0980476a34e4dabf800465a6fe57897ddc4aa1b1a1d88a639126e262bedda62
+AUX llvm-3.0-ocaml_install.patch 664 SHA256 6f451130ed8fcced98691361d33d4d44d8866e703673c293cf7f88af8362e694 SHA512 b13e26a979505df40519ec6fd859f46e3a0e8589ed29c8509ca5c737af1e94890fea2f7c7a0b95ef168dfc7993b52133d7205de228fc4b750fd84af1ee2735e8 WHIRLPOOL a5d455a5671ec1804a06849588c072c29718d5c8218c6ba4a6b7de0b7dac0ad3d37007ed8b39447545bdf917b4c8e5fa780477a28c6250b47692605be7239b02
+AUX llvm-3.0-set_soname.patch 522 SHA256 0f4fe63baa74a963929dc39359cccb6eb4fba73176d72d4a354ebf50e51318a5 SHA512 ddf1b5572d51b5af66d5d7ef28798b41a2991c1799ba091c9e6f3a64a6b1b8081d596096919c7c910ad5af0adc0c8ad02b23fba30eead994d724a334d2c9da9e WHIRLPOOL 51aa3f1dd35e085fa4d3fe700503cd348b9342ef1d7164ec3ef2627b8ed8df0764442779315720c6cd301e4c099722cf84b305717129a386fd2792751e0c20ed
+AUX llvm-3.1-ExecutionEngine_tests_xfail_arm.patch 1357 SHA256 392a5e752623a9e019106943e7977f4ba96159e4d5f45208d99ebaa5ddc340a4 SHA512 088dbadb4d27fd9317f9df077527790a817c64eff0b3c27e24a09bb35c00e3138d85d6aaf65e7dc749a120efc639e6ac8c4fbe74af73f3f0e4664fc254273854 WHIRLPOOL dea2a2ee142803fc4cc598fd75351679d761acd9e2c5153428791e0f7548b0aec0d63066f1454987fa6bc712107a6390272cceb03580808408229f6051dcbbde
+AUX llvm-3.1-docs-pod-markup-fixes.patch 819 SHA256 c15d4ec435b7b9e37157d0c766ceeeb9b1c650328acd1eee0e588b5272f9ace0 SHA512 b6d8dcdd2003060ab486a8cd4de7b36594641c15074f0642ed2db1f58cd4b55e327a5bfcd6344a7d987ee38f2b4f5ce79941f5658a6fbbcf851172991ef4b883 WHIRLPOOL c37650b8584698379efa5b76e2c02b4bfb30d086d5729754ea668ca8e7cf99a07d795bde132085a89cc926f966a97f68c0094313ed6d895040d429ccd7923fc1
+AUX llvm-3.1-fix_debug_line_info.patch 2620 SHA256 db1f1aadebbc4c4232bdad49fb9b7dc61eac727085c63154b870fa9ce64fd18d SHA512 0b8bdde081dc7eddcc3556a0220f0a47565c6b95afb31560a835abe630d641c43e3acd0f0d0ba177809495f3208c17aa1a0fd267da3a34d71039c846b03253e8 WHIRLPOOL 47decb374e7109cee7eca7ccfcae5a2bd01a837d9daf6d201f20eb0d2ded14a66e737532c033ca128b049557cd0977dee811a4c54c15036e050d7383c586b5bd
+AUX llvm-3.1-ivybridge_support.patch 405 SHA256 cc91a69be3d0f7f216a4d0484284fd054d4b0273f1c4dda7afcc005564867725 SHA512 7ec84a127eda4cbec0aaeb1e34f0606ff76e070bf1f3eb71334219b6a2e21299f30f157d022952e6f23c5e4180903239f5a4323f214041decd4ccc21f1a285d7 WHIRLPOOL 443c57305f1c9676e7191042c0ab7491a2a789433e32b5cc12050cece38eebe9ae62fd1d54200fbc32d2c7d22aedc7f6776fd250ae53e7d2afad0a325c1ba919
+AUX llvm-3.2-nodoctargz.patch 1761 SHA256 e17494aef638d2fe3fb0b669516ffcc9e560161903e1e165de0eecba684c8c1b SHA512 d12a8996d8a1160f7bad4ce3b3a9ddfb2d29d91fc160876c145f9241927b0cf4413f3b29bc2bf291f0421f61a512de8057e8f3d0029a8a09ba3f1d93582723b5 WHIRLPOOL be273271db8293829a63120cfc917711c99d8893cae6f95af2583def735131f629ee67b5a1515df007477f34abeaf5f2729d689eefdc61eb3aae6b1959971507
+AUX llvm-3.3-R600_debug.patch 909 SHA256 84ebe63a557e3734dc8ed4545f098e2496d815e6bf4a99dfcb65d649a23d2c1b SHA512 cd1b92c713edf895ab7a15494c6092e44082b40b9bb5b0fdfdc438e919456c7fcafab9a840adb165c191454948c0b42bc78ce2b4d2cfbdf371917b16351c6928 WHIRLPOOL 0f08c58c78c1d04b8e701b0b817956a37271115c1fc83ea8f0f54bf965fbc659e418abf7f429c2a29581351050346cb783f0aa9147757d4cfdfa24fd8b28d09e
+AUX llvm-3.3-cmake-modulepath.patch 916 SHA256 9d0a00b543c4db58cc65bcf82bafd0aba4747c559f19fd96af1b52a3781f75d0 SHA512 610d1397d35e6502b4b7699399d41585724845f93dc88cfff8104318570b29ce25f99575298d3263440ba57859ed9792b1fed951ab4bd30ef5e1e1c3ec4898f9 WHIRLPOOL 808aa0c3b744c0c3c942cbede312ac8ec2af7404362e4bf8fd0d408e9ffaff90453787816575dcd6a1cacd406818aac5618b2bc5b5a2b4b3817a1025295f264f
+AUX llvm-3.3-gentoo-install.patch 5321 SHA256 4f2e80f5567227e3539052a743ef0432f108d76e6fb9ba373dc51dbf159e0410 SHA512 90075d4bb5bdefb76bfb191dcb1b618de464434d9d084b2f99cc5034d33b112378f9aae1d289d30a2f8926132c17ea32ba1bf4049c3a61a418d37f903634b259 WHIRLPOOL 39b3ce4e937985483be7b4d19a37c0837b3c27f308f09fe8aee185b9fb43782b540f6b6be042b8f6dc4b5037be64284e2e233e65b3558e4b4eb1095a7d586a4f
+AUX llvm-3.3-insecure-rpath.patch 881 SHA256 27d893e5f551d245f15c01a94df81dd9ad069c2a980cf6a8860fb429eb37a5d8 SHA512 f03d1f522d0153fcbef677bf85202a6ddff408362d9ebc3e4f9f21814b43d28b033b0efb3ee86f5c11a4ac3a91b8afc80d022bddcd839ba503b29cf946e40218 WHIRLPOOL cfca8d189f88c0e26b4c3091db6c4267a90307c5728e64ee3ca55272a884389e56ed186904d9d66b44b870792eaae049cf6e66ee38efaf757655a4be4a0cec6e
+AUX llvm-3.3-r2-gentoo-install.patch 4043 SHA256 a8e24328888dc0459fb5c24e244c30baf7f8ec75875fc7293f9e1029d75fb1f2 SHA512 f829d9f8e0d5730a8221a8be9a1d87c7c79a09f498f00d5f9cb7d1172dcdcb2ba1b68b8b5454225dde230d642240d0f647439f34befa23b64156b2f7c2247027 WHIRLPOOL e937127359c474bb843cef34116d2ca8651c4d22ef7ebfc8cd2a22537e483cfdad7e78c1fc4a7d4bee92fa19995bdab9dc8b7cd96594f114ddc9a6af4604ac63
+AUX llvm-3.4-cmake-configparser.patch 1182 SHA256 b5d61e4882e301b361321c3bc69cdee6398b97bbb86ab3895879def6e18907bd SHA512 06e792016a6d7d091a5e15f8a13678e3e59e87bef591f9340ef427c820d0112cc22b7bc9ec57c7066da7f9bca3841a558bd98c71aa7df2aa2da75e53260a5347 WHIRLPOOL 8326541d632a6d4abf8d6444384932a395b6640d8b7f91c8ab29ae9acdd11922acd7652a9e211e5ad704016744d980d0087dbab30b09cab62e160ceed2236936
+AUX llvm-3.4-fix_varargs.patch 6427 SHA256 b764d5c8e2c25aa2634834522aed973ea6ef367d65eb7bed6fca19255af80f82 SHA512 cede7ea9aec7d27dd2ad4a41eb79cf566a03c9384a0fe1b07b52bc470d97a0a54735f5e09ee78cbf2323f28bb3f191e30a6f7454967975791cd70b96e09538d4 WHIRLPOOL a238ba38b5ea13ce7a2d96d4ca2853ff563988b439e4b8dbf99fb6789d46b260469190c7ffe11d5012ca2cb77a8c2be6a95722a3df2aed841938179b219cb6e0
+AUX llvm-3.4-gentoo-install.patch 3528 SHA256 fa2de6dd186091b255832a9b5cb654edddd4c4a16f0f138357c813a40aa9a75b SHA512 e946e1fd422f49d2e150bd641bac0ffe6ea6757b2e6119465090a3c7f5cf69e17c00221bcf67a7fcf29628d93463fb1c57d0d009ff7834151440d779f2d33484 WHIRLPOOL 171f167802ee289716232e16a2c507e3b8dc7913b40df29c55a815ff88596871a1a970c891b0e9b361186cada4d8898e65920d014b4e6eb2178cc207f61bf6da
+AUX llvm-3.5-gcc-4.9.patch 1722 SHA256 c73f64311ff67534b581729b3ef0fecf452b86961c3b668ac2e6b50f1eff0bd2 SHA512 5ad0a742fca3eb9e08a183af9f90370baf85528bba6f3083d19592fe2a704950ca8c6bf9e930f9834255de3fc5832c49a06c9ca29a66e45928d9047abd9ad8ac WHIRLPOOL dac24fcb47d8b094ffa6b4403dbd7604901dd0f5ef6665a882380109584e4de815b2f277e05d44c05e1a3d22a7003075b2b2649f3f614f299b38bc6d594400ae
+AUX llvm-3.5-gentoo-install.patch 3204 SHA256 0c97173613505ea92f0aa79d4e04e797f1917fdc33b34daee05752bb52336d53 SHA512 f60b04f1fc7798f7869f3d80e4c163086c398e01b81220d60ccff42be5899fa036d5ab95257933e89e4c5efd04267a09015917c6a617b86b82d7ab4f5d0de221 WHIRLPOOL 81ce5835b9eb1fe1b162f35d6e37762cc8d613e67c5791f078ecd0e354a87eb92e52452bd6e9a7f70953dabea99d197786e87ed64dc802223149b8e97d6de265
+AUX llvm-3.5.0-fix_LLVMExports_cmake.patch 1563 SHA256 924303a7fa7ee46276eb2984e3e2d9304873df1d63c0d878371cf98b4094aef0 SHA512 8e8c3ae2c8e2bac0d78a7f572ccfae9cfc30e52ffbfa953596c075cf6adc4e5881d2b80cad4d87bbf1de837d88352334bb51a331adc8d8db74354945c036637e WHIRLPOOL b525bbf3a7ade5906e9e35315af1ccb50c4392e1d104c516927a3ab9b627bc3d0fcf41bd0b77093f6743131f801d37d53d1065371e5c86eb4e7d538eb969b3a8
+AUX llvm-3.5.2-gcc-5.1.patch 516 SHA256 c964eecdfb0cbf4d2a59a553d7bdb3f16e70d8910e6aa7e9c768828ecbdfcea2 SHA512 dd12f9ad7b80625477c5af045cd16233a169c67f62bbc1fa1aaa8b0c975b585b447fcf0773e2fc4f83cc767967fd5fd3678527e447fef66841f40d98927ec4b3 WHIRLPOOL 628021a89d48b74d302199f75a827b89d8fa2ce6909ecba93f5dd64f584a6dc215a0b3cb6b46267d1fd7488594b3ca64de44a867905949e61ae5552cbb30fc82
+AUX llvm-3.6-gentoo-install.patch 3169 SHA256 318288e667623e22c441f7a1da8c3e27b3fff7426839a58a05e43dd0ac37d443 SHA512 9e13fd8606c6aa636d5e1cd3e32781fa4cae3266acf306f5c38f052a7520fc4b603022244b4502045d968c9ca28292539a17caa33b9b470353adfdbb8e159321 WHIRLPOOL 8f3b9b5150d2a29ba4f94a86235d12cf96c1a28ceb7f55fe7b90b3e5e074fe4883d449ac34cbe823ccc22f1ab8b3e2d05dadb39abaaac0a17e3870bbba1ea14e
+AUX llvm-3.6.0-ocaml-ctypes-0.4.0.patch 1783 SHA256 3beb0718c10b57b125809d4de991b24d53618469119c652120802b584c7de184 SHA512 8c26e55939c82cca0f1ab9b276720e56cb8f22d1bfcffe228636d18feb3a51b62c408a1fed762d91430137eb231266df4038f88585428dd5d0af19de3749549e WHIRLPOOL be72dbe99b852cd85e1312f8c425e69a09b22ed6d3f5371e8b1ac9697cd2555195e0e36ae4b0d47fc4ee9d77ece883e4668e1c30da30c530bf7fdabfec827a8a
+AUX llvm-3.7-nodoctargz.patch 1903 SHA256 6364b822c82697b81bd37db63e059bad26c6e825bc47d894dffac5a3ff28098c SHA512 6fcad8138fb2ab19694bbc92e23c3b34579e5f15dc31b47dd4f0910325b9ec457913185eb78d8f68ae96fca6f48c3754a74de9b3185b25ae25efe41ec5d3348a WHIRLPOOL ce14af312aec1112e10bc213e4bc27f52d6a82aa0b08e3bcdd633795c5f073af2bb8f8e4f6386b22bc6709f654bd1df401303a475730a29f2aef8f9b4fc42342
+DIST cfe-3.3.src.tar.gz 9425539 SHA256 b1b55de4ab3a57d3e0331a83e0284610191c77d924e3446498d9113d08dfb996 SHA512 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc WHIRLPOOL 8b97b527f19015dd3283b9e174615170e639793f64c635ccc4ee4d8216f8de759fd0121a8ef3513fa1c6ad19b31aa3529091ffb44a01ee858edfef400881596a
+DIST cfe-3.4.2.src.tar.gz 10612313 SHA256 5ba6f5772f8d00f445209356a7daf83c5bca2da5acd10de517ad2359ae95bc10 SHA512 e01fa8e312e9b3b7b3cb572ac21349161aaa50078ecfe7bded273b75db4a0c44acde524f8fdfcbeec54c61eeeb8339e9917d1f205a8fda18e34fe7ccbe89c36d WHIRLPOOL 153208b1a60bb5fbe92a7162cb26bbe70d591e7db9dcf06fcd54efc539bbff0403ec88e64236969c9f256e5586bc333840bd6178fd158577d6fe228d9edd4dcd
+DIST cfe-3.5.0.src.tar.xz 8233432 SHA256 fc80992e004b06f6c7afb612de1cdaa9ac9d25811c55f94fcf7331d9b81cdb8b SHA512 b26a5e2cd81c150607c23b22fafc0d9c7f12b83b45e476b8e75bf5e99d42be7c98ffeac7349df664f01b00900864a01429860b298e48961861377a4b2daf3e49 WHIRLPOOL 5dd8b6fe97933b74f1668b1d753c16cd3bcd05ccf72aac1283aa449caf93f5ba88ae79e7668f7e79b554e1421549a87af21c86cf92657c1b4d77744165718ce7
+DIST cfe-3.5.1.src.tar.xz 8268140 SHA256 6773f3f9cf815631cc7e779ec134ddd228dc8e9a250e1ea3a910610c59eb8f5c SHA512 bd904586f6155c05d2f7ddd05b86c28feae883cdc60e2cb3b48d4ae0ce55916064bcea414a46518d0fb73618f18a3f3fca6cc4cad81083428a2221299f5c5c7f WHIRLPOOL eca619b84ae6dfbca4b3d46601419d2c5a0cd77d643336c560d4bc358f4a2b0f7123d3e87248119c3e447143859da20b9b2e94721ebb14053627f0a158d843f5
+DIST cfe-3.5.2.src.tar.xz 8268008 SHA256 4feb575f74fb3a74b6245400460230141bf610f235ef3a25008cfe6137828620 SHA512 2ad9a7daa8e62cdbf47b001aa6b937a06ae7e6396dcd1832797e2d98036522443ccfca9f1253e16d531a99d1edf237fcd2b457c55491ff68ca4534a2396ca52f WHIRLPOOL 51789ba2a3193d404b26d26b999fc47f1bc4b56b45048078cc51e4ff5c31d834d360ee0c2d16096c060f85acab6de9055dc375569348ae3307e4b280406f2d9e
+DIST cfe-3.6.0.src.tar.xz 8640776 SHA256 be0e69378119fe26f0f2f74cffe82b7c26da840c9733fe522ed3c1b66b11082d SHA512 dc137bdf9c2c5adb25498c995f0b944016699267156a595cc1fe6127f6961d45162275023d194db42691d80fa8fc74f56abad9c145ef1ff492881f547ca76cfe WHIRLPOOL 0df122c9d32dba5a00a97bec4a54b7b7bd8241ef625357bcf9997e3670e7c4775becec971f572073f3ffad86c7ccf616a94c06926ef9b0528248e34958e9b43f
+DIST cfe-3.6.1.src.tar.xz 8616132 SHA256 74f92d0c93b86678b015e87655f59474b2f657769680efdeb3c0524ffbd2dad7 SHA512 a96944bccfd9341be7adafdcc40367d458e85e7e74b0d2f3a7ea18edf1454d04a232c2d0003d6449c52f81d1e235b434acc1bb63eb5f7d16f8f4a43b70826743 WHIRLPOOL 1b4b8bb33fc7dbaeb03f32ba3544580bf0424889705b9d5130127be4d514c6d2aae5e224d71e20595a31441fc4bdd7bbf647e99e57d2c1e17fff3cff9022faa1
+DIST cfe-3.6.2.src.tar.xz 8617576 SHA256 ae9180466a23acb426d12444d866b266ff2289b266064d362462e44f8d4699f3 SHA512 ed837c48f38d8998efd675b56477c8681dcedfcf3f71bba65930f145501289bebb6fe6a6d9de336548f94c381d016b99f10c58e046b885449755d44ac782de03 WHIRLPOOL a17419cea329999c8662c0008dbd0391ed5f52045d0175488979e7620f6a9a21b08e451a5e21d3bf944597bb37934a8228fa89c09d773882359822d59bd447a8
+DIST cfe-3.7.0.src.tar.xz 9147204 SHA256 4ed740c5a91df1c90a4118c5154851d6a475f39a91346bdf268c1c29c13aa1cc SHA512 099d34cb019ea548c6ee85efd22b150beba0aa92061394fa3e423b1ebfe4a5c98c0586e5d56fc5c39e2b1606d36db59f442c056cc59473e32df76c8790c9d0ae WHIRLPOOL 1078d962edfb1b90044f19921f64a28c32259e34d983ddf9f9c198d13c8cd0679778a640d7a06c0bf1224d982602294c79a510034276216e3a6de21c739e6c39
+DIST clang-tools-extra-3.4.src.tar.gz 230729 SHA256 ba85187551ae97fe1c8ab569903beae5ff0900e21233e5eb5389f6ceab1028b4 SHA512 9656678acea490fd5674b2d47ad30ec69e5aedb450924e566a90418c94ce6483faa254e7dde0d5163cb0643153113d27b6b000fea7bba08f0ba55741b35873b1 WHIRLPOOL c41ec11d0b88678c56d77d285c4383a39cabab16aae8a4457666014e0927aa4b04cf77e73af0275e6bfc603a9531598eca98ab61d5d81288e2920682088d9eaf
+DIST clang-tools-extra-3.5.0.src.tar.xz 216256 SHA256 2981beb378afb5aa5c50ed017720a42a33e77e902c7086ad2d412ef4fa931f69 SHA512 5ff2cc5d143b78fbe6645486f02e50f738a92aaf6b8e85cfc6f91e659684686b12e61fc8f00b814b4372c5ed2c2b1be5eca61ea696fbe074b815877b799534ee WHIRLPOOL 10b5afc550fa6a8c33739fbf9268e934732b2892842d398152676e66ab90aed3c6e1bae02bc1b8aa0a9a917b6b450f60950317a9eda3f9e377971cbe00164b11
+DIST clang-tools-extra-3.5.1.src.tar.xz 215776 SHA256 e8d011250389cfc36eb51557ca25ae66ab08173e8d53536a0747356105d72906 SHA512 eefacd6857584c9a3186815a7d015a595f32cd926f6c221245d388b8cb9266c52e0980a8e94f01f49c452510fdd42e659b02f116619d3d0e35170566f0704712 WHIRLPOOL a3d14e21f201cc02649833edd67ba04f17c88486fbf399327dbb76d21e151b956a4f58cd7446b8563f72fa1cee06a8bd4abbc53234761a3a69fc1afc99ced87d
+DIST clang-tools-extra-3.5.2.src.tar.xz 215804 SHA256 f21a374d74b194d8c984546266491b518859b5f12ed9abd49337b8060d3fc004 SHA512 6a8e662d2704147296c13626fbc5885911c646c67404f12eacc67ee2995221445bf4f6122b271b9cb3a56b716f550a651024822f72358d400b9052bf50423669 WHIRLPOOL 088d2725a88a439a1a2c4048e0eaf540587078078bd1c9823a4804200265cab4d32606abf5e72be76da45ea4aa6e7a7201a2bdbddc78d5f9e0024b0d7b59e222
+DIST clang-tools-extra-3.6.0.src.tar.xz 248688 SHA256 3aa949ba82913490a75697287d9ee8598c619fae0aa6bb8fddf0095ff51bc812 SHA512 52e0cd3cce3047bb98d52e5c03ac4a8c549fcdc628f57492727f3e7659b2d4bd29ad98ab4ebab387233911fbb098861ec020b28c051e6b2c17d73dd490beebf3 WHIRLPOOL 423f018a2943d16ac605d36bece61046423974c2ffbcc7e4a9aebc5efbb2444ecead70e46bc05f51f4fedbfef338d177b5b16969e8fb0df0bbc911200ce483ae
+DIST clang-tools-extra-3.6.1.src.tar.xz 248592 SHA256 f4ee70d870d550a9147ac6a548ce7daf7d9e6897348bf411f43c572966fb92b6 SHA512 3273f8c1fa1683de231d0c0b9371d4b7537381e939fe38996e70a8005a1e6185da459ace2f260fad41df4840b459448ed1498c2fd576dd560005117a54e2ccb9 WHIRLPOOL b35c2118efff758358ed9945384218327767a48ae18acdaf2233a5b97e1dc5a682023ddf78d989d1278119c277aecec596c37c5dab8ea2b16a1c9348eb40d9e6
+DIST clang-tools-extra-3.6.2.src.tar.xz 248624 SHA256 6a0ec627d398f501ddf347060f7a2ccea4802b2494f1d4fd7bda3e0442d04feb SHA512 1b7710a7deee30cefb6a3b4edb026a96d8935a0c6f3056ccdb7a45564d10baf01a4f6722ae853ad9a3bad17e8de32a3c0ec99c5cf6144647a5e182809d403f7a WHIRLPOOL 3dc8888c302bac84f53b673784dec092a2c59ea2985d9983e87f057b9aa7b5d3e34cf13d2b0f1f60ea44f342b8167377204a510036872a087037cf02335c19cd
+DIST clang-tools-extra-3.7.0.src.tar.xz 276628 SHA256 8ae8a0a3a96b7a700412d67df0af172cb2fc1326beec575fcc0f71d2e72709cd SHA512 c266eb327e2f50767b7d37c9d5713d6c70f590b59e4fe09d997f2eba0d54c9229ef6c8a2a903196380f67dffa7e35ebb47a9e5f2f097fd2a3c363481b72202eb WHIRLPOOL 681a5c14301990bb945e26375d0d31fa22b795101f342bcaaeb9d3e015c0f0f6b260b913388d086cb3054fc357845b34a6813e34614cdfa0de2c58fc6db7c64c
+DIST compiler-rt-3.3.src.tar.gz 1568034 SHA256 0e2f3180d6316e6c43f064fdd406c5c6515e682c5f31c57c28335b68c7525423 SHA512 3e86aa8ab9810b4fbac54a40fc93a717a55c642520858c0db215a5324c1e495b4d8fcec9620251cca8e4e5f9afa34bc14364d7f785880a0700469d0201827929 WHIRLPOOL fcfd06bc860dfd901a7576cd4309f863e9d4363e36ab4c67e9e08fe3c8a37d627ee95eb96b9ed53eb6047dec06e73181b3c3e1555b1b49f1e893e6382f21ddc1
+DIST compiler-rt-3.4.src.tar.gz 1858593 SHA256 f37c89b1383ce462d47537a0245ac798600887a9be9f63073e16b79ed536ab5c SHA512 70efffaf12ff7c15befa87ce808489c6f6b6eb421d0ab5d8ecd525239efc8aab850c7ed34b31a993ff5e499657b72598619945cc4461fe3e5359e9a94aaac0c8 WHIRLPOOL ad558b5877a01e476d30d2757959ab04be0c385b2fe3442bcc578bf36c6f3214cd78b4adda24fcb1f3b2b84353db213b82e8d7d4c40e66c3f57aed3a49322dbc
+DIST compiler-rt-3.5.0.src.tar.xz 1088352 SHA256 a4b3e655832bf8d9a357ea2c771db347237460e131988cbb96cda40ff39a8136 SHA512 862cce2d6b398bd1a8399496a547e6ab976a31f676528beebfbea5fd7dc54aa72e1c25deefa12f6167096521eba74090565b0168806451da02ddac04e922fc48 WHIRLPOOL 248acf997d70d7904aa79bf83e0c02ba4e5f8c2812c03f44a8e1e31b845a654f250c09ec6a123f9245d0db8713e8cc5a4087b9ce785af4f5eb7e55d9dbd362a2
+DIST compiler-rt-3.5.1.src.tar.xz 1092452 SHA256 adf4b526f33e681aff5961f0821f5b514d3fc375410008842640b56a2e6a837a SHA512 3a4f093972b080f439c81c8b08793c311cea71afeda7ba7b4e32f19378b1cb420da7b594fa9f6a6f7826570438f67d42d3243c4b3503e1cf8a7dcedf52e8e590 WHIRLPOOL edbf11837139b48207fc6f82ecad39fbc6983cf5bd1441cbe6d50e5e484566b63c5afa2fc64cd29fb8560f07015a98c00b58c926ca7e9af47b7eea92133d0db4
+DIST compiler-rt-3.5.2.src.tar.xz 1093000 SHA256 542d7aadd21e7fe35bea0a7912bc965f08a1a566746cebcca76f96dcfeb74dc3 SHA512 319a8a1dbe07eb4f1fcccfe79a1fa445f348fb854a441500e89fa0a128e45716b65d06347f19a63de32e9294cd2331e914ae0d5fe8224f0b2452c39b79ac96ff WHIRLPOOL 6e9286c56a60a515006c8232ca01622ae844185a5f31fb49bce632868862c5e560619f1c45da66878b5322a764f91a284cd296e9f13105d6f74e055a17321d93
+DIST compiler-rt-3.6.0.src.tar.xz 1140616 SHA256 7f49fb79e5adcdce7dddaf973f1db130228dfb19e37a99a7f5365a6948b26b11 SHA512 2758bc2b78dcfb9b6509b83ebc4ebc86907ca3dc2a5f151f580771c674b934432cae055e342ed73096a08331b2f7b129ff65629b27932458b1877aeb554b6328 WHIRLPOOL 1836b59c2369457aac79dc113b9a76623da30195a460afd0e25997aa21855991cdee78d5aec12b45d05d7d14e42d5fc7678f1c169b5a7fd500681a34d02d4468
+DIST compiler-rt-3.6.1.src.tar.xz 1128460 SHA256 fcbf610c77be6047f11ca10c4725610417beba832565115a9e2fcfe2897b649f SHA512 121c048fe60bccccd4a188a18613c94e1e1d9abd8fbae6405d23418f0c9b3562fff72fe77aea9bc0f8632ec9ad89503b9c67fcab5bf378001f90ad7492a1845a WHIRLPOOL fabbf5a63734f879d1698cd65846beb1cfa8559009b37bf5b5f4e239e62c9a9014d484233674cf357fb7aabb04ac8df840e832c764caf4b4a3b662ff0a51115e
+DIST compiler-rt-3.6.2.src.tar.xz 1128080 SHA256 0f2ff37d80a64575fecd8cf0d5c50f7ac1f837ddf700d1855412bb7547431d87 SHA512 7dafcc5bd4822475de649d8a84ae51af3c4ed4d0958f76b1b55ba79219638f3e78eb94a1986c6e9ba0e7f1ccf3ec834d546b5ca60e8b08083fea5880ecdf17a3 WHIRLPOOL dd77e7df43c9028a6873ed903da67560fdb04968013016a7f0ad2d2e9a81b3a3d890b95e4f49a6bdef349806d6507defcd80a0a9fb50c1c9f778e7eff42dbc5d
+DIST compiler-rt-3.7.0.src.tar.xz 1192832 SHA256 227fa998520bc94974a428dc8e7654d9bdf277e5bc70d4064ebc05691bd62b0b SHA512 2ba6abb3d6ec7f1469cfe1d48fde2069e9a767d19144f80f05516ac63f353ace90a9df3e9d1c1f708f3c397aba0ec61b12e4f105b25a2e1cd26b25b0dd252bc9 WHIRLPOOL 8bb535b667a7fdc1710d32e0912daee3798049f78cf70a03abc409157f02602b77f290b66185a35c464e512e55d57aab0125be6ae4843f6233f4017228afb579
+DIST lldb-3.7.0.src.tar.xz 10649660 SHA256 f4d7505bc111044eaa4033af012221e492938405b62522b8e3e354c20c4b71e9 SHA512 52157782ef13e2c8b7b35ff3ccc05887195fe46ddb6bafcf0707a3c46c1e034734b55342b8dbfc46cae7a8c3cb1012345284e4bedb2344c5016b8d19a12e90df WHIRLPOOL 8c0803a51820ec67944e27061c858e95a92aefa38a1540241fead2b63c5b065c1268cf958b14d8841f62fc8aea5da1e20204704426598bfc2c4e61bcda135c43
+DIST llvm-2.8-r1.tgz 9112527 SHA256 25addb742f1c6cc12877ed0ee924dda962d848368ee095be8e48342ae613d43b SHA512 8688d5cf415e8aef74cca6a14587af36234a6347e2238ac2c0d66805c42926b9399f36390e1a58a4081e902b0904adb818c1a360d5df572dfa893d6f79f5e35a WHIRLPOOL 0da9250e31242b55586c9138089e742aab5d414d5f3412ebf917ae8b9506f984c6134a932be93ec7e4c01c79f6c21d508cb0b2e0ec283419bd4ae4db745430ae
+DIST llvm-2.9.tgz 9574781 SHA256 661236cfa17428b48cfa9cbb9909f7569c64b8ecd219fd91dbc00e3b557b3779 SHA512 9cb0fa0bb8ac02661fd6f926001a15e0ad4a9660683421dc86b03f1cf5184142c5815f9f9283ee7cdf8d474e01177f83406122253342e0e95ddc878821660070 WHIRLPOOL f7b445b6b5d455f29ca68c342511b8b5e6eedec525af1cc60440c4de544df2332aa241bffca29eda5d2428a3f518e093a626bd45c7f8a9e0656d0f68aef5d9d1
+DIST llvm-3.0.tar.gz 10350539 SHA256 519eb11d3499ce99c6ffdb8718651fc91425ed7690eac91c8d6853474f7c0477 SHA512 602bb5590b70cb9138bc19d8c630c62bbabdcb2132215c921fe4bce4e3f74dfc66440b9dcd458ff55a86047cc9cc0417c6563715c133e0db222e4b88f07c13bb WHIRLPOOL 6f4ece3ec747352cd78b08d25c5b1cda91140eb6957d509161e45395e47c074f8d2102bfcaeabcdef8c1f6672f2cf06d88e290667666122da029391b3528d440
+DIST llvm-3.1.src.tar.gz 11077429 SHA256 1ea05135197b5400c1f88d00ff280d775ce778f8f9ea042e25a1e1e734a4b9ab SHA512 fb941094601043e405ccc57473414ef92437b09c200e71614f93d8e93b2a58cca8d78c385be037e064b0711cd6268802c774ce4a40fc0ea17bf576305304d2aa WHIRLPOOL c5c72e139296e1c186131f991010f52f958063a4fcfcb1f8527b53a2aaa7edcaca70ab6cf86c25d08640dcf6d720a865fda7dc7eb06cf1ce9c23fd37b5d597ef
+DIST llvm-3.2-manpages.tar.bz2 25962 SHA256 159eaaaf59a2cee66f6aa0bbc93ca4c9fa37a9a25d4116f085556cdbc32f75ca SHA512 75ce41827f99b9e08f0c3e374c49f8a231653bca28bea158ece551e5934bc61ae21bfaf158490f83b05c1a7926b95c8832c0eb023280dcafa671e7d551efa17e WHIRLPOOL 58382b3e92b2ef8b1f5a7ebf2d893852253976b781b2b2acd11dfd914fad9776f59ddc5559d3986832a00fde88539db6a5882aa69a6f3ceca90337a59420acc1
+DIST llvm-3.2.src.tar.gz 12275252 SHA256 125090c4d26740f1d5e9838477c931ed7d9ad70d599ba265f46f3a42cb066343 SHA512 cc66171322dbbe40bcac0e0ea5b09df8ff52df63ded304f841f32f702270d6ab1512216413ee52498c3ebee8cd39c4cd23e3855d591944bc2ac0ae76f5be62cc WHIRLPOOL c3a39b2426293d0251b7769607ade873bb6bf8d54e7c8055773a9b75742bc8e39049fb71409a258c6f3d98775b78c280d4bfe4223ba91e5ed6ecae0eddf910e5
+DIST llvm-3.3-manpages.tar.bz2 27098 SHA256 46bb22d63d5fe7dd04e1a7bb7e16c03d93f2ed51d31540cfb9d97ed70059aa77 SHA512 6f24b66b13025d0606908f91ad9b4fc6de1b4aac2d97d261f6b989065476cf153d2f84792f8dd4972b95fb1a45a3931c328df3bcf8ce5ab21170a7a912a39783 WHIRLPOOL 31b9c3635b698f404b75b87c7891b4b6be9cbeb6062bcb6fba5476b0b3069a486ba60c27ab2b12b8a2da9404f666617162041860f023951050a9fc4c7d27748a
+DIST llvm-3.3.src.tar.gz 13602421 SHA256 68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 SHA512 1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 WHIRLPOOL a89c0b470fde562a3402e7878b91bc0573d433ca0a60e62c9c46946d7948a4fb657b116b6bac032555e29c70d82c751876adb398fe240f5c8d0a9a2378ce1866
+DIST llvm-3.4-manpages.tar.bz2 33753 SHA256 dc2616104cf333dd9ef56b2d31f9a36e81303e2c5756ff8bc221e05b46f7e1cb SHA512 8e438a9392c9b896ccb2b1460a8f57ffa01633e3a6bba61e2bf2f718d970ff96c17d63b0bc0d4da1162e1d1dc4cb9b2a9e9a14a722e8a5b5d2f205f037ae665d WHIRLPOOL 1c037a9972442937f84bc3147d77d4bbc6d6c0812c3025f3107c2ee5f6259afab990f6e1bca564237fdca8089e2372df4b7ca45cbdea686fbf891f92d1bfbbe6
+DIST llvm-3.4.2.src.tar.gz 15938155 SHA256 17038d47069ad0700c063caed76f0c7259628b0e79651ce2b540d506f2f1efd7 SHA512 6c1453f7d9d9110257db3574cc4f6227fed8938705cbb09851ac09a868089b48f1556a1b6e758aff6d97520b08b5605d3ed20411ad9dd22cdc573d62176905f0 WHIRLPOOL f8b4d5167469e6f350ec41aede04e7b756e18f3d8e78b3270beb5791310a7b9b13c69e57c8bcfefbd0a78efc0c40e3b75a9a158eac72c025b7c77146e8dfaf7c
+DIST llvm-3.5.0-manpages.tar.bz2 35314 SHA256 724e752a60016dce8cc536658906d3646c600e977374e0ea692a5d0fe2d4a021 SHA512 d99d6096d7f21a81923297584fe5eeb23e0d83d4538fe376615c92fffc8aff3189999f7ab3c537b5aa5d6bc2c22c53eb05717d48c7ab99c42315b8665bac62c3 WHIRLPOOL 68ced06ee6678c5333c662eb1cc0da744c5a184b12dd059c1b77ec200b1d3cc231f270b9d9b6e177d728776894277b3f9061338aa55620c90474eb97915b7819
+DIST llvm-3.5.0.src.tar.xz 11735940 SHA256 28e199f368ef0a4666708f31c7991ad3bcc3a578342b0306526dd35f07595c03 SHA512 b4d0f325dbdb0a8f10e5fd031954ef4b1971d8f99f4e4b53834801a2b74a7acde3f77c655c8355b407424b363edfb10f71d85fc370356dc52af5c636a1bba197 WHIRLPOOL 561520823468b61c63df8e13f876b7ac586eb1e52c256e9a36370e5d46e8cef3937655c36fbb51eebd3680fab67412e7c777479477fc728e7a8f35420e573ef1
+DIST llvm-3.5.1.src.tar.xz 11869356 SHA256 bf3275d2d7890015c8d8f5e6f4f882f8cf3bf51967297ebe74111d6d8b53be15 SHA512 a643ff173627e813b26077829b1af801b75daa5dcea540c4f05366ed57ef6aeafaf8b3fe4208d4c1b303a048a90ddac48a23488480c165637ae9218de140ae55 WHIRLPOOL 798ad46bc21570d8e5b0caadf2c0b434382fd78bfea5a08097fa001019b749b828e56ffe330435e5f3556700e8b0bee29e4139a7ff6b2824bb83dcc8caba2606
+DIST llvm-3.5.2.src.tar.xz 11876128 SHA256 44196156d5749eb4b4224fe471a29cc3984df92570a4a89fa859f7394fc0c575 SHA512 0f6a83cc61a385387e7baf8fb8f0d9f18e3fd00d2d389a3c7e2c3792be7d82ed095506cac52c24e65ae3c1f94456a441d39440feef6125e25ef18447ec9dd406 WHIRLPOOL b41de51907d6d2c2d04a4c498b44f0ed560cc710e6e2d8678f5ef93a9009d140bc7c2406f4b25d5b901fd026689d48edce77a2e435687b489b835156a512e256
+DIST llvm-3.6.0-manpages.tar.bz2 35140 SHA256 53b14a7896f6db547fa692b43fb5b08898b251699ec505a2b9d9c9c3b632eed7 SHA512 2efe21ecaf10ced3e078e7675918f5b7fe6cfa3ba6371906f832690858024c57f4868a3af54b6de18c980d6008992d08ae21bc2a678ef12652a0a0eabad52a15 WHIRLPOOL f6bfc9ec0432566b70ab16aa99628a64e0d9f325db72a37cb1b04d6a3521625b37b858770ac1c9e313612d9475d7832f683fbbc2c3acad97c99daeb39383df45
+DIST llvm-3.6.0.src.tar.xz 12750908 SHA256 b39a69e501b49e8f73ff75c9ad72313681ee58d6f430bfad4d81846fe92eb9ce SHA512 ca492b7d86333f05930dc849c7a8beff981da51ca174cd844650b516d0a592a2c3837d5a8a9b62713c0f29292b845f27ef0ec361809e325c6b60cbbcd3f20357 WHIRLPOOL 4f9de6b8dd2514e7b55e8c6e6af2ab9d355ebf49f1bd113a652f71809d74060792a95f6cee5b8b3bd64d92586b46e7778f616027702c98eb726ee84375e4eea6
+DIST llvm-3.6.1-manpages.tar.bz2 38338 SHA256 b27c6198e09b11421841a7184d4e8a0f8878d4f1313405da28d643134a55688a SHA512 a47aeb0b4632329eaaa1d6c774446fea5822d7692d81533a9a5c5de1c6a3b37fdd6b7c1fc6433339649f4d3a53a753065e73afb30fd84f253ad31d5fb3d48662 WHIRLPOOL 022b214b6340365490915b5c873e515bf16be90d04cd32f09024a3607c23edc2c2e241d295102f045bd08a442c4e5aaf134ac89f7e59a027ec1633330a95989b
+DIST llvm-3.6.1.src.tar.xz 12798852 SHA256 2f00c615913aa0b56607ee1548936e60ad2aa89e6d56f23fb032a4463366fc7a SHA512 fa07d0fe6c527d86c0b91b1b62597f949d777e3609e4e8ca2ea5e07931e1ebc7a363273cc705cf4a13b45e7ab00716b76de26688d077c1b51341d9dd2972de3f WHIRLPOOL c6340956e9935c0e4a986f1a8da9458ca3b3a7bdff376d33c7a3c60bc5154fb5820bfaf43fb4118f28ab9b0f356f436672fd2f984bc629eeee01233b703030fb
+DIST llvm-3.6.2.src.tar.xz 12802380 SHA256 f60dc158bfda6822de167e87275848969f0558b3134892ff54fced87e4667b94 SHA512 42b44ce69cfb96e2dc12dc2246f0de8ff983a99741206e2c46ccf074b3248aaab9c0f22c6baad802de851d06f202f40db9dd62fe38aab4479b3f70026c936b36 WHIRLPOOL 1a15e16793fe4120f1c14a5334362c36db26745c493e7289281351b7c18c523d781ff9425dddfe1a2add9ea1e8aebb92f2313787da5f286259b55b0884b3039f
+DIST llvm-3.7.0-manpages.tar.bz2 38095 SHA256 8597fa532464c6336aefbbef0b1ce452aaa98d474fa58108c6a6f57a9ccd6785 SHA512 ea70ac15dbaef3740b31f66aa798338f7f9b82484586582aa62e0364f9d74bf175be2f4f29721df253b8157c1cbc146ab9045c0656c42a6375434e994786b643 WHIRLPOOL 743b339b0df7c52d270a5197e9e765dfd92d4b5acee94cf9d9d7713e1a75aa9d987b3f5adab0952e7267febf88b318d0f31cb45847e2b0b42c7c7373b2358358
+DIST llvm-3.7.0.src.tar.xz 14636252 SHA256 ab45895f9dcdad1e140a3a79fd709f64b05ad7364e308c0e582c5b02e9cc3153 SHA512 fe3bfefd3d49423831ad12b89f944ac9f469aaaaafdea1dd94fc7fb6d5cc9fbe66b6463796aeaabfc145ae474ec3ad68da41c4a011e8aa4bc650f1835af75388 WHIRLPOOL 4787fc417042cbb4470887358225c367c6617ccd6cb90f1e4f226ec1565b302e4d70458fc13ceedca5b3ac270523637398bb7503c8c423c81fd9682a41c0289f
+EBUILD llvm-2.8-r2.ebuild 5300 SHA256 a791a4ff7f8ff85420170fa9534a276b8d26e99c18c73891dc67520ad76db1d7 SHA512 e3f07152eb6ff2bc3f5b06ed72f0dd565d08562d38ee3b4ae7d0805836273ddcffff56288583bf317b18337e6ec7bdfc60c46f99ca707b1cb3982e7a24044468 WHIRLPOOL 8a0c8306d49b84220f043789b98ab1b47014e896d6c96692e5dd58278a35a71587bf4a1f70f74011a87c9b555cbcbd514d2f6360a94dec192f01c2681c668136
+EBUILD llvm-2.9-r2.ebuild 5375 SHA256 5741b05e0f53e0d774c51668bb45af04d2d10f6c5edb045eae32fbf871c33710 SHA512 d3fadf51788a541fe6910c2b3fbcc334db7fa263b1c052ce4949efb3fef21c2e8293e68d12bb2d9502d10354d3c2250d40a0304aaec60f70cb2c42c8dd3aec92 WHIRLPOOL 128bfa9318d9c564e8d0908710c3eda32832e505cd298d588e528e819af628b1c1310256e6feb1fb1f834eafe3961f070194c833894471026e02715ca2193cc0
+EBUILD llvm-3.0-r2.ebuild 5664 SHA256 5ccecb7d96ac21ec8f74775c07db20966799a50430c4c1e80e61fc4f778971c2 SHA512 c1e2c0768142c324f50947d77411667db5f425a4f698f811796b365614fb24df9092e0296d332015e5fcd9b19942cdc6b7eee038a2f8ff5b584559b41a3dbd68 WHIRLPOOL a4fa7c9432bd26076cef892bfa8cbd2b4bd685636a5c6acfd124e7bcfa3d31357003c65a362f47520a10817b9a395a446acf4f12f68db4d93cd175ae2e0d6dfa
+EBUILD llvm-3.1-r2.ebuild 5985 SHA256 90ca5fac2e47f0888180ce76753e8c190a8e77c71d6271293a85f99a0d23e33e SHA512 2aac1ac25d11b9c5edc7f4effc00616feb3b19b3cdd4bc0770549194635c016e3ce6d4cfb5d00535fd4adad3245745ff3cf5fb1897f6adfc237eecf9d985e681 WHIRLPOOL cdb8ff9de5417a9d1221d1cfb1be14d723b154f8869c3f82b6ffc3285910cd0a7682bf5cc677d38c65bbfedb4e1d9b812b48c9c83a983d6c829c4abc0a21eb7c
+EBUILD llvm-3.2.ebuild 6431 SHA256 63c73522ff9c06fe8e4be26e785a26952e58772695e8f28dd760b811865574cd SHA512 e4e2474cb318531d04ac2e7ce3633eef9e08a884d16f96014c5122bc313ccd108360fca5d7716a37417ae655c6b85ed3e7d4639a9381aecfccf2740f55998b4f WHIRLPOOL b720db9a25a1d37c47abc7210cca8571dd67ceec8449b85c064c1870a81c87f58b127d181c4b39a46a56c8753b2088932ee4170e46276fb85fc3c9c63d4c7441
+EBUILD llvm-3.3-r3.ebuild 14076 SHA256 657281168023af08e823624d532cff8413a0d26792cfe96f8d772c292de65219 SHA512 a86bc53e31a9ca8f7dbebd07cef2306aa14bbaced69a728c8c68f20141531522e57fe6bc6c76b8cff2b00ca5ae95dba26b9d480d5164c84ce444bdeb11ef5c5e WHIRLPOOL 00f1420244f8fa0c5d9af90cdecbb53571980a315961ec4e6f290b976d9c7435f3dcb8ef7591f95110cc8647049c66283bbbc7a42be1ab6eadcdc9a9b964031c
+EBUILD llvm-3.4.2.ebuild 15678 SHA256 f1784d5669744298d8bc3cbb9501c1c5f6b403f3d0ff01400ab8d6179aa37780 SHA512 1772a306f891b79a15393a78666ef0602908513c550fa22041d8e19b55b0428b28e02998e0bebd90b1bda0c685b202bbef249194b4523ce74e0fa9ae363de1a8 WHIRLPOOL e9da506ec60e3f9b664b87aec5b6d15884cdfada61a99fd1bd2ae494a5c1d2c86fd98f01595a67af0f9fb3a43630dd2a2282fe1d65ba8165b83b09e281510220
+EBUILD llvm-3.5.0.ebuild 15131 SHA256 71a3c6dad11d3f52646397581e9b88c229faebcb14a0bd49f45a990b36ade328 SHA512 07b54ba55d0adf37a8c794176fc8ba1ee8bad57837b50d0ddb8b92b9a65987ff4f2f60337bc61e8b700c09b4ecb1aee7a4d424ea8d7a0c6ca403b0413c5edebd WHIRLPOOL a2cdd772dcfd15841d6ad1d7826c0821815236806aaf2d1ef051b013a0817041a7822273af04274a9de8ce6b2bb69d9c0baf33e0818adbbacdfb6ef83901fc8d
+EBUILD llvm-3.5.1.ebuild 15222 SHA256 46bee55510ab7e3e021f15e57e7f54d31bc3fd5d52c686a912fe5443d5222f6a SHA512 8aa8abf04968eb51fa1a91caabc2d1cec182626b31cea481c4168b8b5e12430d7754d57f9618edade1d5e96ee74d846b09a8cc8f63d74dedddab6c7846641fe1 WHIRLPOOL 9716e23981ad51d4e8bc72e83da45c257c2c97733d9e9efb3fed1ca76116294c0ef010b4dbc0c059fb32c9b1d52dbae22742d4313837daf30be2da2bae1f9714
+EBUILD llvm-3.5.2.ebuild 15292 SHA256 cd65a205c753831553aef88c2473fc99f7ac1b7d851af884578f7c182736a8a3 SHA512 1b0b45e02ea39621b1a7417fbc93a901b48a5a5551b6d7e1f9490a155c4d0ad98812af8fd45bb36482541268f32f36aba2663602e042f728f08285dc5ea2fa18 WHIRLPOOL ba1ba8c77bbb4b78708f69106fc6a59180d73e51fd579038547c065f23dd81794a5266df543845480652b458e0ee92b179fd512342d602b10eda8e4b727a125f
+EBUILD llvm-3.6.0.ebuild 15285 SHA256 f9dc886bcd3163182f9366952e2ba6efc55c2b798b615ea33620912260dd922f SHA512 7e372b0fdd2ddce4ad4f1814c593a6e47e1d962fa24e983d8db101251662e64ed723edee83b27d11a35de71bd7c3170ad6992ad44c770533b845d77b3ebc9272 WHIRLPOOL 7d67c7bc55c0734bee38ed3fc2dfa3677eac1a11df8d0e533f62afc5f32c55a08931fe1371b86e3774b704ba26cf08c15eed7efd5620bd387c077391e5bbbcfa
+EBUILD llvm-3.6.1.ebuild 15554 SHA256 f1f007fa874bc33f5c1cdc9622ba17badc64d03fa91f3d4b690cb8faaddfcfd8 SHA512 5f18a894cfd0f8687f8ddc0fdca4de85ddeff1f06a662e0830cfe36c6adb2add2a2871059fd78354ece0b527638e4ba08e73e22cfc05e8738feca10002bacaf5 WHIRLPOOL d851589c993b8711e62b1fe7317f31bc009561fa541da68259d812ecb3202e2649b21333fb86fba74c410fea5d1233d6be5fc010497f588f42fdcd50493fe6b6
+EBUILD llvm-3.6.2.ebuild 15575 SHA256 88b3ec82fbb47565a671857d824f53b5a2c5a1f0b3d6b472e9c7790d551d03da SHA512 8321368e71c96ddd8868dae7368c62e096bb974fba0d293c7d67a4a4ae54603ccc851232d1c216b1cd5e63ced7bf1060aed99afeeedc22eca0230ea4e2912d47 WHIRLPOOL 2355533fb2a7bc5115dc7ba1aa20494335a1b9c3cefba33d9589370acc0c368f95931b11d3efb75d517d4d0211e4625f10af2c751b51f24539ddad1a218a9e3a
+EBUILD llvm-3.7.0-r1.ebuild 14585 SHA256 020933286b03a17665de28143614f7653baf8abdad2c4d59fd4235cf1e95ff84 SHA512 fdae45263ab6ed3380479c6cda191b1b11112e3d87e858cc932cd6c2ea48dd4807a4bdc15107b1d94f0a6ef791a58a75409e5f72900c7f686f64edbc93b55653 WHIRLPOOL 7995b1936e83ff82a6e06fa877d25d3a5d8ccfd6d29dab1359e8866cf2ab09d02fa5d28c634fc8f8edbf6b1e2bf0e4e2ffe22a5b9640cc5d5d2e745fb7c8e44b
+EBUILD llvm-3.7.0.ebuild 14056 SHA256 12f9a4b1a178b193a5cab94c00f448eb538d31056d5e34915a173caf52ea0b87 SHA512 1951a8ab684aaa9de60a2a1b86534cc57ea56bf4d3deb82a8638685f09b0ff3b01c86fafeb8514d4df24892119eba1a69cf2bf99ca12d584f9eb455f3a74448f WHIRLPOOL 9ebf4aa05d6fdaf3e5fb690d75a3996229214197f057dd4695dff0e7dac49492b4b292ce0497dcd8dcd64bdc2975b08540cbc3f458350b1f412f040a6505e7b8
+EBUILD llvm-9999.ebuild 14197 SHA256 ffef165a5ff340631817283b6cad6f4df21cf78a0d4196c5fa2918e9fc390bfb SHA512 4011a7b5507c31b09eaae49cdc6488981dfed92a63f11c6f7e3e1e6608da343b15eda4f62372f9e882dbcc37fa87352ed35752728c35e9ee93f5565529382709 WHIRLPOOL 3b104d8aa520bfd967c6697661dfb4ea35c0205518dc9ac406a274d4cd79a1e35ac3ccdd6e9275cb41c7ab9dc64fb5e9d193834bd7e27ff422b0472ac628a6e4
+MISC metadata.xml 2761 SHA256 1118fce576ccb1bf73ddb832a43ce1991d28b36d9775943ad7009d7a9a795ef9 SHA512 662b95a0c374a6f6873c15f0b06a6e16a53c52cd7c231f56710a43bfdb4663d5b98d84c191b8cce06ee473a0fea9622f7dae7afa70b6461ad02b0fd742a04302 WHIRLPOOL b7d697e632ad6d9d74db8db2c8a376d71fba9ed1b90a4f78ba15d3768cd334e69271e10f21a9fe9f5224fd0b1e541ff5a743fd5f275067f847ea96bed37cefd4

diff --git a/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch b/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch
new file mode 100644
index 0000000..9d99c9c
--- /dev/null
+++ b/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch
@@ -0,0 +1,64 @@
+From e25389b66b5ced3a2b5461077dcc9a505d334e3d Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Tue, 13 Mar 2012 14:12:21 -0400
+Subject: [PATCH 1/2] r600: Add some intrinsic definitions
+
+---
+ include/llvm/Intrinsics.td     |    1 +
+ include/llvm/IntrinsicsR600.td |   35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 36 insertions(+), 0 deletions(-)
+ create mode 100644 include/llvm/IntrinsicsR600.td
+
+diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
+index 069f907..e90dd85 100644
+--- a/include/llvm/Intrinsics.td
++++ b/include/llvm/Intrinsics.td
+@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td"
+ include "llvm/IntrinsicsXCore.td"
+ include "llvm/IntrinsicsPTX.td"
+ include "llvm/IntrinsicsHexagon.td"
++include "llvm/IntrinsicsR600.td"
+diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
+new file mode 100644
+index 0000000..789fecb
+--- /dev/null
++++ b/include/llvm/IntrinsicsR600.td
+@@ -0,0 +1,35 @@
++//===- IntrinsicsR600.td - Defines R600 intrinsics ---------*- tablegen -*-===//
++//
++//                     The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++//
++// This file defines all of the R600-specific intrinsics.
++//
++//===----------------------------------------------------------------------===//
++//
++// Authors: Tom Stellard <thomas.stellard@amd.com>
++//
++
++let TargetPrefix = "r600" in {
++
++class R600ReadPreloadRegisterIntrinsic<string name>
++  : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>,
++    GCCBuiltin<name>;
++
++multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
++  def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>;
++  def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>;
++  def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
++}
++
++defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
++                                       "__builtin_r600_read_ngroups">;
++defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
++                                       "__builtin_r600_read_tgid">;
++defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz <
++                                       "__builtin_r600_read_tidig">;
++} // End TargetPrefix = "r600"
+-- 
+1.7.7.6
+

diff --git a/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch b/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
new file mode 100644
index 0000000..db176dd
--- /dev/null
+++ b/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
@@ -0,0 +1,27 @@
+From 17667fa3450470f7c89fc2ba4631d908cf510749 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Wed, 14 Mar 2012 11:19:35 -0400
+Subject: [PATCH 2/2] r600: Add get_global_size and get_local_size intrinsics
+
+---
+ include/llvm/IntrinsicsR600.td |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
+index 789fecb..0473acb 100644
+--- a/include/llvm/IntrinsicsR600.td
++++ b/include/llvm/IntrinsicsR600.td
+@@ -26,6 +26,10 @@ multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
+   def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
+ }
+ 
++defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz <
++                                       "__builtin_r600_read_global_size">;
++defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz <
++                                       "__builtin_r600_read_local_size">;
+ defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
+                                        "__builtin_r600_read_ngroups">;
+ defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
+-- 
+1.7.7.6
+

diff --git a/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
new file mode 100644
index 0000000..49f1085
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
@@ -0,0 +1,29 @@
+diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
+--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp	2012-05-24 03:32:31.593191000 -0400
++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp	2012-05-24 03:38:31.733163513 -0400
+@@ -1145,6 +1145,25 @@ Generic_GCC::GCCInstallationDetector::GC
+     Prefixes.push_back(D.InstalledDir + "/..");
+   }
+ 
++  llvm::OwningPtr<llvm::MemoryBuffer> File;
++  for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) {
++    if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str(), File))
++    {
++      bool Exists;
++      const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str();
++      const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText;
++      if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists)
++      {
++        Version = GCCVersion::Parse(VersionText);
++        GCCInstallPath = GentooPath;
++        GCCParentLibPath = GCCInstallPath + "/../../..";
++        GCCTriple.setTriple(CandidateTripleAliases[k]);
++        IsValid = true;
++        return;
++      }
++    }
++  }
++
+   // Loop over the various components which exist and select the best GCC
+   // installation available. GCC installs are ranked by version number.
+   Version = GCCVersion::Parse("0.0.0");

diff --git a/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch b/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch
new file mode 100644
index 0000000..dc9a4f7
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch
@@ -0,0 +1,90 @@
+Backport handling of 'g++-vX.Y' header location.
+
+Fixes: https://bugs.gentoo.org/show_bug.cgi?id=487584
+---
+ tools/clang/lib/Driver/ToolChains.cpp | 20 ++++++++++++--------
+ tools/clang/lib/Driver/ToolChains.h   |  3 +++
+ 2 files changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp
+index 7c9e9c0..e38d42d 100644
+--- a/tools/clang/lib/Driver/ToolChains.cpp
++++ b/tools/clang/lib/Driver/ToolChains.cpp
+@@ -917,17 +917,19 @@ Darwin_Generic_GCC::ComputeEffectiveClangTriple(const ArgList &Args,
+ /// This is the primary means of forming GCCVersion objects.
+ /*static*/
+ Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) {
+-  const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "" };
++  const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "", "", "" };
+   std::pair<StringRef, StringRef> First = VersionText.split('.');
+   std::pair<StringRef, StringRef> Second = First.second.split('.');
+ 
+-  GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "" };
++  GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "", "", "" };
+   if (First.first.getAsInteger(10, GoodVersion.Major) ||
+       GoodVersion.Major < 0)
+     return BadVersion;
++  GoodVersion.MajorStr = First.first.str();
+   if (Second.first.getAsInteger(10, GoodVersion.Minor) ||
+       GoodVersion.Minor < 0)
+     return BadVersion;
++  GoodVersion.MinorStr = Second.first.str();
+ 
+   // First look for a number prefix and parse that if present. Otherwise just
+   // stash the entire patch string in the suffix, and leave the number
+@@ -945,7 +947,7 @@ Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) {
+       if (PatchText.slice(0, EndNumber).getAsInteger(10, GoodVersion.Patch) ||
+           GoodVersion.Patch < 0)
+         return BadVersion;
+-      GoodVersion.PatchSuffix = PatchText.substr(EndNumber).str();
++      GoodVersion.PatchSuffix = PatchText.substr(EndNumber);
+     }
+   }
+ 
+@@ -2590,11 +2592,11 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+   // equivalent to '/usr/include/c++/X.Y' in almost all cases.
+   StringRef LibDir = GCCInstallation.getParentLibPath();
+   StringRef InstallDir = GCCInstallation.getInstallPath();
+-  StringRef Version = GCCInstallation.getVersion().Text;
+   StringRef TripleStr = GCCInstallation.getTriple().str();
++  const GCCVersion &Version = GCCInstallation.getVersion();
+ 
+   if (addLibStdCXXIncludePaths(LibDir.str() + "/../include", 
+-                               "/c++/" + Version.str(),
++                               "/c++/" + Version.Text,
+                                TripleStr,
+                                GCCInstallation.getMultiarchSuffix(),
+                                DriverArgs, CC1Args))
+@@ -2602,10 +2604,12 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+ 
+   const std::string IncludePathCandidates[] = {
+     // Gentoo is weird and places its headers inside the GCC install, so if the
+-    // first attempt to find the headers fails, try this pattern.
+-    InstallDir.str() + "/include/g++-v4",
++    // first attempt to find the headers fails, try these patterns.
++    InstallDir.str() + "/include/g++-v" + Version.MajorStr + "." +
++        Version.MinorStr,
++    InstallDir.str() + "/include/g++-v" + Version.MajorStr,
+     // Android standalone toolchain has C++ headers in yet another place.
+-    LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.str(),
++    LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text,
+     // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++,
+     // without a subdirectory corresponding to the gcc version.
+     LibDir.str() + "/../include/c++",
+diff --git a/tools/clang/lib/Driver/ToolChains.h b/tools/clang/lib/Driver/ToolChains.h
+index 3afd8dd..04cf467 100644
+--- a/tools/clang/lib/Driver/ToolChains.h
++++ b/tools/clang/lib/Driver/ToolChains.h
+@@ -48,6 +48,9 @@ protected:
+     /// \brief The parsed major, minor, and patch numbers.
+     int Major, Minor, Patch;
+ 
++    /// \brief The text of the parsed major, and major+minor versions.
++    std::string MajorStr, MinorStr;
++
+     /// \brief Any textual suffix on the patch number.
+     std::string PatchSuffix;
+ 
+-- 
+1.8.3.2
+

diff --git a/sys-devel/llvm/files/clang-3.3-gentoo-install.patch b/sys-devel/llvm/files/clang-3.3-gentoo-install.patch
new file mode 100644
index 0000000..5519fbc
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.3-gentoo-install.patch
@@ -0,0 +1,71 @@
+From 1a539a8868070e49966c6b5f5e4b9f1257acd7dc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl>
+Date: Fri, 19 Jul 2013 10:23:57 +0200
+Subject: [PATCH] clang gentoo install
+
+---
+ tools/clang/lib/Driver/Tools.cpp        | 4 ++--
+ tools/clang/tools/scan-build/scan-build | 4 ++--
+ tools/clang/tools/scan-view/scan-view   | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
+index e014980..6e60513 100644
+--- a/tools/clang/lib/Driver/Tools.cpp
++++ b/tools/clang/lib/Driver/Tools.cpp
+@@ -219,7 +219,7 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args,
+   // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is
+   // not supported by old linkers.
+   std::string ProfileRT =
+-    std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a";
++    "-l:libprofile_rt.a";
+ 
+   CmdArgs.push_back(Args.MakeArgString(ProfileRT));
+ }
+@@ -6177,7 +6177,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
+   // forward.
+   if (D.IsUsingLTO(Args) || Args.hasArg(options::OPT_use_gold_plugin)) {
+     CmdArgs.push_back("-plugin");
+-    std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
++    std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so";
+     CmdArgs.push_back(Args.MakeArgString(Plugin));
+ 
+     // Try to pass driver level flags relevant to LTO code generation down to
+diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build
+index 22d5289..dcb4822 100755
+--- a/tools/clang/tools/scan-build/scan-build
++++ b/tools/clang/tools/scan-build/scan-build
+@@ -410,7 +410,7 @@ sub CopyFiles {
+ 
+   my $Dir = shift;
+ 
+-  my $JS = Cwd::realpath("$RealBin/sorttable.js");
++  my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js");
+   
+   DieDiag("Cannot find 'sorttable.js'.\n")
+     if (! -r $JS);  
+@@ -420,7 +420,7 @@ sub CopyFiles {
+   DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
+     if (! -r "$Dir/sorttable.js");
+     
+-  my $CSS = Cwd::realpath("$RealBin/scanview.css");
++  my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css");
+   
+   DieDiag("Cannot find 'scanview.css'.\n")
+     if (! -r $CSS);
+diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view
+index fb27da6..1f8ddb8 100755
+--- a/tools/clang/tools/scan-view/scan-view
++++ b/tools/clang/tools/scan-view/scan-view
+@@ -54,7 +54,7 @@ def start_browser(port, options):
+     webbrowser.open(url)
+ 
+ def run(port, options, root):
+-    import ScanView
++    from clang import ScanView
+     try:
+         print 'Starting scan-view at: http://%s:%d'%(options.host,
+                                                      port)
+-- 
+1.8.3.2
+

diff --git a/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch
new file mode 100644
index 0000000..113b04b
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch
@@ -0,0 +1,47 @@
+Our (gcc/binutils) toolchain doesn't do ARM targets, hence we will get
+"unable to interface with target machine" errors while building if we
+attempt to.  Disable those targets.
+
+Patch by Reza Jelveh from
+https://github.com/fishman/timebomb-gentoo-osx-overlay/blob/master/sys-devel/llvm/files/llvm-3.4-fix_darwin_build.patch
+
+--- a/projects/compiler-rt/make/platform/clang_darwin_embedded.mk
++++ b/projects/compiler-rt/make/platform/clang_darwin_embedded.mk
+@@ -27,20 +27,20 @@ UniversalArchs :=
+ # Soft-float version of the runtime. No floating-point instructions will be used
+ # and the ABI (out of necessity) passes floating values in normal registers:
+ # non-VFP variant of the AAPCS.
+-Configs += soft_static
+-UniversalArchs.soft_static := armv6m armv7m armv7em armv7
++# Configs += soft_static
++# UniversalArchs.soft_static := armv6m armv7m armv7em armv7
+ 
+ # Hard-float version of the runtime. On ARM VFP instructions and registers are
+ # allowed, and floating point values get passed in them. VFP variant of the
+ # AAPCS.
+ Configs += hard_static
+-UniversalArchs.hard_static := armv7em armv7 i386 x86_64
++UniversalArchs.hard_static := i386 x86_64
+ 
+-Configs += soft_pic
+-UniversalArchs.soft_pic := armv6m armv7m armv7em armv7
++# Configs += soft_pic
++# UniversalArchs.soft_pic := armv6m armv7m armv7em armv7
+ 
+ Configs += hard_pic
+-UniversalArchs.hard_pic := armv7em armv7 i386 x86_64
++UniversalArchs.hard_pic := i386 x86_64
+ 
+ CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding
+ 
+--- a/tools/clang/runtime/compiler-rt/Makefile
++++ b/tools/clang/runtime/compiler-rt/Makefile
+@@ -85,7 +85,7 @@ RuntimeLibrary.darwin.Configs := \
+ 	profile_osx.a profile_ios.a \
+ 	ubsan_osx.a
+ RuntimeLibrary.darwin_embedded.Configs := \
+-	soft_static.a hard_static.a soft_pic.a hard_pic.a
++	 hard_static.a  hard_pic.a
+ 
+ # Support building compiler-rt with relocatable SDKs.
+ #

diff --git a/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch b/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch
new file mode 100644
index 0000000..f5f1d9e
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch
@@ -0,0 +1,18 @@
+--- tools/clang/lib/Frontend/InitHeaderSearch.cpp
++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp
+@@ -233,6 +233,7 @@
+     case llvm::Triple::Bitrig:
+       break;
+     default:
++      AddPath("@GENTOO_PORTAGE_EPREFIX@/usr/include", System, false);
+       // FIXME: temporary hack: hard-coded paths.
+       AddPath("/usr/local/include", System, false);
+       break;
+@@ -505,6 +506,7 @@
+   // Add the default framework include paths on Darwin.
+   if (HSOpts.UseStandardSystemIncludes) {
+     if (triple.isOSDarwin()) {
++      AddPath("@GENTOO_PORTAGE_EPREFIX@/Frameworks", System, true);
+       AddPath("/System/Library/Frameworks", System, true);
+       AddPath("/Library/Frameworks", System, true);
+     }

diff --git a/sys-devel/llvm/files/clang-3.4-gentoo-install.patch b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch
new file mode 100644
index 0000000..0a1d9eb
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch
@@ -0,0 +1,80 @@
+From a12fc090b3b43fe25c7de50c09782611e3834aeb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 14 Jun 2014 19:35:33 +0200
+Subject: [PATCH] clang gentoo fixes
+
+---
+ tools/clang/lib/Driver/Tools.cpp        | 6 +++---
+ tools/clang/tools/scan-build/scan-build | 4 ++--
+ tools/clang/tools/scan-view/scan-view   | 2 +-
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
+index b013eb5..dbbcacb 100644
+--- a/tools/clang/lib/Driver/Tools.cpp
++++ b/tools/clang/lib/Driver/Tools.cpp
+@@ -222,7 +222,7 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args,
+   // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is
+   // not supported by old linkers.
+   std::string ProfileRT =
+-    std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a";
++    "-l:libprofile_rt.a";
+ 
+   CmdArgs.push_back(Args.MakeArgString(ProfileRT));
+ }
+@@ -5911,7 +5911,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
+   // forward.
+   if (D.IsUsingLTO(Args)) {
+     CmdArgs.push_back("-plugin");
+-    std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
++    std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so";
+     CmdArgs.push_back(Args.MakeArgString(Plugin));
+ 
+     // Try to pass driver level flags relevant to LTO code generation down to
+@@ -6534,7 +6534,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
+   // forward.
+   if (D.IsUsingLTO(Args)) {
+     CmdArgs.push_back("-plugin");
+-    std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
++    std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so";
+     CmdArgs.push_back(Args.MakeArgString(Plugin));
+ 
+     // Try to pass driver level flags relevant to LTO code generation down to
+diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build
+index 0f119f6..58f78d9 100755
+--- a/tools/clang/tools/scan-build/scan-build
++++ b/tools/clang/tools/scan-build/scan-build
+@@ -419,7 +419,7 @@ sub CopyFiles {
+ 
+   my $Dir = shift;
+ 
+-  my $JS = Cwd::realpath("$RealBin/sorttable.js");
++  my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js");
+   
+   DieDiag("Cannot find 'sorttable.js'.\n")
+     if (! -r $JS);  
+@@ -429,7 +429,7 @@ sub CopyFiles {
+   DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
+     if (! -r "$Dir/sorttable.js");
+     
+-  my $CSS = Cwd::realpath("$RealBin/scanview.css");
++  my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css");
+   
+   DieDiag("Cannot find 'scanview.css'.\n")
+     if (! -r $CSS);
+diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view
+index fb27da6..1f8ddb8 100755
+--- a/tools/clang/tools/scan-view/scan-view
++++ b/tools/clang/tools/scan-view/scan-view
+@@ -54,7 +54,7 @@ def start_browser(port, options):
+     webbrowser.open(url)
+ 
+ def run(port, options, root):
+-    import ScanView
++    from clang import ScanView
+     try:
+         print 'Starting scan-view at: http://%s:%d'%(options.host,
+                                                      port)
+-- 
+2.0.0
+

diff --git a/sys-devel/llvm/files/clang-3.5-gentoo-install.patch b/sys-devel/llvm/files/clang-3.5-gentoo-install.patch
new file mode 100644
index 0000000..5d4261d
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.5-gentoo-install.patch
@@ -0,0 +1,57 @@
+---
+ tools/clang/lib/Driver/Tools.cpp        | 2 +-
+ tools/clang/tools/scan-build/scan-build | 4 ++--
+ tools/clang/tools/scan-view/scan-view   | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
+index 187ed38..55bcd99 100644
+--- a/tools/clang/lib/Driver/Tools.cpp
++++ b/tools/clang/lib/Driver/Tools.cpp
+@@ -1404,7 +1404,7 @@ static void AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
+   // as gold requires -plugin to come before any -plugin-opt that -Wl might
+   // forward.
+   CmdArgs.push_back("-plugin");
+-  std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so";
++  std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so";
+   CmdArgs.push_back(Args.MakeArgString(Plugin));
+ 
+   // Try to pass driver level flags relevant to LTO code generation down to
+diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build
+index 0f119f6..58f78d9 100755
+--- a/tools/clang/tools/scan-build/scan-build
++++ b/tools/clang/tools/scan-build/scan-build
+@@ -419,7 +419,7 @@
+
+   my $Dir = shift;
+
+-  my $JS = Cwd::realpath("$RealBin/sorttable.js");
++  my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js");
+
+   DieDiag("Cannot find 'sorttable.js'.\n")
+     if (! -r $JS);
+@@ -429,7 +429,7 @@
+   DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
+     if (! -r "$Dir/sorttable.js");
+
+-  my $CSS = Cwd::realpath("$RealBin/scanview.css");
++  my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css");
+
+   DieDiag("Cannot find 'scanview.css'.\n")
+     if (! -r $CSS);
+diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view
+index fb27da6..1f8ddb8 100755
+--- a/tools/clang/tools/scan-view/scan-view
++++ b/tools/clang/tools/scan-view/scan-view
+@@ -54,7 +54,7 @@ def start_browser(port, options):
+     webbrowser.open(url)
+ 
+ def run(port, options, root):
+-    import ScanView
++    from clang import ScanView
+     try:
+         print 'Starting scan-view at: http://%s:%d'%(options.host,
+                                                      port)
+-- 
+1.8.4.4
+

diff --git a/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
new file mode 100644
index 0000000..1f81af0
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
@@ -0,0 +1,42 @@
+From 916572e1243633ddf913c8f32771a3a7f70fd853 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 5 Sep 2014 16:49:35 +0200
+Subject: [PATCH] Support obtaining active toolchain from gcc-config.
+
+---
+ tools/clang/lib/Driver/ToolChains.cpp | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp
+index b46f69d..2d4374d 100644
+--- a/tools/clang/lib/Driver/ToolChains.cpp
++++ b/tools/clang/lib/Driver/ToolChains.cpp
+@@ -1253,6 +1253,25 @@ Generic_GCC::GCCInstallationDetector::init(
+       Prefixes.push_back("/usr");
+   }
+ 
++  for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) {
++    llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File =
++        llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str());
++    if (File)
++    {
++      const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str();
++      const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText;
++      if (llvm::sys::fs::exists(GentooPath + "/crtbegin.o"))
++      {
++        Version = GCCVersion::Parse(VersionText);
++        GCCInstallPath = GentooPath;
++        GCCParentLibPath = GCCInstallPath + "/../../..";
++        GCCTriple.setTriple(CandidateTripleAliases[k]);
++        IsValid = true;
++        return;
++      }
++    }
++  }
++
+   // Loop over the various components which exist and select the best GCC
+   // installation available. GCC installs are ranked by version number.
+   Version = GCCVersion::Parse("0.0.0");
+-- 
+2.1.0
+

diff --git a/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch b/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch
new file mode 100644
index 0000000..31f5fc2
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch
@@ -0,0 +1,25 @@
+Fix build fails with using gcc-4.9 on Gentoo/FreeBSD
+https://bugs.gentoo.org/show_bug.cgi?id=548444
+
+diff --git a/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp b/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp
+index d6bd5c3..372f76f 100644
+--- a/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp
++++ b/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp
+@@ -22,6 +22,8 @@
+ #include "llvm/Support/FileSystem.h"
+ #include "llvm/Support/Process.h"
+ 
++#include <cstdio>
++
+ // Include the necessary headers to interface with the Windows registry and
+ // environment.
+ #if defined(LLVM_ON_WIN32)
+@@ -212,7 +214,7 @@ bool MSVCToolChain::getWindowsSDKDir(std::string &path, int &major,
+       "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\$VERSION",
+       "InstallationFolder", path, &sdkVersion);
+   if (!sdkVersion.empty())
+-    ::sscanf(sdkVersion.c_str(), "v%d.%d", &major, &minor);
++    std::sscanf(sdkVersion.c_str(), "v%d.%d", &major, &minor);
+   return hasSDKDir && !path.empty();
+ }
+ 

diff --git a/sys-devel/llvm/files/clang-3.6-gentoo-install.patch b/sys-devel/llvm/files/clang-3.6-gentoo-install.patch
new file mode 100644
index 0000000..6d76ba9
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.6-gentoo-install.patch
@@ -0,0 +1,48 @@
+---
+ tools/clang/lib/Driver/Tools.cpp        | 2 +-
+ tools/clang/tools/scan-build/scan-build | 4 ++--
+ tools/clang/tools/scan-view/scan-view   | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp
+index 187ed38..55bcd99 100644
+--- a/tools/clang/lib/Driver/Tools.cpp
++++ b/tools/clang/lib/Driver/Tools.cpp
+diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build
+index 0f119f6..58f78d9 100755
+--- a/tools/clang/tools/scan-build/scan-build
++++ b/tools/clang/tools/scan-build/scan-build
+@@ -419,7 +419,7 @@
+
+   my $Dir = shift;
+
+-  my $JS = Cwd::realpath("$RealBin/sorttable.js");
++  my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js");
+
+   DieDiag("Cannot find 'sorttable.js'.\n")
+     if (! -r $JS);
+@@ -429,7 +429,7 @@
+   DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
+     if (! -r "$Dir/sorttable.js");
+
+-  my $CSS = Cwd::realpath("$RealBin/scanview.css");
++  my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css");
+
+   DieDiag("Cannot find 'scanview.css'.\n")
+     if (! -r $CSS);
+diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view
+index fb27da6..1f8ddb8 100755
+--- a/tools/clang/tools/scan-view/scan-view
++++ b/tools/clang/tools/scan-view/scan-view
+@@ -54,7 +54,7 @@ def start_browser(port, options):
+     webbrowser.open(url)
+ 
+ def run(port, options, root):
+-    import ScanView
++    from clang import ScanView
+     try:
+         print 'Starting scan-view at: http://%s:%d'%(options.host,
+                                                      port)
+-- 
+1.8.4.4
+

diff --git a/sys-devel/llvm/files/clang-3.7-strip_doc_refs.patch b/sys-devel/llvm/files/clang-3.7-strip_doc_refs.patch
new file mode 100644
index 0000000..9576b92
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.7-strip_doc_refs.patch
@@ -0,0 +1,42 @@
+--- tools/clang/docs/AddressSanitizer.rst	2015-06-26 01:36:44.000000000 +0200
++++ tools/clang/docs/AddressSanitizer.rst	2015-08-23 15:35:10.399174574 +0200
+@@ -198,7 +198,7 @@
+ Some code should not be instrumented by AddressSanitizer. One may use the
+ function attribute ``__attribute__((no_sanitize("address")))``
+ (which has deprecated synonyms
+-:ref:`no_sanitize_address <langext-address_sanitizer>` and
++`no_sanitize_address` and
+ `no_address_safety_analysis`) to disable instrumentation of a particular
+ function. This attribute may not be supported by other compilers, so we suggest
+ to use it together with ``__has_feature(address_sanitizer)``.
+--- tools/clang/docs/MemorySanitizer.rst	2015-02-26 16:59:30.000000000 +0100
++++ tools/clang/docs/MemorySanitizer.rst	2015-08-23 15:35:28.002200413 +0200
+@@ -82,7 +82,7 @@
+ 
+ Some code should not be checked by MemorySanitizer.
+ One may use the function attribute
+-:ref:`no_sanitize_memory <langext-memory_sanitizer>`
++`no_sanitize_memory`
+ to disable uninitialized checks in a particular function.
+ MemorySanitizer may still instrument such functions to avoid false positives.
+ This attribute may not be
+--- tools/clang/docs/ThreadSanitizer.rst	2015-02-18 23:26:20.000000000 +0100
++++ tools/clang/docs/ThreadSanitizer.rst	2015-08-23 15:34:53.918150364 +0200
+@@ -88,7 +88,7 @@
+ 
+ Some code should not be instrumented by ThreadSanitizer.
+ One may use the function attribute
+-:ref:`no_sanitize_thread <langext-thread_sanitizer>`
++`no_sanitize_thread`
+ to disable instrumentation of plain (non-atomic) loads/stores in a particular function.
+ ThreadSanitizer still instruments such functions to avoid false positives and
+ provide meaningful stack traces.
+@@ -102,7 +102,7 @@
+ ThreadSanitizer supports ``src`` and ``fun`` entity types in
+ :doc:`SanitizerSpecialCaseList`, that can be used to suppress data race reports in
+ the specified source files or functions. Unlike functions marked with
+-:ref:`no_sanitize_thread <langext-thread_sanitizer>` attribute,
++`no_sanitize_thread` attribute,
+ blacklisted functions are not instrumented at all. This can lead to false positives
+ due to missed synchronization via atomic operations and missed stack frames in reports.
+ 

diff --git a/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch b/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
new file mode 100644
index 0000000..3e57f0d
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
@@ -0,0 +1,36 @@
+From 2ec240a76253839cd1c5dc2e964f55698ae468fc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 8 Jun 2015 06:43:00 +0200
+Subject: [PATCH 2/4] cmake: Support overriding Sphinx HTML doc install
+ directory
+
+Provide ${PROJECT}_INSTALL_HTML variables (e.g. LLVM_INSTALL_HTML) to
+override Sphinx HTML doc install directory.
+
+Fixes: https://llvm.org/bugs/show_bug.cgi?id=23780
+---
+ cmake/modules/AddSphinxTarget.cmake | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 045dc23..9c9c444 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -53,8 +53,12 @@ function (add_sphinx_target builder project)
+                 DESTINATION share/man/man1)
+ 
+       elseif (builder STREQUAL html)
+-        install(DIRECTORY "${SPHINX_BUILD_DIR}"
+-                DESTINATION "share/doc/${project}")
++        string(TOUPPER "${project}" project_upper)
++        set(${project_upper}_INSTALL_HTML "share/doc/${project}/html"
++            CACHE STRING "HTML documentation install directory for ${project}")
++
++        install(DIRECTORY "${SPHINX_BUILD_DIR}/"
++                DESTINATION "${${project_upper}_INSTALL_HTML}")
+       else()
+         message(WARNING Installation of ${builder} not supported)
+       endif()
+-- 
+2.4.3
+

diff --git a/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch b/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
new file mode 100644
index 0000000..b1c74c6
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
@@ -0,0 +1,32 @@
+From 4f7092ba05cccfeea7d26177d93f3d7a57d9bce2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 8 Jun 2015 14:29:03 +0200
+Subject: [PATCH 3/4] cmake: Add an ordering dep between HTML & man Sphinx
+ targets
+
+Add a dependency between HTML & manpage Sphinx targets to prevent two
+instances of Sphinx from running in parallel, and therefore solves race
+conditions reusing the same doctree directory.
+
+Fixes: https://llvm.org/bugs/show_bug.cgi?id=23781
+---
+ docs/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
+index da27627..63309a6 100644
+--- a/docs/CMakeLists.txt
++++ b/docs/CMakeLists.txt
+@@ -100,6 +100,9 @@ if (LLVM_ENABLE_SPHINX)
+ 
+     if (${SPHINX_OUTPUT_MAN})
+       add_sphinx_target(man llvm)
++      if (${SPHINX_OUTPUT_HTML})
++        add_dependencies(docs-llvm-html docs-llvm-man)
++      endif()
+     endif()
+ 
+   endif()
+-- 
+2.4.3
+

diff --git a/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch b/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch
new file mode 100644
index 0000000..92ca2e4
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch
@@ -0,0 +1,28 @@
+From d9f80393cfd4e586242ac3efd4e6ba6b49ce39ae Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 11:58:52 +0200
+Subject: [PATCH 4/4] cmake: Do not install libgtest
+
+libgtest is an internal test dependency, and should not be installed to
+the live system as a part of LLVM.
+---
+ utils/unittest/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt
+index b34e22a..3fe5884 100644
+--- a/utils/unittest/CMakeLists.txt
++++ b/utils/unittest/CMakeLists.txt
+@@ -41,6 +41,9 @@ if (PTHREAD_LIBRARY_PATH)
+   list(APPEND LIBS pthread)
+ endif()
+ 
++# Delay building until the tests pull it in, and avoid installing it
++set(EXCLUDE_FROM_ALL ON)
++
+ add_llvm_library(gtest
+   googletest/src/gtest-all.cc
+ 
+-- 
+2.4.3
+

diff --git a/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix-3.8.patch b/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix-3.8.patch
new file mode 100644
index 0000000..cf2ca59
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix-3.8.patch
@@ -0,0 +1,37 @@
+diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
+index fa7780f..e3a6c8f 100644
+--- a/tools/clang/lib/Driver/Driver.cpp
++++ b/tools/clang/lib/Driver/Driver.cpp
+@@ -66,8 +66,7 @@ Driver::Driver(StringRef ClangExecutable, StringRef DefaultTargetTriple,
+   if (ClangResourceDir != "") {
+     llvm::sys::path::append(P, ClangResourceDir);
+   } else {
+-    StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
+-    llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang",
++    llvm::sys::path::append(P, "..", "lib", "clang",
+                             CLANG_VERSION_STRING);
+   }
+   ResourceDir = P.str();
+diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
+index f078b37..0c514fc 100644
+--- a/tools/clang/lib/Frontend/CompilerInvocation.cpp
++++ b/tools/clang/lib/Frontend/CompilerInvocation.cpp
+@@ -1097,7 +1097,7 @@ std::string CompilerInvocation::GetResourcesPath(const char *Argv0,
+   if (ClangResourceDir != "")
+     llvm::sys::path::append(P, ClangResourceDir);
+   else
+-    llvm::sys::path::append(P, "..", Twine("lib") + CLANG_LIBDIR_SUFFIX,
++    llvm::sys::path::append(P, "..", "lib",
+                             "clang", CLANG_VERSION_STRING);
+ 
+   return P.str();
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index 7de5fbe..49f439b 100644
+--- a/tools/clang/lib/Headers/CMakeLists.txt
++++ b/tools/clang/lib/Headers/CMakeLists.txt
+@@ -98,4 +98,4 @@ set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
+ install(
+   FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
+   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+-  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++  DESTINATION lib/clang/${CLANG_VERSION}/include)

diff --git a/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch b/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
new file mode 100644
index 0000000..904a72a
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
@@ -0,0 +1,52 @@
+From b28503def986bcbc388a04be0d51cbe80bc59506 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 12:11:50 +0200
+Subject: [PATCH] Install clang runtime into /usr/lib (without suffix)
+
+---
+ lib/Driver/Driver.cpp               | 3 +--
+ lib/Frontend/CompilerInvocation.cpp | 3 +--
+ lib/Headers/CMakeLists.txt          | 2 +-
+ 3 files changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
+index a04a1f8..418d46a 100644
+--- a/tools/clang/lib/Driver/Driver.cpp
++++ b/tools/clang//lib/Driver/Driver.cpp
+@@ -66,8 +66,7 @@ Driver::Driver(StringRef ClangExecutable, StringRef DefaultTargetTriple,
+   if (ClangResourceDir != "") {
+     llvm::sys::path::append(P, ClangResourceDir);
+   } else {
+-    StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
+-    llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang",
++    llvm::sys::path::append(P, "..", "lib", "clang",
+                             CLANG_VERSION_STRING);
+   }
+   ResourceDir = P.str();
+diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
+index 9485767..0b9ecbd 100644
+--- a/tools/clang/lib/Frontend/CompilerInvocation.cpp
++++ b/tools/clang/lib/Frontend/CompilerInvocation.cpp
+@@ -1053,8 +1053,7 @@ std::string CompilerInvocation::GetResourcesPath(const char *Argv0,
+   if (ClangResourceDir != "") {
+     llvm::sys::path::append(P, ClangResourceDir);
+   } else {
+-    StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
+-    llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang",
++    llvm::sys::path::append(P, "..", "lib", "clang",
+                             CLANG_VERSION_STRING);
+   }
+ 
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index 29a738e..3769d23 100644
+--- a/tools/clang/lib/Headers/CMakeLists.txt
++++ b/tools/clang/lib/Headers/CMakeLists.txt
+@@ -93,4 +93,4 @@ set_target_properties(clang-headers PROPERTIES FOLDER "Misc")
+ install(
+   FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
+   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+-  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++  DESTINATION lib/clang/${CLANG_VERSION}/include)
+-- 
+2.4.3
+

diff --git a/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch b/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
new file mode 100644
index 0000000..0b93deb
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
@@ -0,0 +1,28 @@
+From d07632abe23d55eec2aae303a142a97765a77d32 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 12:20:06 +0200
+Subject: [PATCH 2/2] cmake: Make CLANG_LIBDIR_SUFFIX overridable
+
+Make CLANG_LIBDIR_SUFFIX a cache variable so that it can be explicitly
+overriden. It is used purely to find the LLVMgold.so plugin, so we want
+to set it to native suffix.
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 357286b..647f976 100644
+--- a/tools/clang/CMakeLists.txt
++++ b/tools/clang/CMakeLists.txt
+@@ -203,7 +203,7 @@ set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
+   "Vendor-specific uti.")
+ 
+ # The libdir suffix must exactly match whatever LLVM's configuration used.
+-set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}")
++set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING "")
+ 
+ set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+ set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+-- 
+2.4.3
+

diff --git a/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch b/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
new file mode 100644
index 0000000..9353800
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
@@ -0,0 +1,25 @@
+From 8bd62a681744d3c31a0837c0f84f99ea4987e017 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 12:17:57 +0200
+Subject: [PATCH] cmake: Install compiler-rt into /usr/lib (without suffix)
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0d8a880..5ae98a9 100644
+--- a/projects/compiler-rt/CMakeLists.txt
++++ b/projects/compiler-rt/CMakeLists.txt
+@@ -52,7 +52,7 @@ if (NOT COMPILER_RT_STANDALONE_BUILD)
+   # Setup the paths where compiler-rt runtimes and headers should be stored.
+   set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
+   set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+-  set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
++  set(COMPILER_RT_INSTALL_PATH lib/clang/${CLANG_VERSION})
+   option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
+          ${LLVM_INCLUDE_TESTS})
+  option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
+-- 
+2.4.3
+

diff --git a/sys-devel/llvm/files/cmake/llvm-3.7.0-ocaml-multilib.patch b/sys-devel/llvm/files/cmake/llvm-3.7.0-ocaml-multilib.patch
new file mode 100644
index 0000000..caba3d1
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/llvm-3.7.0-ocaml-multilib.patch
@@ -0,0 +1,43 @@
+--- llvm-3.7.0rc3.src-orig/cmake/modules/AddOCaml.cmake	2015-06-08 05:22:22.000000000 +1000
++++ llvm-3.7.0rc3.src/cmake/modules/AddOCaml.cmake	2015-08-30 19:22:37.216580808 +1000
+@@ -131,7 +131,7 @@
+   if( APPLE )
+     set(ocaml_rpath "@executable_path/../../lib")
+   elseif( UNIX )
+-    set(ocaml_rpath "\\$ORIGIN/../../lib")
++    set(ocaml_rpath "\\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}")
+   endif()
+   list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+ 
+@@ -183,12 +183,12 @@
+   endforeach()
+ 
+   install(FILES ${install_files}
+-          DESTINATION lib/ocaml)
++          DESTINATION ${CMAKE_INSTALL_LIBDIR}/ocaml)
+   install(FILES ${install_shlibs}
+           PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+                       GROUP_READ GROUP_EXECUTE
+                       WORLD_READ WORLD_EXECUTE
+-          DESTINATION lib/ocaml)
++          DESTINATION ${CMAKE_INSTALL_LIBDIR}/ocaml)
+ 
+   foreach( install_file ${install_files} ${install_shlibs} )
+     get_filename_component(filename "${install_file}" NAME)
+--- llvm-3.7.0rc3.src-orig/bindings/ocaml/backends/CMakeLists.txt	2014-12-30 14:24:07.000000000 +1100
++++ llvm-3.7.0rc3.src/bindings/ocaml/backends/CMakeLists.txt	2015-08-30 19:23:49.726583886 +1000
+@@ -23,5 +23,5 @@
+     "${LLVM_LIBRARY_DIR}/ocaml/META.llvm_${TARGET}")
+ 
+   install(FILES "${LLVM_LIBRARY_DIR}/ocaml/META.llvm_${TARGET}"
+-          DESTINATION lib/ocaml)
++          DESTINATION ${CMAKE_INSTALL_LIBDIR}/ocaml)
+ endforeach()
+--- llvm-3.7.0rc3.src-orig/bindings/ocaml/llvm/CMakeLists.txt	2014-12-30 14:24:07.000000000 +1100
++++ llvm-3.7.0rc3.src/bindings/ocaml/llvm/CMakeLists.txt	2015-08-30 19:23:43.561583624 +1000
+@@ -8,4 +8,4 @@
+   "${LLVM_LIBRARY_DIR}/ocaml/META.llvm")
+ 
+ install(FILES "${LLVM_LIBRARY_DIR}/ocaml/META.llvm"
+-        DESTINATION lib/ocaml)
++        DESTINATION ${CMAKE_INSTALL_LIBDIR}/ocaml)

diff --git a/sys-devel/llvm/files/cmake/llvm-3.8-allow_custom_cmake_build_types.patch b/sys-devel/llvm/files/cmake/llvm-3.8-allow_custom_cmake_build_types.patch
new file mode 100644
index 0000000..e42c08a
--- /dev/null
+++ b/sys-devel/llvm/files/cmake/llvm-3.8-allow_custom_cmake_build_types.patch
@@ -0,0 +1,14 @@
+--- a/CMakeLists.txt	2015-08-12 20:04:55.397881480 +0200
++++ b/CMakeLists.txt	2015-08-12 20:05:06.625741113 +0200
+@@ -152,11 +152,6 @@
+ 
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
+ 
+-if (CMAKE_BUILD_TYPE AND
+-    NOT uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL)$")
+-  message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+-endif()
+-
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+ 
+ # They are used as destination of target generators.

diff --git a/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch b/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch
new file mode 100644
index 0000000..583fdf9
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch
@@ -0,0 +1,30 @@
+--- docs/CommandGuide/Makefile.orig	2009-10-26 16:54:33.000000000 +0100
++++ docs/CommandGuide/Makefile	2009-10-26 17:32:03.000000000 +0100
+@@ -19,7 +19,7 @@
+ DST_PS_DIR=ps/
+ 
+ # If we are in BUILD_FOR_WEBSITE mode, default to the all target.
+-all:: html man ps
++all:: html man
+ 
+ clean:
+ 	rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
+@@ -81,7 +81,7 @@
+ MAN_DIR  := $(PROJ_mandir)/man1
+ PS_DIR   := $(PROJ_docsdir)/ps
+ 
+-install-local:: $(HTML) $(INSTALL_MANS) $(PS)
++install-local:: $(HTML) $(INSTALL_MANS)
+ 	$(Echo) Installing HTML CommandGuide Documentation
+ 	$(Verb) $(MKDIR) $(HTML_DIR)
+ 	$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
+@@ -90,9 +90,6 @@
+ 	$(Echo) Installing MAN CommandGuide Documentation
+ 	$(Verb) $(MKDIR) $(MAN_DIR)
+ 	$(Verb) $(DataInstall) $(INSTALL_MANS) $(MAN_DIR)
+-	$(Echo) Installing PS CommandGuide Documentation
+-	$(Verb) $(MKDIR) $(PS_DIR)
+-	$(Verb) $(DataInstall) $(PS) $(PS_DIR)
+ 
+ uninstall-local::
+ 	$(Echo) Uninstalling CommandGuide Documentation

diff --git a/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch b/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch
new file mode 100644
index 0000000..cce09eb
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch
@@ -0,0 +1,47 @@
+--- docs/Makefile.orig	2010-04-26 15:00:58.000000000 +0200
++++ docs/Makefile	2010-04-26 15:03:12.000000000 +0200
+@@ -46,13 +46,12 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: doxygen ocamldoc
+ 
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ 	$(Echo) Installing HTML documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
+ 	$(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+ 	$(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ 	$(Echo) Packaging HTML documentation
+@@ -64,12 +63,11 @@
+ install-doxygen: doxygen
+ 	$(Echo) Installing doxygen documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 	$(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ 	  $(FIND) . -type f -exec \
+ 	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+ 
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+ 
+ regendoc:
+ 	$(Echo) Building doxygen documentation
+@@ -95,7 +93,6 @@
+ install-ocamldoc: ocamldoc
+ 	$(Echo) Installing ocamldoc documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 	$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ 	  $(FIND) . -type f -exec \
+ 	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
+@@ -105,7 +102,6 @@
+ 	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
+ 	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
+ 	$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/ocamldoc.tar
+-	$(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
+ 
+ regen-ocamldoc:
+ 	$(Echo) Building ocamldoc documentation

diff --git a/sys-devel/llvm/files/llvm-2.8-alignof.patch b/sys-devel/llvm/files/llvm-2.8-alignof.patch
new file mode 100644
index 0000000..ae7f314
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.8-alignof.patch
@@ -0,0 +1,59 @@
+Index: include/llvm/ADT/StringMap.h
+===================================================================
+--- include/llvm/ADT/StringMap.h	(révision 117773)
++++ include/llvm/ADT/StringMap.h	(révision 117774)
+@@ -167,7 +167,7 @@
+ 
+     unsigned AllocSize = static_cast<unsigned>(sizeof(StringMapEntry))+
+       KeyLength+1;
+-    unsigned Alignment = alignof<StringMapEntry>();
++    unsigned Alignment = alignOf<StringMapEntry>();
+ 
+     StringMapEntry *NewItem =
+       static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment));
+Index: include/llvm/Support/AlignOf.h
+===================================================================
+--- include/llvm/Support/AlignOf.h	(révision 117773)
++++ include/llvm/Support/AlignOf.h	(révision 117774)
+@@ -49,12 +49,12 @@
+ 
+ };
+ 
+-/// alignof - A templated function that returns the mininum alignment of
++/// alignOf - A templated function that returns the mininum alignment of
+ ///  of a type.  This provides no extra functionality beyond the AlignOf
+ ///  class besides some cosmetic cleanliness.  Example usage:
+-///  alignof<int>() returns the alignment of an int.
++///  alignOf<int>() returns the alignment of an int.
+ template <typename T>
+-static inline unsigned alignof() { return AlignOf<T>::Alignment; }
++static inline unsigned alignOf() { return AlignOf<T>::Alignment; }
+ 
+ } // end namespace llvm
+ #endif
+Index: include/llvm/Support/Allocator.h
+===================================================================
+--- include/llvm/Support/Allocator.h	(révision 117773)
++++ include/llvm/Support/Allocator.h	(révision 117774)
+@@ -201,7 +201,7 @@
+       char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr :
+                                               (char *)Slab + Slab->Size;
+       for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) {
+-        Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
++        Ptr = Allocator.AlignPtr(Ptr, alignOf<T>());
+         if (Ptr + sizeof(T) <= End)
+           reinterpret_cast<T*>(Ptr)->~T();
+       }
+Index: include/llvm/CodeGen/SlotIndexes.h
+===================================================================
+--- include/llvm/CodeGen/SlotIndexes.h	(révision 117773)
++++ include/llvm/CodeGen/SlotIndexes.h	(révision 117774)
+@@ -393,7 +393,7 @@
+       IndexListEntry *entry =
+         static_cast<IndexListEntry*>(
+           ileAllocator.Allocate(sizeof(IndexListEntry),
+-          alignof<IndexListEntry>()));
++          alignOf<IndexListEntry>()));
+ 
+       new (entry) IndexListEntry(mi, index);
+ 

diff --git a/sys-devel/llvm/files/llvm-2.8-darwin8.patch b/sys-devel/llvm/files/llvm-2.8-darwin8.patch
new file mode 100644
index 0000000..284ab47
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.8-darwin8.patch
@@ -0,0 +1,15 @@
+Avoid like in Makefile.rules
+ld: -rpath can only be used when targeting Mac OS X 10.5 or later
+
+--- unittests/Makefile.unittest
++++ unittests/Makefile.unittest
+@@ -37,7 +37,9 @@
+ ifeq ($(ENABLE_SHARED), 1)
+   # Add the absolute path to the dynamic library.  This is ok because
+   # we'll never install unittests.
++ifneq ($(DARWIN_MAJVERS),4)
+   LD.Flags += $(RPATH) -Wl,$(SharedLibDir)
++endif
+   # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
+   # of the time.
+   Run.Shared := $(SHLIBPATH_VAR)="$(SharedLibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"

diff --git a/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch b/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch
new file mode 100644
index 0000000..b95d7d7
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch
@@ -0,0 +1,57 @@
+--- llvm/trunk/include/llvm/Operator.h	2011/02/07 16:40:21	125006
++++ llvm/trunk/include/llvm/Operator.h	2011/05/08 01:59:22	131062
+@@ -186,28 +186,46 @@
+ };
+ 
+ class AddOperator
+-  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {};
++  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {
++  ~AddOperator(); // DO NOT IMPLEMENT
++};
+ class SubOperator
+-  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {};
++  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {
++  ~SubOperator(); // DO NOT IMPLEMENT
++};
+ class MulOperator
+-  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {};
++  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {
++  ~MulOperator(); // DO NOT IMPLEMENT
++};
+ class ShlOperator
+-  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {};
++  : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {
++  ~ShlOperator(); // DO NOT IMPLEMENT
++};
+ 
+   
+ class SDivOperator
+-  : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {};
++  : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {
++  ~SDivOperator(); // DO NOT IMPLEMENT
++};
+ class UDivOperator
+-  : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {};
++  : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {
++  ~UDivOperator(); // DO NOT IMPLEMENT
++};
+ class AShrOperator
+-  : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {};
++  : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {
++  ~AShrOperator(); // DO NOT IMPLEMENT
++};
+ class LShrOperator
+-  : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {};
++  : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {
++  ~LShrOperator(); // DO NOT IMPLEMENT
++};
+   
+   
+   
+ class GEPOperator
+   : public ConcreteOperator<Operator, Instruction::GetElementPtr> {
++  ~GEPOperator(); // DO NOT IMPLEMENT
++
+   enum {
+     IsInBounds = (1 << 0)
+   };

diff --git a/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch b/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch
new file mode 100644
index 0000000..a48ad96
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch
@@ -0,0 +1,14 @@
+---
+ Intercept.cpp |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/lib/ExecutionEngine/JIT/Intercept.cpp	2012-05-17 16:11:46.956180361 +0200
++++ b/lib/ExecutionEngine/JIT/Intercept.cpp	2012-05-17 16:14:35.256184996 +0200
+@@ -52,6 +52,7 @@
+ #include <sys/stat.h>
+ #endif
+ #include <fcntl.h>
++#include <unistd.h>
+ /* stat functions are redirecting to __xstat with a version number.  On x86-64 
+  * linking with libc_nonshared.a and -Wl,--export-dynamic doesn't make 'stat' 
+  * available as an exported symbol, so we have to add it explicitly.

diff --git a/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch b/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch
new file mode 100644
index 0000000..9507817
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch
@@ -0,0 +1,39 @@
+--- docs/Makefile.orig	2011-02-28 21:30:46.000000000 +0100
++++ docs/Makefile	2011-02-28 21:35:22.000000000 +0100
+@@ -53,13 +53,12 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: $(generated_targets)
+ 
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ 	$(Echo) Installing HTML documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
+ 	$(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+ 	$(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ 	$(Echo) Packaging HTML documentation
+@@ -71,12 +70,11 @@
+ install-doxygen: doxygen
+ 	$(Echo) Installing doxygen documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 	$(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ 	  $(FIND) . -type f -exec \
+ 	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+ 
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+ 
+ regendoc:
+ 	$(Echo) Building doxygen documentation
+@@ -102,7 +100,6 @@
+ install-ocamldoc: ocamldoc
+ 	$(Echo) Installing ocamldoc documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 	$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ 	  $(FIND) . -type f -exec \
+ 	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;

diff --git a/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch
new file mode 100644
index 0000000..04e4024
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch
@@ -0,0 +1,27 @@
+https://bugs.gentoo.org/show_bug.cgi?id=403519
+http://llvm.org/viewvc/llvm-project?view=rev&revision=153938
+
+--- llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp	2011/06/15 15:29:47	133059
++++ llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp	2012/04/03 06:59:28	153938
+@@ -291,9 +291,10 @@
+ }
+ #endif
+ 
+-extern "C" void *PPCCompilationCallbackC(unsigned *StubCallAddrPlus4,
+-                                         unsigned *OrigCallAddrPlus4,
+-                                         bool is64Bit) {
++extern "C" {
++static void* LLVM_ATTRIBUTE_USED PPCCompilationCallbackC(unsigned *StubCallAddrPlus4,
++                                                         unsigned *OrigCallAddrPlus4,
++                                                         bool is64Bit) {
+   // Adjust the pointer to the address of the call instruction in the stub
+   // emitted by emitFunctionStub, rather than the instruction after it.
+   unsigned *StubCallAddr = StubCallAddrPlus4 - 1;
+@@ -337,6 +338,7 @@
+   // stack after we restore all regs.
+   return Target;
+ }
++}
+ 
+ 
+ 

diff --git a/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch
new file mode 100644
index 0000000..c485e9b
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch
@@ -0,0 +1,43 @@
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h	2011-07-25 23:24:55.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h	2011-12-02 13:06:48.000000000 +0000
+@@ -34,6 +34,10 @@
+   
+ } // End llvm namespace
+ 
++// Generated files will use "namespace PPC". To avoid symbol clash,
++// undefine PPC here. PPC may be predefined on some hosts.
++#undef PPC
++
+ // Defines symbolic names for PowerPC registers.  This defines a mapping from
+ // register name to register number.
+ //
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h	2011-07-26 00:24:13.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h	2011-12-02 13:06:48.000000000 +0000
+@@ -14,6 +14,10 @@
+ #ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H
+ #define LLVM_TARGET_POWERPC_PPCPREDICATES_H
+ 
++// Generated files will use "namespace PPC". To avoid symbol clash,
++// undefine PPC here. PPC may be predefined on some hosts.
++#undef PPC
++
+ namespace llvm {
+ namespace PPC {
+   /// Predicate - These are "(BI << 5) | BO"  for various predicates.
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h	2011-07-25 19:53:23.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h	2011-12-02 16:21:23.000000000 +0000
+@@ -12,6 +12,8 @@
+ 
+ #include "llvm/MC/MCFixup.h"
+ 
++#undef PPC
++
+ namespace llvm {
+ namespace PPC {
+ enum Fixups {

diff --git a/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch
new file mode 100644
index 0000000..031448d
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch
@@ -0,0 +1,10 @@
+--- tools/gold/Makefile	2011/11/23 03:03:21	145094
++++ tools/gold/Makefile	2011/11/23 03:07:25	145095
+@@ -24,6 +24,6 @@
+ # Because off_t is used in the public API, the largefile parts are required for
+ # ABI compatibility.
+ CXXFLAGS+=-I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+-CXXFLAGS+=$(SharedLibDir)/$(SharedPrefix)LTO$(SHLIBEXT)
++CXXFLAGS+=-L$(SharedLibDir)/$(SharedPrefix) -lLTO
+ 
+ include $(LEVEL)/Makefile.common

diff --git a/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch b/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch
new file mode 100644
index 0000000..18f5cf6
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/show_bug.cgi?id=393023
+http://llvm.org/bugs/show_bug.cgi?id=11177
+
+Index: llvm-3.0-3.0/bindings/ocaml/llvm/Makefile
+===================================================================
+--- llvm-3.0-3.0.orig/bindings/ocaml/llvm/Makefile	2011-11-15 12:17:02.785987852 +0100
++++ llvm-3.0-3.0/bindings/ocaml/llvm/Makefile	2011-11-15 12:20:12.661983615 +0100
+@@ -30,7 +30,7 @@
+ $(OcamlDir)/META.llvm: META.llvm
+ 	$(Verb) $(CP) -f $< $@
+ 
+-install-meta:: $(ObjDir)/META.llvm
++install-meta:: $(ObjDir)/../META.llvm
+ 	$(Echo) "Install $(BuildMode) $(DestMETA)"
+ 	$(Verb) $(MKDIR) $(PROJ_libocamldir)
+ 	$(Verb) $(DataInstall) META.llvm "$(DestMETA)"

diff --git a/sys-devel/llvm/files/llvm-3.0-set_soname.patch b/sys-devel/llvm/files/llvm-3.0-set_soname.patch
new file mode 100644
index 0000000..69ba74d
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-set_soname.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/show_bug.cgi?id=409267
+http://llvm.org/bugs/show_bug.cgi?id=12334
+--- tools/llvm-shlib/Makefile.orig	2012-03-26 18:14:13.071797115 +0200
++++ tools/llvm-shlib/Makefile	2012-03-26 17:31:12.491196254 +0200
+@@ -67,6 +67,7 @@
+     # Include everything from the .a's into the shared library.
+     LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
+                        -Wl,--no-whole-archive
++    LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
+ endif
+ 
+ ifeq ($(HOST_OS),Linux)

diff --git a/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch b/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch
new file mode 100644
index 0000000..05a20e6
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch
@@ -0,0 +1,27 @@
+diff -Naur llvm-3.1.src/test/ExecutionEngine/2002-12-16-ArgTest.ll llvm.src/test/ExecutionEngine/2002-12-16-ArgTest.ll
+--- llvm-3.1.src/test/ExecutionEngine/2002-12-16-ArgTest.ll	2012-04-12 22:13:57.000000000 +0200
++++ llvm.src/test/ExecutionEngine/2002-12-16-ArgTest.ll	2012-10-08 15:06:30.000000000 +0200
+@@ -1,4 +1,5 @@
+ ; RUN: %lli %s > /dev/null
++; XFAIL: arm
+ 
+ @.LC0 = internal global [10 x i8] c"argc: %d\0A\00"		; <[10 x i8]*> [#uses=1]
+ 
+diff -Naur llvm-3.1.src/test/ExecutionEngine/test-fp-no-external-funcs.ll llvm.src/test/ExecutionEngine/test-fp-no-external-funcs.ll
+--- llvm-3.1.src/test/ExecutionEngine/test-fp-no-external-funcs.ll	2012-04-12 22:13:57.000000000 +0200
++++ llvm.src/test/ExecutionEngine/test-fp-no-external-funcs.ll	2012-10-08 15:06:30.000000000 +0200
+@@ -1,4 +1,5 @@
+ ; RUN: %lli  %s > /dev/null
++; XFAIL: arm
+ 
+ define double @test(double* %DP, double %Arg) {
+ 	%D = load double* %DP		; <double> [#uses=1]
+diff -Naur llvm-3.1.src/test/ExecutionEngine/test-fp.ll llvm.src/test/ExecutionEngine/test-fp.ll
+--- llvm-3.1.src/test/ExecutionEngine/test-fp.ll	2012-04-12 22:13:57.000000000 +0200
++++ llvm.src/test/ExecutionEngine/test-fp.ll	2012-10-08 15:06:30.000000000 +0200
+@@ -1,4 +1,5 @@
+ ; RUN: %lli %s > /dev/null
++; XFAIL: arm
+ 
+ define double @test(double* %DP, double %Arg) {
+ 	%D = load double* %DP		; <double> [#uses=1]

diff --git a/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch b/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch
new file mode 100644
index 0000000..cd8a62a
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch
@@ -0,0 +1,28 @@
+--- llvm-3.1.src/docs/CommandGuide/lit.pod~	2012-03-27 03:01:14.000000000 +0900
++++ llvm-3.1.src/docs/CommandGuide/lit.pod	2013-01-23 12:47:30.297510832 +0900
+@@ -386,8 +386,6 @@
+ ********************
+ PASS: D (4 of 4)
+ 
+-=back
+-
+ =head2 LIT EXAMPLE TESTS
+ 
+ The B<lit> distribution contains several example implementations of test suites
+--- llvm-3.1.src/docs/CommandGuide/llvm-cov.pod~	2011-11-29 08:39:25.000000000 +0900
++++ llvm-3.1.src/docs/CommandGuide/llvm-cov.pod	2013-01-23 13:44:32.184212441 +0900
+@@ -18,12 +18,12 @@
+ 
+ =over
+ 
+-=item B<-gcno=filename]
++=item B<-gcno=filename>
+ 
+ This option selects input description file generated by compiler while instrumenting
+ program.
+ 
+-=item B<-gcda=filename]
++=item B<-gcda=filename>
+ 
+ This option selects coverage data file generated by instrumented compiler.
+ 

diff --git a/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch b/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch
new file mode 100644
index 0000000..de2d46b
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch
@@ -0,0 +1,65 @@
+From 737fdba46f2b2b7d39bc728d15ea2334c44779e0 Mon Sep 17 00:00:00 2001
+From: Ben Longbons <b.r.longbons@gmail.com>
+Date: Fri, 29 Jun 2012 12:58:34 -0700
+Subject: [PATCH] Revert "Patch to set is_stmt a little better for prologue
+ lines in a function."
+
+This meants that the debugger could find meaningful line information.
+
+This reverts commit 60b35f408bc3194e7ea4e96367c0b42dc5e7f850.
+---
+ lib/CodeGen/AsmPrinter/DwarfDebug.cpp |    7 ++-----
+ test/DebugInfo/X86/ending-run.ll      |    6 ++----
+ 2 files changed, 4 insertions(+), 9 deletions(-)
+
+diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+index 3e79a6d..24aedfb 100644
+--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
++++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+@@ -1093,15 +1093,12 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
+   if (!MI->isDebugValue()) {
+     DebugLoc DL = MI->getDebugLoc();
+     if (DL != PrevInstLoc && (!DL.isUnknown() || UnknownLocations)) {
+-      unsigned Flags = 0;
++      unsigned Flags = DWARF2_FLAG_IS_STMT;
+       PrevInstLoc = DL;
+       if (DL == PrologEndLoc) {
+         Flags |= DWARF2_FLAG_PROLOGUE_END;
+         PrologEndLoc = DebugLoc();
+       }
+-      if (PrologEndLoc.isUnknown())
+-        Flags |= DWARF2_FLAG_IS_STMT;
+-
+       if (!DL.isUnknown()) {
+         const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
+         recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
+@@ -1382,7 +1379,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
+                                        MF->getFunction()->getContext());
+     recordSourceLine(FnStartDL.getLine(), FnStartDL.getCol(),
+                      FnStartDL.getScope(MF->getFunction()->getContext()),
+-                     0);
++                     DWARF2_FLAG_IS_STMT);
+   }
+ }
+ 
+diff --git a/test/DebugInfo/X86/ending-run.ll b/test/DebugInfo/X86/ending-run.ll
+index 6935c47..0cd3de1 100644
+--- a/test/DebugInfo/X86/ending-run.ll
++++ b/test/DebugInfo/X86/ending-run.ll
+@@ -1,11 +1,9 @@
+ ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
+ ; RUN: llvm-dwarfdump %t | FileCheck %s
+ 
+-; Check that the line table starts at 7, not 4, but that the first
+-; statement isn't until line 8.
++; Check that the line table starts at 7, not 4.
+ 
+-; CHECK-NOT: 0x0000000000000000      7      0      1   0  is_stmt
+-; CHECK: 0x0000000000000000      7      0      1   0
++; CHECK: 0x0000000000000000      7      0      1   0  is_stmt
+ ; CHECK: 0x0000000000000004      8     18      1   0  is_stmt prologue_end
+ 
+ define i32 @callee(i32 %x) nounwind uwtable ssp {
+-- 
+1.7.10
+

diff --git a/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch b/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch
new file mode 100644
index 0000000..a03ec42
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch
@@ -0,0 +1,13 @@
+--- llvm/trunk/lib/Support/Host.cpp	2012/04/23 22:22:46	155401
++++ llvm/trunk/lib/Support/Host.cpp	2012/04/23 22:41:39	155402
+@@ -230,6 +230,10 @@
+       case 45:
+         return "corei7-avx";
+ 
++      // Ivy Bridge:
++      case 58:
++        return "core-avx-i";
++
+       case 28: // Intel Atom processor. All processors are manufactured using
+                // the 45 nm process
+         return "atom";

diff --git a/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch
new file mode 100644
index 0000000..3a622b5
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch
@@ -0,0 +1,45 @@
+--- docs/Makefile.orig	2012-04-30 17:00:01.000000000 +0200
++++ docs/Makefile	2012-04-30 17:15:52.000000000 +0200
+@@ -52,11 +52,10 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: $(generated_targets)
+ 
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ 	$(Echo) Installing HTML documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ 	$(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ 	$(Echo) Packaging HTML documentation
+@@ -68,12 +67,11 @@
+ install-doxygen: doxygen
+ 	$(Echo) Installing doxygen documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 	$(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ 	  $(FIND) . -type f -exec \
+ 	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+ 
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+ 
+ regendoc:
+ 	$(Echo) Building doxygen documentation
+@@ -99,7 +97,6 @@
+ install-ocamldoc: ocamldoc
+ 	$(Echo) Installing ocamldoc documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 	$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ 	  $(FIND) . -type f -exec \
+ 	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
+@@ -109,7 +106,6 @@
+ 	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
+ 	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
+ 	$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar
+-	$(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
+ 
+ regen-ocamldoc:
+ 	$(Echo) Building ocamldoc documentation

diff --git a/sys-devel/llvm/files/llvm-3.3-R600_debug.patch b/sys-devel/llvm/files/llvm-3.3-R600_debug.patch
new file mode 100644
index 0000000..b104273
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-R600_debug.patch
@@ -0,0 +1,22 @@
+Fixes compilation of llvm-3.3 on gcc-4.6 and 4.7 when VIDEO_CARDS=radeon
+
+This issue is caused because although Q is a multiset the original code tries to get
+a set iterator which can't be converted in a multiset one.
+
+The fix is as simple as just using a multiset iterator.
+
+Patch by Francisco Blas Izquierdo Riera (klondike)
+Consider the changes in the Public Domain
+https://bugs.gentoo.org/show_bug.cgi?id=474096
+
+--- lib/Target/R600/R600MachineScheduler.cpp
++++ lib/Target/R600/R600MachineScheduler.cpp
+@@ -290,7 +290,7 @@
+ SUnit *R600SchedStrategy::PopInst(std::multiset<SUnit *, CompareSUnit> &Q) {
+   if (Q.empty())
+     return NULL;
+-  for (std::set<SUnit *, CompareSUnit>::iterator It = Q.begin(), E = Q.end();
++  for (std::multiset<SUnit *, CompareSUnit>::iterator It = Q.begin(), E = Q.end();
+       It != E; ++It) {
+     SUnit *SU = *It;
+     InstructionsGroupCandidate.push_back(SU->getInstr());

diff --git a/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch b/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch
new file mode 100644
index 0000000..754ae46
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch
@@ -0,0 +1,24 @@
+--- cmake/modules/LLVMConfig.cmake.in.old	2013-12-30 14:40:54.888983600 +0100
++++ cmake/modules/LLVMConfig.cmake.in	2013-12-30 14:44:15.448970509 +0100
+@@ -39,16 +39,10 @@
+ set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib)
+ set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS")
+ 
+-# We try to include using the current setting of CMAKE_MODULE_PATH,
+-# which suppossedly was filled by the user with the directory where
+-# this file was installed:
+-include( LLVM-Config OPTIONAL RESULT_VARIABLE LLVMCONFIG_INCLUDED )
+-
+-# If failed, we assume that this is an un-installed build:
+-if( NOT LLVMCONFIG_INCLUDED )
+-  set(CMAKE_MODULE_PATH
++# For some reasons without it it fails on Gentoo, see bug #496480
++set(CMAKE_MODULE_PATH
+     ${CMAKE_MODULE_PATH}
+-    "@LLVM_SOURCE_DIR@/cmake/modules")
+-  include( LLVM-Config )
+-endif()
++    "@LLVM_INSTALL_PREFIX@/share/llvm/cmake")
++
++include(LLVM-Config)
+ 

diff --git a/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch
new file mode 100644
index 0000000..e477be5
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch
@@ -0,0 +1,141 @@
+From 378109dbae7e4772d9b096384904c638a6a34028 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl>
+Date: Fri, 19 Jul 2013 10:10:52 +0200
+Subject: [PATCH 1/2] gentoo install fixes
+
+---
+ Makefile.config.in                      | 6 +++---
+ Makefile.rules                          | 7 +++----
+ tools/gold/Makefile                     | 2 +-
+ tools/llvm-config/BuildVariables.inc.in | 2 ++
+ tools/llvm-config/Makefile              | 4 ++++
+ tools/llvm-config/llvm-config.cpp       | 5 +++--
+ utils/FileCheck/Makefile                | 2 +-
+ 7 files changed, 17 insertions(+), 11 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index fd4f6ef..5634ecc 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+ 
+ PROJ_bindir     := $(PROJ_prefix)/bin
+-PROJ_libdir     := $(PROJ_prefix)/lib
++PROJ_libdir     := $(PROJ_prefix)/$(GENTOO_LIBDIR)/llvm
+ PROJ_datadir    := $(PROJ_prefix)/share
+-PROJ_docsdir    := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir     := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir    := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir     := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir    := $(PROJ_prefix)/info
+ PROJ_mandir     := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index f0c542b..db252f7 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -276,7 +276,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+   ifneq ($(HOST_OS),FreeBSD)
+   ifneq ($(HOST_OS),Darwin)
+-    OmitFramePointer := -fomit-frame-pointer
++    OmitFramePointer :=
+   endif
+   endif
+ 
+@@ -639,7 +638,7 @@ endif
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+   ifneq ($(HOST_OS), Darwin)
+     ifdef TOOLNAME
+-      LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
++      LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' $(RPATH) -Wl,'$(PROJ_libdir)'
+       ifdef EXAMPLE_TOOL
+         LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
+       else
+@@ -648,7 +647,7 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+   endif
+ else
+   ifneq ($(DARWIN_MAJVERS),4)
+-    LD.Flags += $(RPATH) -Wl,@executable_path/../lib
++    LD.Flags += $(RPATH) -Wl,@executable_path/../lib -Wl,'$(PROJ_libdir)'
+   endif
+   ifeq ($(RC_XBS),YES)
+     TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
+diff --git a/tools/gold/Makefile b/tools/gold/Makefile
+index 496e31c..d36b340 100644
+--- a/tools/gold/Makefile
++++ b/tools/gold/Makefile
+@@ -24,7 +24,7 @@ include $(LEVEL)/Makefile.config
+ # Because off_t is used in the public API, the largefile parts are required for
+ # ABI compatibility.
+ CXXFLAGS += -I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+-LDFLAGS += -L$(SharedLibDir)/$(SharedPrefix)
++LDFLAGS += -L$(PROJ_libdir)
+ 
+ include $(LEVEL)/Makefile.common
+ 
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index fe87afb..fd9f2c6 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -25,3 +25,5 @@
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_RPATH "@LLVM_RPATH@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index b20b6bf..fc56781 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -55,6 +55,10 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ 	  >> temp.sed
+ 	$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ 	  >> temp.sed
++	$(Verb) $(ECHO) 's/@LLVM_RPATH@/$(subst /,\/,$(RPATH))/' \
++	  >> temp.sed
++	$(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++	  >> temp.sed
+ 	$(Verb) $(SED) -f temp.sed < $< > $@
+ 	$(Verb) $(RM) temp.sed
+ 
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 7edf5ec..4541c28 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
+     ActivePrefix = CurrentExecPrefix;
+     ActiveIncludeDir = ActivePrefix + "/include";
+     ActiveBinDir = ActivePrefix + "/bin";
+-    ActiveLibDir = ActivePrefix + "/lib";
++    ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR "/llvm";
+     ActiveIncludeOption = "-I" + ActiveIncludeDir;
+   }
+ 
+@@ -277,7 +277,8 @@ int main(int argc, char **argv) {
+       } else if (Arg == "--cxxflags") {
+         OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n';
+       } else if (Arg == "--ldflags") {
+-        OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS
++        OS << "-L" << ActiveLibDir << ' '
++           << LLVM_RPATH << " -Wl," << ActiveLibDir << ' ' << LLVM_LDFLAGS
+            << ' ' << LLVM_SYSTEM_LIBS << '\n';
+       } else if (Arg == "--libs") {
+         PrintLibs = true;
+diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile
+index 268b7bc..e7674f9 100644
+--- a/utils/FileCheck/Makefile
++++ b/utils/FileCheck/Makefile
+@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a
+ TOOL_NO_EXPORTS = 1
+ 
+ # Don't install this utility
+-NO_INSTALL = 1
++#NO_INSTALL = 1
+ 
+ include $(LEVEL)/Makefile.common
+ 
+-- 
+1.8.3.2
+

diff --git a/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch b/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch
new file mode 100644
index 0000000..659f237
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch
@@ -0,0 +1,30 @@
+From d23d21bc76693dd2a43b5d76c68972ac01a055ba Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl>
+Date: Sat, 20 Jul 2013 15:56:56 +0200
+Subject: [PATCH] Remove insecure RUNPATHs.
+
+LLVM seems to build fine without them, and they were removed for 3.4
+already.
+---
+ Makefile.rules | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/Makefile.rules b/Makefile.rules
+index db252f7..a29481b 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -639,11 +639,6 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+   ifneq ($(HOST_OS), Darwin)
+     ifdef TOOLNAME
+       LD.Flags += $(RPATH) -Wl,'$(PROJ_libdir)'
+-      ifdef EXAMPLE_TOOL
+-        LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
+-      else
+-        LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
+-    endif
+   endif
+ else
+   ifneq ($(DARWIN_MAJVERS),4)
+-- 
+1.8.3.2
+

diff --git a/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch
new file mode 100644
index 0000000..c5bd8b8
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch
@@ -0,0 +1,117 @@
+From a554809b6bdbe29b1f775c89104c1088300685ef Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 28 Dec 2013 10:30:28 +0100
+Subject: [PATCH] Update for gentoo install layout.
+
+---
+ Makefile.config.in                      | 6 +++---
+ Makefile.rules                          | 8 ++++----
+ tools/llvm-config/BuildVariables.inc.in | 1 +
+ tools/llvm-config/Makefile              | 2 ++
+ tools/llvm-config/llvm-config.cpp       | 2 +-
+ utils/FileCheck/Makefile                | 2 +-
+ 6 files changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index fd4f6ef..b63786c 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+ 
+ PROJ_bindir     := $(PROJ_prefix)/bin
+-PROJ_libdir     := $(PROJ_prefix)/lib
++PROJ_libdir     := $(PROJ_prefix)/$(GENTOO_LIBDIR)
+ PROJ_datadir    := $(PROJ_prefix)/share
+-PROJ_docsdir    := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir     := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir    := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir     := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir    := $(PROJ_prefix)/info
+ PROJ_mandir     := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index f0c542b..6cc19fd 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -276,7 +276,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+   ifneq ($(HOST_OS),FreeBSD)
+   ifneq ($(HOST_OS),Darwin)
+-    OmitFramePointer := -fomit-frame-pointer
++    OmitFramePointer :=
+   endif
+   endif
+ 
+@@ -601,7 +601,7 @@ endif
+ ifdef SHARED_LIBRARY
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ ifneq ($(HOST_OS),Darwin)
+-  LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
++  LD.Flags +=
+ endif
+ endif
+ endif
+@@ -641,9 +641,9 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+     ifdef TOOLNAME
+       LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
+       ifdef EXAMPLE_TOOL
+-        LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
++        LD.Flags += $(DynamicFlag)
+       else
+-        LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
++        LD.Flags += $(DynamicFlag)
+     endif
+   endif
+ else
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index fe87afb..908acd4 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -25,3 +25,4 @@
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index b20b6bf..0aeba45 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ 	  >> temp.sed
+ 	$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ 	  >> temp.sed
++	$(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++	  >> temp.sed
+ 	$(Verb) $(SED) -f temp.sed < $< > $@
+ 	$(Verb) $(RM) temp.sed
+ 
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 7edf5ec..c09b702 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
+     ActivePrefix = CurrentExecPrefix;
+     ActiveIncludeDir = ActivePrefix + "/include";
+     ActiveBinDir = ActivePrefix + "/bin";
+-    ActiveLibDir = ActivePrefix + "/lib";
++    ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR;
+     ActiveIncludeOption = "-I" + ActiveIncludeDir;
+   }
+ 
+diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile
+index 268b7bc..e7674f9 100644
+--- a/utils/FileCheck/Makefile
++++ b/utils/FileCheck/Makefile
+@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a
+ TOOL_NO_EXPORTS = 1
+ 
+ # Don't install this utility
+-NO_INSTALL = 1
++#NO_INSTALL = 1
+ 
+ include $(LEVEL)/Makefile.common
+ 
+-- 
+1.8.5.2
+

diff --git a/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch b/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch
new file mode 100644
index 0000000..cda8bdc
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch
@@ -0,0 +1,35 @@
+From 773560acfad511769017e971991c0305dbc0323d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 11 Jun 2014 09:40:26 +0200
+Subject: [PATCH] Avoid using external configparser in favor of built-in
+ ConfigParser.
+
+We only support Python 2 anyway, and configparser-3.2 is known to break
+the build. Since some packages actually force version 3.2, and we do not
+to pull in extra dependencies, forcing built-in seems to be the best
+option.
+
+Fixes: https://bugs.gentoo.org/show_bug.cgi?id=500856
+---
+ utils/llvm-build/llvmbuild/componentinfo.py | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py
+index eda3a48..c963ef1 100644
+--- a/utils/llvm-build/llvmbuild/componentinfo.py
++++ b/utils/llvm-build/llvmbuild/componentinfo.py
+@@ -3,10 +3,7 @@ Descriptor objects for entities that are part of the LLVM project.
+ """
+ 
+ from __future__ import absolute_import
+-try:
+-    import configparser
+-except:
+-    import ConfigParser as configparser
++import ConfigParser as configparser
+ import sys
+ 
+ from llvmbuild.util import *
+-- 
+2.0.0
+

diff --git a/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch b/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch
new file mode 100644
index 0000000..377c4da
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch
@@ -0,0 +1,148 @@
+https://bugs.gentoo.org/show_bug.cgi?id=497298
+http://llvm.org/bugs/show_bug.cgi?id=18346
+
+SVN revisions:
+http://llvm.org/viewvc/llvm-project?view=revision&revision=197503
+http://llvm.org/viewvc/llvm-project?view=revision&revision=197505
+http://llvm.org/viewvc/llvm-project?view=revision&revision=197520
+
+diff -Naur llvm-3.4.orig/lib/Target/X86/X86ISelLowering.cpp llvm-3.4/lib/Target/X86/X86ISelLowering.cpp
+--- llvm-3.4.orig/lib/Target/X86/X86ISelLowering.cpp	2014-01-08 11:22:23.373060109 +0100
++++ llvm-3.4/lib/Target/X86/X86ISelLowering.cpp	2014-01-08 11:23:58.517125907 +0100
+@@ -15226,9 +15226,15 @@
+     MBB->addSuccessor(EndMBB);
+   }
+ 
++  // Make sure the last operand is EFLAGS, which gets clobbered by the branch
++  // that was just emitted, but clearly shouldn't be "saved".
++  assert((MI->getNumOperands() <= 3 ||
++          !MI->getOperand(MI->getNumOperands() - 1).isReg() ||
++          MI->getOperand(MI->getNumOperands() - 1).getReg() == X86::EFLAGS)
++         && "Expected last argument to be EFLAGS");
+   unsigned MOVOpc = Subtarget->hasFp256() ? X86::VMOVAPSmr : X86::MOVAPSmr;
+   // In the XMM save block, save all the XMM argument registers.
+-  for (int i = 3, e = MI->getNumOperands(); i != e; ++i) {
++  for (int i = 3, e = MI->getNumOperands() - 1; i != e; ++i) {
+     int64_t Offset = (i - 3) * 16 + VarArgsFPOffset;
+     MachineMemOperand *MMO =
+       F->getMachineMemOperand(
+diff -Naur llvm-3.4.orig/lib/Target/X86/X86InstrCompiler.td llvm-3.4/lib/Target/X86/X86InstrCompiler.td
+--- llvm-3.4.orig/lib/Target/X86/X86InstrCompiler.td	2014-01-08 11:22:23.374060109 +0100
++++ llvm-3.4/lib/Target/X86/X86InstrCompiler.td	2014-01-08 11:23:39.654112857 +0100
+@@ -72,7 +72,7 @@
+ 
+ 
+ // x86-64 va_start lowering magic.
+-let usesCustomInserter = 1 in {
++let usesCustomInserter = 1, Defs = [EFLAGS] in {
+ def VASTART_SAVE_XMM_REGS : I<0, Pseudo,
+                               (outs),
+                               (ins GR8:$al,
+@@ -81,7 +81,8 @@
+                               "#VASTART_SAVE_XMM_REGS $al, $regsavefi, $offset",
+                               [(X86vastart_save_xmm_regs GR8:$al,
+                                                          imm:$regsavefi,
+-                                                         imm:$offset)]>;
++                                                         imm:$offset),
++                               (implicit EFLAGS)]>;
+ 
+ // The VAARG_64 pseudo-instruction takes the address of the va_list,
+ // and places the address of the next argument into a register.
+diff -Naur llvm-3.4.orig/test/CodeGen/X86/vaargs.ll llvm-3.4/test/CodeGen/X86/vaargs.ll
+--- llvm-3.4.orig/test/CodeGen/X86/vaargs.ll	1970-01-01 01:00:00.000000000 +0100
++++ llvm-3.4/test/CodeGen/X86/vaargs.ll	2014-01-08 11:23:53.451122402 +0100
+@@ -0,0 +1,67 @@
++; RUN: llc -mcpu=corei7-avx %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=NO-FLAGS
++target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
++target triple = "x86_64-apple-macosx10.9.0"
++
++%struct.__va_list_tag = type { i32, i32, i8*, i8* }
++
++; Check that vastart gets the right thing.
++define i32 @sum(i32 %count, ...) nounwind optsize ssp uwtable {
++; CHECK:      testb   %al, %al
++; CHECK-NEXT: je
++; CHECK-NEXT: ## BB#{{[0-9]+}}:
++; CHECK-NEXT: vmovaps %xmm0, 48(%rsp)
++; CHECK-NEXT: vmovaps %xmm1, 64(%rsp)
++; CHECK-NEXT: vmovaps %xmm2, 80(%rsp)
++; CHECK-NEXT: vmovaps %xmm3, 96(%rsp)
++; CHECK-NEXT: vmovaps %xmm4, 112(%rsp)
++; CHECK-NEXT: vmovaps %xmm5, 128(%rsp)
++; CHECK-NEXT: vmovaps %xmm6, 144(%rsp)
++; CHECK-NEXT: vmovaps %xmm7, 160(%rsp)
++
++; Check that [EFLAGS] hasn't been pulled in.
++; NO-FLAGS-NOT: %flags
++
++  %ap = alloca [1 x %struct.__va_list_tag], align 16
++  %1 = bitcast [1 x %struct.__va_list_tag]* %ap to i8*
++  call void @llvm.va_start(i8* %1)
++  %2 = icmp sgt i32 %count, 0
++  br i1 %2, label %.lr.ph, label %._crit_edge
++
++.lr.ph:                                           ; preds = %0
++  %3 = getelementptr inbounds [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 0
++  %4 = getelementptr inbounds [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 2
++  %.pre = load i32* %3, align 16
++  br label %5
++
++; <label>:5                                       ; preds = %.lr.ph, %13
++  %6 = phi i32 [ %.pre, %.lr.ph ], [ %14, %13 ]
++  %.01 = phi i32 [ %count, %.lr.ph ], [ %15, %13 ]
++  %7 = icmp ult i32 %6, 41
++  br i1 %7, label %8, label %10
++
++; <label>:8                                       ; preds = %5
++  %9 = add i32 %6, 8
++  store i32 %9, i32* %3, align 16
++  br label %13
++
++; <label>:10                                      ; preds = %5
++  %11 = load i8** %4, align 8
++  %12 = getelementptr i8* %11, i64 8
++  store i8* %12, i8** %4, align 8
++  br label %13
++
++; <label>:13                                      ; preds = %10, %8
++  %14 = phi i32 [ %6, %10 ], [ %9, %8 ]
++  %15 = add nsw i32 %.01, 1
++  %16 = icmp sgt i32 %15, 0
++  br i1 %16, label %5, label %._crit_edge
++
++._crit_edge:                                      ; preds = %13, %0
++  %.0.lcssa = phi i32 [ %count, %0 ], [ %15, %13 ]
++  call void @llvm.va_end(i8* %1)
++  ret i32 %.0.lcssa
++}
++
++declare void @llvm.va_start(i8*) nounwind
++
++declare void @llvm.va_end(i8*) nounwind
+diff -Naur llvm-3.4.orig/test/CodeGen/X86/vastart-defs-eflags.ll llvm-3.4/test/CodeGen/X86/vastart-defs-eflags.ll
+--- llvm-3.4.orig/test/CodeGen/X86/vastart-defs-eflags.ll	1970-01-01 01:00:00.000000000 +0100
++++ llvm-3.4/test/CodeGen/X86/vastart-defs-eflags.ll	2014-01-08 11:23:39.654112857 +0100
+@@ -0,0 +1,23 @@
++; RUN: llc %s -o - | FileCheck %s
++
++target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
++target triple = "x86_64-apple-macosx10.10.0"
++
++; Check that vastart handling doesn't get between testb and je for the branch.
++define i32 @check_flag(i32 %flags, ...) nounwind {
++entry:
++; CHECK: {{^}} testb $2, %bh
++; CHECK-NOT: test
++; CHECK: {{^}} je
++  %and = and i32 %flags, 512
++  %tobool = icmp eq i32 %and, 0
++  br i1 %tobool, label %if.end, label %if.then
++
++if.then:                                          ; preds = %entry
++  br label %if.end
++
++if.end:                                           ; preds = %entry, %if.then
++  %hasflag = phi i32 [ 1, %if.then ], [ 0, %entry ]
++  ret i32 %hasflag
++}
++

diff --git a/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch
new file mode 100644
index 0000000..a2ba7de
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch
@@ -0,0 +1,96 @@
+From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 19 Aug 2013 13:22:46 +0200
+Subject: [PATCH] gentoo install fixes
+
+---
+ Makefile.config.in                      | 6 +++---
+ Makefile.rules                          | 6 +++---
+ tools/llvm-config/BuildVariables.inc.in | 2 ++
+ tools/llvm-config/Makefile              | 4 ++++
+ tools/llvm-config/llvm-config.cpp       | 5 +++--
+ utils/FileCheck/Makefile                | 2 +-
+ 7 files changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index dcca45f..e75ae2e 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+ 
+ PROJ_bindir     := $(PROJ_prefix)/bin
+-PROJ_libdir     := $(PROJ_prefix)/lib
++PROJ_libdir     := $(PROJ_prefix)/$(GENTOO_LIBDIR)
+ PROJ_datadir    := $(PROJ_prefix)/share
+-PROJ_docsdir    := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir     := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir    := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir     := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir    := $(PROJ_prefix)/info
+ PROJ_mandir     := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index e53598b..217f754 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+   BuildMode := Release
+   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+   ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
+-    OmitFramePointer := -fomit-frame-pointer
++    OmitFramePointer :=
+   endif
+ 
+   CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index fe87afb..fd9f2c6 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -25,3 +25,4 @@
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index b20b6bf..fc56781 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ 	  >> temp.sed
+ 	$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ 	  >> temp.sed
++	$(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++	  >> temp.sed
+ 	$(Verb) $(SED) -f temp.sed < $< > $@
+ 	$(Verb) $(RM) temp.sed
+ 
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 3924e2e..f439c60 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
+     ActivePrefix = CurrentExecPrefix;
+     ActiveIncludeDir = ActivePrefix + "/include";
+     ActiveBinDir = ActivePrefix + "/bin";
+-    ActiveLibDir = ActivePrefix + "/lib";
++    ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR;
+     ActiveIncludeOption = "-I" + ActiveIncludeDir;
+   }
+ 
+diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile
+index 268b7bc..e7674f9 100644
+--- a/utils/FileCheck/Makefile
++++ b/utils/FileCheck/Makefile
+@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a
+ TOOL_NO_EXPORTS = 1
+ 
+ # Don't install this utility
+-NO_INSTALL = 1
++#NO_INSTALL = 1
+ 
+ include $(LEVEL)/Makefile.common
+ 
+-- 
+1.8.4.2
+

diff --git a/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch b/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch
new file mode 100644
index 0000000..7da657f
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch
@@ -0,0 +1,43 @@
+commit 080fb498017d17af2e4d7563608c7d8a848f20da
+Author: Sanjoy Das <sanjoy at azulsystems.com>
+Date:   Thu Jun 19 15:38:02 2014 -0700
+
+    Fix the --enable-shared build.
+    
+    Currently a build configured with ./configure --enable-shared breaks
+    with an undefined "llvm::cl::parser<llvm::PassInfo
+    const*>::getOption(unsigned int) const" symbol when linking opt.  This
+    body for this symbol gets emitted into Pass.o (along with the destructor
+    for PassNameParser), but gets linked into libLLVM-3.5svn.so with local
+    visibility, causing the link error.
+    
+    This fix uses the existing EXTERN_TEMPLATE machinery to force a globally
+    visible definition for the functions in parser<const PassInfo *> into
+    Pass.o.
+
+diff --git a/include/llvm/IR/LegacyPassNameParser.h b/include/llvm/IR/LegacyPassNameParser.h
+index e2e4912..a07e3fd 100644
+--- a/include/llvm/IR/LegacyPassNameParser.h
++++ b/include/llvm/IR/LegacyPassNameParser.h
+@@ -95,6 +95,8 @@ private:
+   }
+ };
+ 
++EXTERN_TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>);
++
+ ///===----------------------------------------------------------------------===//
+ /// FilteredPassNameParser class - Make use of the pass registration
+ /// mechanism to automatically add a command line argument to opt for
+diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp
+index 91d86ae..00ce223 100644
+--- a/lib/IR/Pass.cpp
++++ b/lib/IR/Pass.cpp
+@@ -234,6 +234,8 @@ PassNameParser::~PassNameParser() {
+   // attempting to remove the registration listener is an error.
+ }
+ 
++TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>);
++
+ //===----------------------------------------------------------------------===//
+ //   AnalysisUsage Class Implementation
+ //

diff --git a/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch
new file mode 100644
index 0000000..7a8c9f7
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch
@@ -0,0 +1,83 @@
+From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 19 Aug 2013 13:22:46 +0200
+Subject: [PATCH] gentoo install fixes
+
+---
+ Makefile.config.in                      | 6 +++---
+ Makefile.rules                          | 6 +++---
+ tools/llvm-config/BuildVariables.inc.in | 2 ++
+ tools/llvm-config/Makefile              | 4 ++++
+ tools/llvm-config/llvm-config.cpp       | 5 +++--
+ utils/FileCheck/Makefile                | 2 +-
+ 7 files changed, 17 insertions(+), 10 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index dcca45f..e75ae2e 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+ 
+ PROJ_bindir     := $(PROJ_prefix)/bin
+-PROJ_libdir     := $(PROJ_prefix)/lib
++PROJ_libdir     := $(PROJ_prefix)/$(GENTOO_LIBDIR)
+ PROJ_datadir    := $(PROJ_prefix)/share
+-PROJ_docsdir    := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir     := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir    := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir     := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir    := $(PROJ_prefix)/info
+ PROJ_mandir     := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index e53598b..217f754 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+   BuildMode := Release
+   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+   ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
+-    OmitFramePointer := -fomit-frame-pointer
++    OmitFramePointer :=
+   endif
+ 
+   CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index fe87afb..fd9f2c6 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -25,3 +25,4 @@
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index b20b6bf..fc56781 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ 	  >> temp.sed
+ 	$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ 	  >> temp.sed
++	$(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++	  >> temp.sed
+ 	$(Verb) $(SED) -f temp.sed < $< > $@
+ 	$(Verb) $(RM) temp.sed
+ 
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 3924e2e..f439c60 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -250,7 +250,7 @@ int main(int argc, char **argv) {
+     ActivePrefix = CurrentExecPrefix;
+     ActiveIncludeDir = ActivePrefix + "/include";
+     ActiveBinDir = ActivePrefix + "/bin";
+-    ActiveLibDir = ActivePrefix + "/lib";
++    ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR;
+     ActiveIncludeOption = "-I" + ActiveIncludeDir;
+   }
+ 
+-- 
+1.8.4.2
+

diff --git a/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch b/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch
new file mode 100644
index 0000000..9fbd7b7
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch
@@ -0,0 +1,39 @@
+Index: cmake/modules/Makefile
+===================================================================
+--- cmake/modules/Makefile	(revision 217451)
++++ cmake/modules/Makefile	(working copy)
+@@ -33,6 +33,16 @@
+ 	LLVM_ENABLE_RTTI := 0
+ endif
+ 
++LLVM_LIBS_TO_EXPORT := $(subst -l,,$(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error))
++
++ifeq ($(LLVM_LIBS_TO_EXPORT),Error)
++$(error llvm-config --libs failed)
++endif
++
++ifndef LLVM_LIBS_TO_EXPORT
++$(error LLVM_LIBS_TO_EXPORT cannot be empty)
++endif
++
+ OBJMODS := LLVMConfig.cmake LLVMConfigVersion.cmake LLVMExports.cmake
+ 
+ $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in $(LLVMBuildCMakeFrag)
+@@ -45,7 +55,7 @@
+ 	  -e 's/@LLVM_VERSION_PATCH@/'"$(LLVM_VERSION_PATCH)"'/' \
+ 	  -e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \
+ 	  -e 's/@LLVM_COMMON_DEPENDS@//' \
+-	  -e 's/@LLVM_AVAILABLE_LIBS@/'"$(subst -l,,$(LLVMConfigLibs))"'/' \
++	  -e 's/@LLVM_AVAILABLE_LIBS@/'"$(LLVM_LIBS_TO_EXPORT)"'/' \
+ 	  -e 's/@LLVM_ALL_TARGETS@/'"$(ALL_TARGETS)"'/' \
+ 	  -e 's/@LLVM_TARGETS_TO_BUILD@/'"$(TARGETS_TO_BUILD)"'/' \
+ 	  -e 's/@LLVM_TARGETS_WITH_JIT@/'"$(TARGETS_WITH_JIT)"'/' \
+@@ -83,7 +93,7 @@
+ 	$(Echo) 'Generating LLVM CMake target exports file'
+ 	$(Verb) ( \
+ 	  echo '# LLVM CMake target exports.  Do not include directly.' && \
+-	  for lib in $(subst -l,,$(LLVMConfigLibs)); do \
++	  for lib in $(LLVM_LIBS_TO_EXPORT); do \
+ 	    echo 'add_library('"$$lib"' STATIC IMPORTED)' && \
+ 	    echo 'set_property(TARGET '"$$lib"' PROPERTY IMPORTED_LOCATION "'"$(PROJ_libdir)/lib$$lib.a"'")' ; \
+ 	  done && \

diff --git a/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch b/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch
new file mode 100644
index 0000000..7cb2817
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch
@@ -0,0 +1,14 @@
+Index: include/llvm/ADT/IntrusiveRefCntPtr.h
+===================================================================
+--- include/llvm/ADT/IntrusiveRefCntPtr.h	(revision 218294)
++++ include/llvm/ADT/IntrusiveRefCntPtr.h	(revision 218295)
+@@ -197,6 +197,9 @@
+   private:
+     void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
+     void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
++
++    template <typename X>
++    friend class IntrusiveRefCntPtr;
+   };
+ 
+   template<class T, class U>

diff --git a/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch
new file mode 100644
index 0000000..c4d0db2
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch
@@ -0,0 +1,82 @@
+From bb016afeba4d9e886e776565a508634a261111a2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 31 Dec 2014 11:26:12 +0100
+Subject: [PATCH] gentoo build fixes
+
+---
+ Makefile.config.in                      | 6 +++---
+ Makefile.rules                          | 2 +-
+ tools/llvm-config/BuildVariables.inc.in | 1 +
+ tools/llvm-config/Makefile              | 2 ++
+ tools/llvm-config/llvm-config.cpp       | 2 +-
+ 5 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile.config.in b/Makefile.config.in
+index d34a2d5..a26cd08 100644
+--- a/Makefile.config.in
++++ b/Makefile.config.in
+@@ -99,10 +99,10 @@ PROJ_internal_prefix := $(prefix)
+ endif
+ 
+ PROJ_bindir     := $(PROJ_prefix)/bin
+-PROJ_libdir     := $(PROJ_prefix)/lib
++PROJ_libdir     := $(PROJ_prefix)/$(GENTOO_LIBDIR)
+ PROJ_datadir    := $(PROJ_prefix)/share
+-PROJ_docsdir    := $(PROJ_prefix)/docs/llvm
+-PROJ_etcdir     := $(PROJ_prefix)/etc/llvm
++PROJ_docsdir    := $(PROJ_prefix)/share/doc/@PF@
++PROJ_etcdir     := @EPREFIX@/etc/llvm
+ PROJ_includedir := $(PROJ_prefix)/include
+ PROJ_infodir    := $(PROJ_prefix)/info
+ PROJ_mandir     := $(PROJ_prefix)/share/man
+diff --git a/Makefile.rules b/Makefile.rules
+index c8c971f..d1258b1 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -283,7 +283,7 @@ ifeq ($(ENABLE_OPTIMIZED),1)
+   BuildMode := Release
+   # Don't use -fomit-frame-pointer on Darwin or FreeBSD.
+   ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD))
+-    OmitFramePointer := -fomit-frame-pointer
++    OmitFramePointer :=
+   endif
+ 
+   CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index 3f51f49..513ea89 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -26,3 +26,4 @@
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
++#define LLVM_LIBDIR "@LLVM_LIBDIR@"
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index 1ff8b6f..5d73c6e 100644
+--- a/tools/llvm-config/Makefile
++++ b/tools/llvm-config/Makefile
+@@ -65,6 +65,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
+ 	  >> temp.sed
+ 	$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
+ 	  >> temp.sed
++	$(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \
++	  >> temp.sed
+ 	$(Verb) $(SED) -f temp.sed < $< > $@
+ 	$(Verb) $(RM) temp.sed
+ 
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 224035a..57180ac 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -265,7 +265,7 @@ int main(int argc, char **argv) {
+     ActivePrefix = CurrentExecPrefix;
+     ActiveIncludeDir = ActivePrefix + "/include";
+     ActiveBinDir = ActivePrefix + "/bin";
+-    ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
++    ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR;
+     ActiveIncludeOption = "-I" + ActiveIncludeDir;
+   }
+ 
+-- 
+2.2.1
+

diff --git a/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch b/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch
new file mode 100644
index 0000000..154c9cc
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch
@@ -0,0 +1,35 @@
+diff -Naur llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml
+--- llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml	2015-03-17 11:49:27.274824345 +0100
++++ llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml	2015-03-17 11:49:40.333829421 +0100
+@@ -43,11 +43,11 @@
+   = "llvm_ee_run_static_dtors"
+ external data_layout : llexecutionengine -> Llvm_target.DataLayout.t
+   = "llvm_ee_get_data_layout"
+-external add_global_mapping_ : Llvm.llvalue -> int64 -> llexecutionengine -> unit
++external add_global_mapping_ : Llvm.llvalue -> nativeint -> llexecutionengine -> unit
+   = "llvm_ee_add_global_mapping"
+-external get_global_value_address_ : string -> llexecutionengine -> int64
++external get_global_value_address_ : string -> llexecutionengine -> nativeint
+   = "llvm_ee_get_global_value_address"
+-external get_function_address_ : string -> llexecutionengine -> int64
++external get_function_address_ : string -> llexecutionengine -> nativeint
+   = "llvm_ee_get_function_address"
+ 
+ let add_global_mapping llval ptr ee =
+@@ -55,14 +55,14 @@
+ 
+ let get_global_value_address name typ ee =
+   let vptr = get_global_value_address_ name ee in
+-  if Int64.to_int vptr <> 0 then
++  if Nativeint.to_int vptr <> 0 then
+     let open Ctypes in !@ (coerce (ptr void) (ptr typ) (ptr_of_raw_address vptr))
+   else
+     raise (Error ("Value " ^ name ^ " not found"))
+ 
+ let get_function_address name typ ee =
+   let fptr = get_function_address_ name ee in
+-  if Int64.to_int fptr <> 0 then
++  if Nativeint.to_int fptr <> 0 then
+     let open Ctypes in coerce (ptr void) typ (ptr_of_raw_address fptr)
+   else
+     raise (Error ("Function " ^ name ^ " not found"))

diff --git a/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch b/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch
new file mode 100644
index 0000000..8690523
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch
@@ -0,0 +1,49 @@
+--- docs/Makefile.orig	2012-04-30 17:00:01.000000000 +0200
++++ docs/Makefile	2012-04-30 17:15:52.000000000 +0200
+@@ -52,11 +52,10 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: $(generated_targets)
+ 
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ 	$(Echo) Installing HTML documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ 	$(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ 	$(Echo) Packaging HTML documentation
+@@ -68,12 +67,11 @@
+ 
+ install-doxygen: doxygen
+ 	$(Echo) Installing doxygen documentation
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 	$(Verb) cd $(PROJ_OBJ_DIR)/doxygen/html && \
+ 	  for DIR in $$($(FIND) . -type d); do \
+ 	    DESTSUB="$(DESTDIR)$(PROJ_docsdir)/html/doxygen/$$(echo $$DIR | cut -c 3-)"; \
+ 	    $(MKDIR) $$DESTSUB && \
+ 	    $(FIND) $$DIR -maxdepth 1 -type f -exec $(DataInstall) {} $$DESTSUB \; ; \
+ 	    if [ $$? != 0 ]; then exit 1; fi \
+ 	  done
+ 
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+ 
+ regendoc:
+ 	$(Echo) Building doxygen documentation
+@@ -99,7 +97,6 @@
+ install-ocamldoc: ocamldoc
+ 	$(Echo) Installing ocamldoc documentation
+ 	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ 	$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ 	  $(FIND) . -type f -exec \
+ 	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
+@@ -109,7 +106,6 @@
+ 	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
+ 	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
+ 	$(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar
+-	$(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
+ 
+ regen-ocamldoc:
+ 	$(Echo) Building ocamldoc documentation

diff --git a/sys-devel/llvm/llvm-2.8-r2.ebuild b/sys-devel/llvm/llvm-2.8-r2.ebuild
new file mode 100644
index 0000000..ed5e542
--- /dev/null
+++ b/sys-devel/llvm/llvm-2.8-r2.ebuild
@@ -0,0 +1,168 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+# Upstream silently re-released the tarball...
+# drop the -> in 2.9
+SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz -> ${P}-r1.tgz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug +libffi multitarget ocaml test udis86"
+
+DEPEND="dev-lang/perl
+	>=sys-devel/make-3.79
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+	libffi? ( virtual/libffi )
+	ocaml? ( dev-lang/ocaml )
+	udis86? ( dev-libs/udis86[pic(+)] )"
+RDEPEND="dev-lang/perl"
+
+S=${WORKDIR}/${PN}-${PV/_pre*}
+
+pkg_setup() {
+	# need to check if the active compiler is ok
+
+	broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+	broken_gcc_x86=" 3.4.0 3.4.2 "
+	broken_gcc_amd64=" 3.4.6 "
+
+	gcc_vers=$(gcc-fullversion)
+
+	if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm."
+		elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+		elog "possible solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm on x86"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+	then
+		 elog "Your version of gcc is known to miscompile llvm in amd64"
+		 elog "architectures.  Check"
+		 elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		 elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	 fi
+}
+
+src_prepare() {
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	einfo "Fixing install dirs"
+	sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+		-e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+		-e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+		-i Makefile.config.in || die "Makefile.config sed failed"
+	sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+		-i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed"
+
+	einfo "Fixing rpath and CFLAGS"
+	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+		-i Makefile.rules || die "rpath sed failed"
+
+	epatch "${FILESDIR}"/${PN}-2.7-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+	epatch "${FILESDIR}"/${PN}-2.8-darwin8.patch
+	# Upstream backport, r117774
+	epatch "${FILESDIR}"/${P}-alignof.patch
+
+	# Additional unistd.h include for GCC 4.7
+	epatch "${FILESDIR}"/${PN}-2.9-gcc4.7.patch
+
+	# User patches
+	epatch_user
+}
+
+src_configure() {
+	local CONF_FLAGS="--enable-shared"
+
+	if use debug; then
+		CONF_FLAGS="${CONF_FLAGS} --disable-optimized"
+		einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries"
+		# ...and you probably shouldn't use tmpfs, unless it can hold 900MB
+	else
+		CONF_FLAGS="${CONF_FLAGS} \
+			--enable-optimized \
+			--with-optimize-option= \
+			--disable-assertions \
+			--disable-expensive-checks"
+	fi
+
+	if use multitarget; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+	fi
+
+	if use amd64; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+	fi
+
+	CONF_FLAGS="${CONF_FLAGS} \
+		--with-llvmgccdir=/dev/null \
+		--with-llvmgcc=nope \
+		--with-llvmgxx=nope"
+
+	if use ocaml; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+	fi
+
+	if use udis86; then
+		CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+	fi
+	CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+	econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+	emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed"
+}
+
+src_install() {
+	emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib=
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		for lib in lib{EnhancedDisassembly,LLVM-${PV},BugpointPasses,LLVMHello,LTO,profile_rt}.dylib ; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			[[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+				"${ED}"/usr/lib/${PN}/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+			install_name_tool \
+				-change "${odylib}" \
+					"${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+				"${f}"
+			eend $?
+		done
+	fi
+}

diff --git a/sys-devel/llvm/llvm-2.9-r2.ebuild b/sys-devel/llvm/llvm-2.9-r2.ebuild
new file mode 100644
index 0000000..515e387
--- /dev/null
+++ b/sys-devel/llvm/llvm-2.9-r2.ebuild
@@ -0,0 +1,175 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+inherit eutils flag-o-matic multilib toolchain-funcs pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+	>=sys-devel/make-3.79
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+	libffi? ( virtual/pkgconfig
+		virtual/libffi )
+	ocaml? ( dev-lang/ocaml )
+	udis86? ( dev-libs/udis86[pic(+)] )"
+RDEPEND="dev-lang/perl
+	libffi? ( virtual/libffi )
+	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${PN}-${PV/_pre*}
+
+pkg_setup() {
+	# need to check if the active compiler is ok
+
+	broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+	broken_gcc_x86=" 3.4.0 3.4.2 "
+	broken_gcc_amd64=" 3.4.6 "
+
+	gcc_vers=$(gcc-fullversion)
+
+	if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm."
+		elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+		elog "possible solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm on x86"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+	then
+		 elog "Your version of gcc is known to miscompile llvm in amd64"
+		 elog "architectures.  Check"
+		 elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		 elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	 fi
+}
+
+src_prepare() {
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	einfo "Fixing install dirs"
+	sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+		-e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+		-e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+		-i Makefile.config.in || die "Makefile.config sed failed"
+	sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+		-i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed"
+
+	einfo "Fixing rpath and CFLAGS"
+	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+		-i Makefile.rules || die "rpath sed failed"
+
+	epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+	epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch
+
+	# Upstream commit r131062
+	epatch "${FILESDIR}"/${P}-Operator.h-c++0x.patch
+
+	# Additional unistd.h include for GCC 4.7
+	epatch "${FILESDIR}"/${P}-gcc4.7.patch
+
+	# User patches
+	epatch_user
+}
+
+src_configure() {
+	local CONF_FLAGS="--enable-shared
+		--with-optimize-option=
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)"
+
+	if use multitarget; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+	fi
+
+	if use amd64; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+	fi
+
+	CONF_FLAGS="${CONF_FLAGS} \
+		--with-llvmgccdir=/dev/null \
+		--with-llvmgcc=nope \
+		--with-llvmgxx=nope"
+
+	if use ocaml; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+	fi
+
+	if use udis86; then
+		CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+	fi
+
+	if use libffi; then
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+	CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+	econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+	emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed"
+
+	pax-mark m Release/bin/lli
+	if use test; then
+		pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	fi
+}
+
+src_install() {
+	emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/syntax
+		doins utils/vim/*.vim
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib=
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO}.dylib {BugpointPasses,LLVMHello,profile_rt}.dylib ; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			[[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+				"${ED}"/usr/lib/${PN}/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+			install_name_tool \
+				-change "${odylib}" \
+					"${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+				"${f}"
+			eend $?
+		done
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.0-r2.ebuild b/sys-devel/llvm/llvm-3.0-r2.ebuild
new file mode 100644
index 0000000..a0caca1
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.0-r2.ebuild
@@ -0,0 +1,181 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+PYTHON_DEPEND="2"
+inherit eutils flag-o-matic multilib toolchain-funcs python pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+	>=sys-devel/make-3.79
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+	gold? ( >=sys-devel/binutils-2.22[cxx] )
+	libffi? ( virtual/pkgconfig
+		virtual/libffi )
+	ocaml? ( dev-lang/ocaml )
+	udis86? ( dev-libs/udis86[pic(+)] )"
+RDEPEND="dev-lang/perl
+	libffi? ( virtual/libffi )
+	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${P}.src
+
+pkg_setup() {
+	# Required for test and build
+	python_set_active_version 2
+	python_pkg_setup
+
+	# need to check if the active compiler is ok
+
+	broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+	broken_gcc_x86=" 3.4.0 3.4.2 "
+	broken_gcc_amd64=" 3.4.6 "
+
+	gcc_vers=$(gcc-fullversion)
+
+	if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm."
+		elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+		elog "possible solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm on x86"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+	then
+		 elog "Your version of gcc is known to miscompile llvm in amd64"
+		 elog "architectures.  Check"
+		 elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		 elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	 fi
+}
+
+src_prepare() {
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	einfo "Fixing install dirs"
+	sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+		-e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+		-e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+		-i Makefile.config.in || die "Makefile.config sed failed"
+	sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+		-i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed"
+
+	einfo "Fixing rpath and CFLAGS"
+	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+		-i Makefile.rules || die "rpath sed failed"
+
+	# Specify python version
+	python_convert_shebangs -r 2 test/Scripts
+
+	epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+	epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch
+	epatch "${FILESDIR}"/${P}-ocaml_install.patch
+	epatch "${FILESDIR}"/${P}-PPC_macro.patch
+	epatch "${FILESDIR}"/${P}-PPCCompilationCallbackC_static.patch
+	epatch "${FILESDIR}"/${P}-gold_LTO_link.patch
+	epatch "${FILESDIR}"/${P}-set_soname.patch
+
+	# User patches
+	epatch_user
+}
+
+src_configure() {
+	local CONF_FLAGS="--enable-shared
+		--with-optimize-option=
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)"
+
+	if use multitarget; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
+	fi
+
+	if use amd64; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+	fi
+
+	if use gold; then
+		CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
+	fi
+	if use ocaml; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+	fi
+
+	if use udis86; then
+		CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+	fi
+
+	if use libffi; then
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+	CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+	econf ${CONF_FLAGS} || die "econf failed"
+}
+
+src_compile() {
+	emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed"
+
+	pax-mark m Release/bin/lli
+	if use test; then
+		pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	fi
+}
+
+src_install() {
+	emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
+
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/syntax
+		doins utils/vim/*.vim
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib=
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			[[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+				"${ED}"/usr/lib/${PN}/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+			install_name_tool \
+				-change "${odylib}" \
+					"${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+				"${f}"
+			eend $?
+		done
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.1-r2.ebuild b/sys-devel/llvm/llvm-3.1-r2.ebuild
new file mode 100644
index 0000000..fd9ce13
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.1-r2.ebuild
@@ -0,0 +1,191 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+PYTHON_DEPEND="2"
+inherit eutils flag-o-matic multilib toolchain-funcs python pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="amd64 arm ppc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+	>=sys-devel/make-3.79
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+	gold? ( >=sys-devel/binutils-2.22[cxx] )
+	libffi? ( virtual/pkgconfig
+		virtual/libffi )
+	ocaml? ( dev-lang/ocaml )
+	udis86? ( dev-libs/udis86[pic(+)] )"
+RDEPEND="dev-lang/perl
+	libffi? ( virtual/libffi )
+	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${P}.src
+
+pkg_setup() {
+	# Required for test and build
+	python_set_active_version 2
+	python_pkg_setup
+
+	# need to check if the active compiler is ok
+
+	broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+	broken_gcc_x86=" 3.4.0 3.4.2 "
+	broken_gcc_amd64=" 3.4.6 "
+
+	gcc_vers=$(gcc-fullversion)
+
+	if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm."
+		elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+		elog "possible solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm on x86"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+	then
+		 elog "Your version of gcc is known to miscompile llvm in amd64"
+		 elog "architectures.  Check"
+		 elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		 elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	 fi
+}
+
+src_prepare() {
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	einfo "Fixing install dirs"
+	sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+		-e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+		-e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+		-i Makefile.config.in || die "Makefile.config sed failed"
+	sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \
+		-i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
+
+	einfo "Fixing rpath and CFLAGS"
+	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+		-i Makefile.rules || die "rpath sed failed"
+	if use gold; then
+		sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+			-i tools/gold/Makefile || die "gold rpath sed failed"
+	fi
+
+	# Specify python version
+	python_convert_shebangs -r 2 test/Scripts
+
+	epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+	epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.0-PPC_macro.patch
+	epatch "${FILESDIR}"/${P}-ivybridge_support.patch
+	epatch "${FILESDIR}"/${P}-fix_debug_line_info.patch
+	epatch "${FILESDIR}"/${P}-ExecutionEngine_tests_xfail_arm.patch
+	epatch "${FILESDIR}"/${P}-docs-pod-markup-fixes.patch
+
+	# Apply r600 OpenCL-related patches, bug #425688
+	epatch "${FILESDIR}"/cl-patches/*.patch
+
+	# User patches
+	epatch_user
+}
+
+src_configure() {
+	local CONF_FLAGS="--enable-shared
+		--with-optimize-option=
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)"
+
+	if use multitarget; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
+	fi
+
+	if use amd64; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+	fi
+
+	if use gold; then
+		CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
+	fi
+	if use ocaml; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+	fi
+
+	if use udis86; then
+		CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+	fi
+
+	if use libffi; then
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+	CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+	econf ${CONF_FLAGS}
+}
+
+src_compile() {
+	emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1
+
+	pax-mark m Release/bin/lli
+	if use test; then
+		pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	fi
+}
+
+src_install() {
+	emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/syntax
+		doins utils/vim/*.vim
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib=
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			[[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+				"${ED}"/usr/lib/${PN}/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+			install_name_tool \
+				-change "${odylib}" \
+					"${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+				"${f}"
+			eend $?
+		done
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.2.ebuild b/sys-devel/llvm/llvm-3.2.ebuild
new file mode 100644
index 0000000..3b7ebd1
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.2.ebuild
@@ -0,0 +1,206 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils flag-o-matic multilib python-any-r1 toolchain-funcs pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz
+	!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug doc gold +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+	>=sys-devel/make-3.79
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+	doc? ( dev-python/sphinx )
+	gold? ( >=sys-devel/binutils-2.22[cxx] )
+	libffi? ( virtual/pkgconfig
+		virtual/libffi )
+	ocaml? ( dev-lang/ocaml )
+	udis86? ( dev-libs/udis86[pic(+)] )
+	${PYTHON_DEPS}"
+RDEPEND="dev-lang/perl
+	libffi? ( virtual/libffi )
+	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${P}.src
+
+pkg_setup() {
+	# Required for test and build
+	python-any-r1_pkg_setup
+
+	# need to check if the active compiler is ok
+
+	broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+	broken_gcc_x86=" 3.4.0 3.4.2 "
+	broken_gcc_amd64=" 3.4.6 "
+
+	gcc_vers=$(gcc-fullversion)
+
+	if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm."
+		elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+		elog "possible solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+		elog "Your version of gcc is known to miscompile llvm on x86"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+	then
+		elog "Your version of gcc is known to miscompile llvm in amd64"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+}
+
+src_prepare() {
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	einfo "Fixing install dirs"
+	sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+		-e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+		-e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+		-i Makefile.config.in || die "Makefile.config sed failed"
+	sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \
+		-i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
+
+	einfo "Fixing rpath and CFLAGS"
+	sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+		-e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+		-i Makefile.rules || die "rpath sed failed"
+	if use gold; then
+		sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+			-i tools/gold/Makefile || die "gold rpath sed failed"
+	fi
+
+	# FileCheck is needed at least for dragonegg tests
+	sed -e "/NO_INSTALL = 1/s/^/#/" -i utils/FileCheck/Makefile \
+		|| die "FileCheck Makefile sed failed"
+
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.0-PPC_macro.patch
+
+	# User patches
+	epatch_user
+}
+
+src_configure() {
+	local CONF_FLAGS="--enable-shared
+		--with-optimize-option=
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)"
+
+	if use multitarget; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
+	fi
+
+	if use amd64; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+	fi
+
+	if use gold; then
+		CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
+	fi
+	if use ocaml; then
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+	else
+		CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+	fi
+
+	if use udis86; then
+		CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+	fi
+
+	if use libffi; then
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+	CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+	econf ${CONF_FLAGS}
+}
+
+src_compile() {
+	emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1
+
+	if use doc; then
+		emake -C docs -f Makefile.sphinx man
+		emake -C docs -f Makefile.sphinx html
+	fi
+
+	pax-mark m Release/bin/lli
+	if use test; then
+		pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+		pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+		pax-mark m unittests/Support/Release/SupportTests
+	fi
+}
+
+src_install() {
+	emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+
+	if use doc; then
+		doman docs/_build/man/*.1
+		dohtml -r docs/_build/html/
+	else
+		doman "${WORKDIR}"/${P}-manpages/*.1
+	fi
+
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/syntax
+		doins utils/vim/*.vim
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			[[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+				"${ED}"/usr/lib/${PN}/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib)
+			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+			install_name_tool \
+				-change "${odylib}" \
+					"${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \
+				"${f}"
+			eend $?
+		done
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.3-r3.ebuild b/sys-devel/llvm/llvm-3.3-r3.ebuild
new file mode 100644
index 0000000..d3b2aa8
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.3-r3.ebuild
@@ -0,0 +1,500 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit cmake-utils eutils flag-o-matic multilib multilib-minimal \
+	python-r1 toolchain-funcs pax-utils check-reqs
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz )
+	!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS="amd64 arm ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="clang debug doc gold +libffi multitarget ocaml python
+	+static-analyzer test udis86 xml video_cards_radeon
+	kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+	libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+	ocaml? ( dev-lang/ocaml:0= )
+	udis86? ( >=dev-libs/udis86-1.7-r2:0=[pic(+),${MULTILIB_USEDEP}] )"
+DEPEND="${COMMON_DEPEND}
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-3.3-r99
+		!>=sys-devel/clang-9999 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+	pkg_pretend
+
+	# need to check if the active compiler is ok
+
+	broken_gcc=( 3.2.2 3.2.3 3.3.2 4.1.1 )
+	broken_gcc_x86=( 3.4.0 3.4.2 )
+	broken_gcc_amd64=( 3.4.6 )
+
+	gcc_vers=$(gcc-fullversion)
+
+	if has "${gcc_vers}" "${broken_gcc[@]}"; then
+		elog "Your version of gcc is known to miscompile llvm."
+		elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+		elog "possible solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if use abi_x86_32 && has "${gcc_vers}" "${broken_gcc_x86[@]}"; then
+		elog "Your version of gcc is known to miscompile llvm on x86"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if use abi_x86_64 && has "${gcc_vers}" "${broken_gcc_amd64[@]}"; then
+		elog "Your version of gcc is known to miscompile llvm in amd64"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+}
+
+src_unpack() {
+	default
+
+	rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+		|| die "symlinks removal failed"
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${P}-R600_debug.patch
+	epatch "${FILESDIR}"/${PN}-3.3-r2-gentoo-install.patch
+
+	# Hack cmake search path for Gentoo, bug #496480
+	epatch "${FILESDIR}"/${PN}-3.3-cmake-modulepath.patch
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.3-gentoo-install.patch
+
+		# backport support for g++-X.Y header location
+		epatch "${FILESDIR}"/clang-3.3-gcc-header-path.patch
+	fi
+
+	local sub_files=(
+		Makefile.config.in
+		Makefile.rules
+		tools/llvm-config/llvm-config.cpp
+	)
+	use clang && sub_files+=(
+		tools/clang/lib/Driver/Tools.cpp
+		tools/clang/tools/scan-build/scan-build
+	)
+
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	# note: we're setting the main libdir intentionally.
+	# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+	einfo "Fixing install dirs"
+	sed -e "s,@libdir@,$(get_libdir),g" \
+		-e "s,@PF@,${PF},g" \
+		-e "s,@EPREFIX@,${EPREFIX},g" \
+		-i "${sub_files[@]}" \
+		|| die "install paths sed failed"
+
+	# User patches
+	epatch_user
+
+	python_setup
+}
+
+multilib_src_configure() {
+	# disable timestamps since they confuse ccache
+	local conf_flags=(
+		--disable-timestamps
+		--enable-keep-symbols
+		--enable-shared
+		--with-optimize-option=
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)
+		$(use_enable libffi)
+	)
+
+	if use clang; then
+		conf_flags+=( --with-clang-resource-dir=../lib/clang/${PV} )
+	fi
+	# well, it's used only by clang executable c-index-test
+	if multilib_is_native_abi && use clang && use xml; then
+		conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+	else
+		conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+	fi
+
+	local targets bindings
+	if use multitarget; then
+		targets='all'
+	else
+		targets='host,cpp'
+	fi
+	conf_flags+=( --enable-targets=${targets} )
+
+	if use video_cards_radeon; then
+		conf_flags+=( --enable-experimental-targets=R600 )
+	fi
+
+	if multilib_is_native_abi; then
+		use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+		# extra commas don't hurt
+		use ocaml && bindings+=',ocaml'
+	fi
+
+	[[ ${bindings} ]] || bindings='none'
+	conf_flags+=( --enable-bindings=${bindings} )
+
+	if use udis86; then
+		conf_flags+=( --with-udis86 )
+	fi
+
+	if use libffi; then
+		local CPPFLAGS=${CPPFLAGS}
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+
+	ECONF_SOURCE=${S} \
+	econf "${conf_flags[@]}"
+
+	multilib_is_native_abi && cmake_configure
+}
+
+cmake_configure() {
+	# sadly, cmake doesn't seem to have host autodetection
+	# but it's fairly easy to steal this from configured autotools
+	local targets=$(sed -n -e 's/^TARGETS_TO_BUILD=//p' Makefile.config || die)
+	local libdir=$(get_libdir)
+
+	# cmake doesn't have R600 in 3.3
+	targets=${targets/R600 /}
+
+	local mycmakeargs=(
+		-DLLVM_TARGETS_TO_BUILD="${targets// /;}"
+		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+	)
+
+	BUILD_DIR=${S%/}_cmake \
+	cmake-utils_src_configure
+}
+
+set_makeargs() {
+	MAKEARGS=(
+		VERBOSE=1
+		REQUIRES_RTTI=1
+		GENTOO_LIBDIR=$(get_libdir)
+	)
+
+	# for tests, we want it all! otherwise, we may use a little filtering...
+	# adding ONLY_TOOLS also disables unittest building...
+	if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+		local tools=( llvm-config )
+		use clang && tools+=( clang )
+
+		if multilib_is_native_abi; then
+			tools+=(
+				opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+				llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+				llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+				llvm-size llvm-stress llvm-mcmarkup llvm-symbolizer obj2yaml
+				yaml2obj lto llvm-prof llvm-ranlib bugpoint
+			)
+
+			# those tools require 'lto' built first, so we need to delay
+			# building them to a second run
+			if [[ ${1} != -1 ]]; then
+				use gold && tools+=( gold )
+			fi
+		fi
+
+		MAKEARGS+=(
+			# filter tools + disable unittests implicitly
+			ONLY_TOOLS="${tools[*]}"
+
+			# this disables unittests & docs from clang
+			BUILD_CLANG_ONLY=YES
+		)
+	fi
+}
+
+multilib_src_compile() {
+	local MAKEARGS
+	set_makeargs -1
+	emake "${MAKEARGS[@]}"
+
+	if multilib_is_native_abi; then
+		set_makeargs
+		emake -C tools "${MAKEARGS[@]}"
+
+		if use doc; then
+			emake -C "${S}"/docs -f Makefile.sphinx man
+			use clang && emake -C "${S}"/tools/clang/docs/tools \
+				BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+			emake -C "${S}"/docs -f Makefile.sphinx html
+		fi
+	fi
+
+	if use debug; then
+		pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+		pax-mark m Debug+Asserts+Checks/bin/lli
+	else
+		pax-mark m Release/bin/llvm-rtdyld
+		pax-mark m Release/bin/lli
+	fi
+}
+
+multilib_src_test() {
+	local MAKEARGS
+	set_makeargs
+
+	# build the remaining tools & unittests
+	emake "${MAKEARGS[@]}"
+
+	pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+	pax-mark m unittests/Support/Release/SupportTests
+
+	emake "${MAKEARGS[@]}" check
+	use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	use clang && MULTILIB_WRAPPED_HEADERS+=(
+		/usr/include/clang/Config/config.h
+	)
+
+	multilib-minimal_src_install
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+	local MAKEARGS
+	set_makeargs
+
+	emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+
+	# Preserve ABI-variant of llvm-config.
+	dodir /tmp
+	mv "${ED}"/usr/bin/llvm-config "${ED}"/tmp/"${CHOST}"-llvm-config || die
+
+	if ! multilib_is_native_abi; then
+		# Drop all the executables since LLVM doesn't like to
+		# clobber when installing.
+		rm -r "${ED}"/usr/bin || die
+
+		# Backwards compat, will be happily removed someday.
+		dosym "${CHOST}"-llvm-config /tmp/llvm-config.${ABI}
+	else
+		# Move files back.
+		mv "${ED}"/tmp/*llvm-config* "${ED}"/usr/bin || die
+		# Create a symlink for host's llvm-config.
+		dosym "${CHOST}"-llvm-config /usr/bin/llvm-config
+
+		# Install docs.
+		if use doc; then
+			doman "${S}"/docs/_build/man/*.1
+			use clang && doman "${T}"/clang.1
+			dohtml -r "${S}"/docs/_build/html/
+		else
+			doman "${WORKDIR}"/${P}-manpages/*.1
+		fi
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+			dosym ../../../../$(get_libdir)/LLVMgold.so \
+				/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+		fi
+
+		# install cmake modules
+		emake -C "${S%/}"_cmake/cmake/modules DESTDIR="${D}" install
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib ; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			# + omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${lib} \
+				"${ED}"/usr/lib/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib{LTO,clang}.dylib ; do
+			# omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib)
+			ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+			install_name_tool \
+				-change "${odylib}" \
+					"${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib \
+				-change "@rpath/libclang.dylib" \
+					"${EPREFIX}"/usr/lib/libclang.dylib \
+				-change "${S}"/Release/lib/libclang.dylib \
+					"${EPREFIX}"/usr/lib/libclang.dylib \
+				"${f}"
+			eend $?
+		done
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles/syntax
+	doins utils/vim/*.vim
+
+	if use clang; then
+		cd tools/clang || die
+
+		if use static-analyzer ; then
+			dobin tools/scan-build/ccc-analyzer
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			dobin tools/scan-build/scan-build
+
+			insinto /usr/share/${PN}
+			doins tools/scan-build/scanview.css
+			doins tools/scan-build/sorttable.js
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule __init__.py cindex.py enumerations.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.4.2.ebuild b/sys-devel/llvm/llvm-3.4.2.ebuild
new file mode 100644
index 0000000..5268c28
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.4.2.ebuild
@@ -0,0 +1,543 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+# this causes some issues so make it optional for now.
+# 3.5 will have CMakeFiles support in autotools.
+WANT_CMAKE=cmake
+
+inherit cmake-utils eutils flag-o-matic multibuild multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-3.4.src.tar.gz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz
+		http://llvm.org/releases/${PV}/clang-tools-extra-3.4.src.tar.gz )
+	!doc? ( https://dev.gentoo.org/~mgorny/dist/${PN}-3.4-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.4"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold +libffi multitarget ncurses ocaml python
+	+static-analyzer test udis86 xml video_cards_radeon
+	kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	gold? ( >=sys-devel/binutils-2.22:*[cxx] )
+	libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
+	ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )
+	ocaml? ( dev-lang/ocaml:0= )
+	udis86? ( >=dev-libs/udis86-1.7-r2:0=[pic(+),${MULTILIB_USEDEP}] )"
+DEPEND="${COMMON_DEPEND}
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 >=sys-devel/llvm-3.3
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99
+		!>=sys-devel/clang-9999 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+MULTILIB_CHOST_TOOLS=(
+	/usr/bin/llvm-config
+)
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+	pkg_pretend
+
+	# need to check if the active compiler is ok
+
+	broken_gcc=( 3.2.2 3.2.3 3.3.2 4.1.1 )
+	broken_gcc_x86=( 3.4.0 3.4.2 )
+	broken_gcc_amd64=( 3.4.6 )
+
+	gcc_vers=$(gcc-fullversion)
+
+	if has "${gcc_vers}" "${broken_gcc[@]}"; then
+		elog "Your version of gcc is known to miscompile llvm."
+		elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+		elog "possible solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if use abi_x86_32 && has "${gcc_vers}" "${broken_gcc_x86[@]}"; then
+		elog "Your version of gcc is known to miscompile llvm on x86"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+
+	if use abi_x86_64 && has "${gcc_vers}" "${broken_gcc_amd64[@]}"; then
+		elog "Your version of gcc is known to miscompile llvm in amd64"
+		elog "architectures.  Check"
+		elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+		elog "solutions."
+		die "Your currently active version of gcc is known to miscompile llvm"
+	fi
+}
+
+src_unpack() {
+	default
+
+	rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+		|| die "symlinks removal failed"
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-3.4 "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-3.4 "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.4-gentoo-install.patch
+	# Hack cmake search path for Gentoo, bug #496480
+	epatch "${FILESDIR}"/${PN}-3.3-cmake-modulepath.patch
+	# Use built-in ConfigParser to avoid failures with configparser-3.2
+	# https://bugs.gentoo.org/show_bug.cgi?id=500856
+	epatch "${FILESDIR}"/${PN}-3.4-cmake-configparser.patch
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.4-gentoo-install.patch
+		epatch "${FILESDIR}"/clang-3.4-darwin_build_fix.patch
+		epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+		eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+	fi
+
+	if use prefix && use clang; then
+		sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+			projects/compiler-rt/make/platform/clang_*.mk || die
+	fi
+
+	local sub_files=(
+		Makefile.config.in
+		Makefile.rules
+		tools/llvm-config/llvm-config.cpp
+	)
+	use clang && sub_files+=(
+		tools/clang/lib/Driver/Tools.cpp
+		tools/clang/tools/scan-build/scan-build
+	)
+
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	# note: we're setting the main libdir intentionally.
+	# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+	einfo "Fixing install dirs"
+	sed -e "s,@libdir@,$(get_libdir),g" \
+		-e "s,@PF@,${PF},g" \
+		-e "s,@EPREFIX@,${EPREFIX},g" \
+		-i "${sub_files[@]}" \
+		|| die "install paths sed failed"
+
+	if use clang; then
+		# constantly fails for a long time, likely due to our patches
+		rm tools/clang/test/Driver/cross-linux.c || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+}
+
+multilib_src_configure() {
+	# disable timestamps since they confuse ccache
+	local conf_flags=(
+		--disable-timestamps
+		--enable-keep-symbols
+		--enable-shared
+		--with-optimize-option=
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)
+		$(use_enable ncurses terminfo)
+		$(use_enable libffi)
+	)
+
+	if use clang; then
+		conf_flags+=( --with-clang-resource-dir=../lib/clang/${PV} )
+	fi
+	# well, it's used only by clang executable c-index-test
+	if multilib_is_native_abi && use clang && use xml; then
+		conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+	else
+		conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+	fi
+
+	local targets bindings
+	if use multitarget; then
+		targets='all'
+	else
+		targets='host,cpp'
+		use video_cards_radeon && targets+=',r600'
+	fi
+	conf_flags+=( --enable-targets=${targets} )
+
+	if multilib_is_native_abi; then
+		use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+		# extra commas don't hurt
+		use ocaml && bindings+=',ocaml'
+	fi
+
+	[[ ${bindings} ]] || bindings='none'
+	conf_flags+=( --enable-bindings=${bindings} )
+
+	if use udis86; then
+		conf_flags+=( --with-udis86 )
+	fi
+
+	if use libffi; then
+		local CPPFLAGS=${CPPFLAGS}
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+
+	ECONF_SOURCE=${S} \
+	econf "${conf_flags[@]}"
+
+	multilib_is_native_abi && cmake_configure
+}
+
+cmake_configure() {
+	# sadly, cmake doesn't seem to have host autodetection
+	# but it's fairly easy to steal this from configured autotools
+	local targets=$(sed -n -e 's/^TARGETS_TO_BUILD=//p' Makefile.config || die)
+	local libdir=$(get_libdir)
+	local mycmakeargs=(
+		# just the stuff needed to get correct cmake modules
+		$(cmake-utils_use ncurses LLVM_ENABLE_TERMINFO)
+
+		-DLLVM_TARGETS_TO_BUILD="${targets// /;}"
+		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+	)
+
+	BUILD_DIR=${S%/}_cmake \
+	cmake-utils_src_configure
+}
+
+set_makeargs() {
+	MAKEARGS=(
+		VERBOSE=1
+		REQUIRES_RTTI=1
+		GENTOO_LIBDIR=$(get_libdir)
+	)
+
+	# for tests, we want it all! otherwise, we may use a little filtering...
+	# adding ONLY_TOOLS also disables unittest building...
+	if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+		local tools=( llvm-config )
+		use clang && tools+=( clang )
+
+		if multilib_is_native_abi; then
+			tools+=(
+				opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+				llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+				llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+				llvm-size llvm-stress llvm-mcmarkup llvm-symbolizer obj2yaml
+				yaml2obj lto bugpoint
+			)
+
+			# the build system runs explicitly specified tools in parallel,
+			# so we need to split it into two runs
+			if [[ ${1} != -1 ]]; then
+				# those require lto
+				tools+=( llvm-lto )
+				use gold && tools+=( gold )
+
+				# those require clang :)
+				# we need to explicitly specify all its tools
+				# since we're passing BUILD_CLANG_ONLY
+				use clang && tools+=(
+					clang/tools/{clang-check,clang-format,extra}
+				)
+			fi
+		fi
+
+		MAKEARGS+=(
+			# filter tools + disable unittests implicitly
+			ONLY_TOOLS="${tools[*]}"
+
+			# this disables unittests & docs from clang
+			BUILD_CLANG_ONLY=YES
+		)
+	fi
+}
+
+multilib_src_compile() {
+	local MAKEARGS
+	set_makeargs -1
+	emake "${MAKEARGS[@]}"
+
+	if multilib_is_native_abi; then
+		set_makeargs
+		emake -C tools "${MAKEARGS[@]}"
+
+		if use doc; then
+			emake -C "${S}"/docs -f Makefile.sphinx man
+			use clang && emake -C "${S}"/tools/clang/docs/tools \
+				BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+			emake -C "${S}"/docs -f Makefile.sphinx html
+		fi
+	fi
+
+	if use debug; then
+		pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+		pax-mark m Debug+Asserts+Checks/bin/lli
+		pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+	else
+		pax-mark m Release/bin/llvm-rtdyld
+		pax-mark m Release/bin/lli
+		pax-mark m Release/bin/lli-child-target
+	fi
+}
+
+multilib_src_test() {
+	local MAKEARGS
+	set_makeargs
+
+	# build the remaining tools & unittests
+	emake "${MAKEARGS[@]}"
+
+	pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+	pax-mark m unittests/Support/Release/SupportTests
+
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+	emake "${MAKEARGS[@]}" check
+	use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	use clang && MULTILIB_WRAPPED_HEADERS+=(
+		/usr/include/clang/Config/config.h
+	)
+
+	multilib-minimal_src_install
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+	local MAKEARGS
+	set_makeargs
+
+	local root=${D}/_${ABI}
+
+	emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+	multibuild_merge_root "${root}" "${D}"
+
+	if ! multilib_is_native_abi; then
+		# Backwards compat, will be happily removed someday.
+		dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+	else
+		# Install docs.
+		if use doc; then
+			doman "${S}"/docs/_build/man/*.1
+			use clang && doman "${T}"/clang.1
+			dohtml -r "${S}"/docs/_build/html/
+		else
+			if ! use clang; then
+				rm "${WORKDIR}"/${PN}-3.4-manpages/clang.1 || die
+			fi
+			doman "${WORKDIR}"/${PN}-3.4-manpages/*.1
+		fi
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+			dosym ../../../../$(get_libdir)/LLVMgold.so \
+				/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+		fi
+
+		# install cmake modules
+		if use cmake; then
+			emake -C "${S%/}"_cmake/cmake/modules DESTDIR="${D}" install
+		fi
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= ndylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		libpvminor=${libpv%.[0-9]*}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			# + omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${lib} \
+				"${ED}"/usr/lib/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+			# omit clang libs if not enabled
+			[[ -f "${f}" ]] || continue
+
+			scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+			while read odylib ; do
+				ndylib=
+				case ${odylib} in
+					*/libclang.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+						;;
+					*/libLLVM-${libpv}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+						;;
+					*/libLLVM-${libpvminor}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+						;;
+					*/libLTO.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+						;;
+				esac
+				if [[ -n ${ndylib} ]] ; then
+					ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+					install_name_tool \
+						-change "${odylib}" "${ndylib}" \
+						"${f}"
+					eend $?
+				fi
+			done
+		done
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles/syntax
+	doins utils/vim/*.vim
+
+	if use clang; then
+		cd tools/clang || die
+
+		if use static-analyzer ; then
+			dobin tools/scan-build/ccc-analyzer
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			dobin tools/scan-build/scan-build
+
+			insinto /usr/share/${PN}
+			doins tools/scan-build/scanview.css
+			doins tools/scan-build/sorttable.js
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule __init__.py cindex.py enumerations.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.5.0.ebuild b/sys-devel/llvm/llvm-3.5.0.ebuild
new file mode 100644
index 0000000..d6019fc
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.5.0.ebuild
@@ -0,0 +1,530 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+	!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="amd64 arm ppc ppc64 ~sparc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+	+static-analyzer test xml video_cards_radeon
+	kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	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}] )
+	ocaml? ( dev-lang/ocaml:0= )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	app-arch/xz-utils
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	!!<dev-python/configparser-3.3.0.2
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99
+		!>=sys-devel/clang-9999 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	default
+
+	rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+		|| die "symlinks removal failed"
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch
+
+	epatch "${FILESDIR}"/${P}-fix_LLVMExports_cmake.patch
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch
+		epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+		eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+	fi
+
+	if use prefix && use clang; then
+		sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+			projects/compiler-rt/make/platform/clang_*.mk || die
+	fi
+
+	local sub_files=(
+		Makefile.config.in
+		Makefile.rules
+		tools/llvm-config/llvm-config.cpp
+	)
+	use clang && sub_files+=(
+		tools/clang/lib/Driver/Tools.cpp
+		tools/clang/tools/scan-build/scan-build
+	)
+
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	# note: we're setting the main libdir intentionally.
+	# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+	einfo "Fixing install dirs"
+	sed -e "s,@libdir@,$(get_libdir),g" \
+		-e "s,@PF@,${PF},g" \
+		-e "s,@EPREFIX@,${EPREFIX},g" \
+		-i "${sub_files[@]}" \
+		|| die "install paths sed failed"
+
+	if use clang; then
+		# constantly fails for a long time, likely due to our patches
+		rm tools/clang/test/Driver/cross-linux.c || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+}
+
+multilib_src_configure() {
+	# disable timestamps since they confuse ccache
+	local conf_flags=(
+		--disable-timestamps
+		--enable-keep-symbols
+		--enable-shared
+		--with-optimize-option=
+		$(tc-is-static-only && echo --disable-shared)
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)
+		$(use_enable libedit)
+		$(use_enable ncurses terminfo)
+		$(use_enable libffi)
+	)
+
+	# well, it's used only by clang executable c-index-test
+	if multilib_is_native_abi && use clang && use xml; then
+		conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+	else
+		conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+	fi
+
+	local targets bindings
+	if use multitarget; then
+		targets='all'
+	else
+		targets='host,cpp'
+		use video_cards_radeon && targets+=',r600'
+	fi
+	conf_flags+=( --enable-targets=${targets} )
+
+	if multilib_is_native_abi; then
+		use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+		# extra commas don't hurt
+		use ocaml && bindings+=',ocaml'
+	fi
+
+	[[ ${bindings} ]] || bindings='none'
+	conf_flags+=( --enable-bindings=${bindings} )
+
+	if use libffi; then
+		local CPPFLAGS=${CPPFLAGS}
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+
+	ECONF_SOURCE=${S} \
+	econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+	MAKEARGS=(
+		VERBOSE=1
+		REQUIRES_RTTI=1
+		GENTOO_LIBDIR=$(get_libdir)
+	)
+
+	# for tests, we want it all! otherwise, we may use a little filtering...
+	# adding ONLY_TOOLS also disables unittest building...
+	if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+		local tools=( llvm-config )
+		use clang && tools+=( clang )
+
+		if multilib_is_native_abi; then
+			tools+=(
+				opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+				llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+				llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+				llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+				llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+			)
+
+			# the build system runs explicitly specified tools in parallel,
+			# so we need to split it into two runs
+			if [[ ${1} != -1 ]]; then
+				# those require lto
+				tools+=( llvm-lto )
+				use gold && tools+=( gold )
+
+				# those require clang :)
+				# we need to explicitly specify all its tools
+				# since we're passing BUILD_CLANG_ONLY
+				use clang && tools+=(
+					clang/tools/{clang-check,clang-format,extra}
+				)
+			fi
+		fi
+
+		MAKEARGS+=(
+			# filter tools + disable unittests implicitly
+			ONLY_TOOLS="${tools[*]}"
+
+			# this disables unittests & docs from clang
+			BUILD_CLANG_ONLY=YES
+		)
+	fi
+}
+
+multilib_src_compile() {
+	local MAKEARGS
+	set_makeargs -1
+	emake "${MAKEARGS[@]}"
+
+	if multilib_is_native_abi; then
+		set_makeargs
+		emake -C tools "${MAKEARGS[@]}"
+
+		if use doc; then
+			emake -C "${S}"/docs -f Makefile.sphinx man
+			use clang && emake -C "${S}"/tools/clang/docs/tools \
+				BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+			emake -C "${S}"/docs -f Makefile.sphinx html
+		fi
+	fi
+
+	if use debug; then
+		pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+		pax-mark m Debug+Asserts+Checks/bin/lli
+		pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+	else
+		pax-mark m Release/bin/llvm-rtdyld
+		pax-mark m Release/bin/lli
+		pax-mark m Release/bin/lli-child-target
+	fi
+}
+
+multilib_src_test() {
+	local MAKEARGS
+	set_makeargs
+
+	# build the remaining tools & unittests
+	emake "${MAKEARGS[@]}"
+
+	pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+	pax-mark m unittests/Support/Release/SupportTests
+
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+	emake "${MAKEARGS[@]}" check
+	use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied below
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-${PV}
+			/usr/bin/clang++-${PV}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+	local MAKEARGS
+	set_makeargs
+
+	local root=${D}/_${ABI}
+
+	emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+	multibuild_merge_root "${root}" "${D}"
+
+	if ! multilib_is_native_abi; then
+		# Backwards compat, will be happily removed someday.
+		dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+	else
+		# Install docs.
+		if use doc; then
+			doman "${S}"/docs/_build/man/*.1
+			use clang && doman "${T}"/clang.1
+			dohtml -r "${S}"/docs/_build/html/
+		else
+			if ! use clang; then
+				rm "${WORKDIR}"/${P}-manpages/clang.1 || die
+			fi
+			doman "${WORKDIR}"/${P}-manpages/*.1
+		fi
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+			dosym ../../../../$(get_libdir)/LLVMgold.so \
+				/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+		fi
+	fi
+
+	# apply CHOST and PV to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ )
+		local i
+
+		# append ${PV} and symlink back
+		# TODO: use alternatives.eclass? does that make any sense?
+		# maybe with USE=-clang on :0 and USE=clang on older
+		for i in "${clang_tools[@]}"; do
+			mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+			dosym "${i}"-${PV} /usr/bin/${i}
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${PV}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${PV}"
+			done
+		fi
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= ndylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		libpvminor=${libpv%.[0-9]*}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			# + omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${lib} \
+				"${ED}"/usr/lib/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+			# omit clang libs if not enabled
+			[[ -f "${f}" ]] || continue
+
+			scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+			while read odylib ; do
+				ndylib=
+				case ${odylib} in
+					*/libclang.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+						;;
+					*/libLLVM-${libpv}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+						;;
+					*/libLLVM-${libpvminor}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+						;;
+					*/libLTO.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+						;;
+				esac
+				if [[ -n ${ndylib} ]] ; then
+					ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+					install_name_tool \
+						-change "${odylib}" "${ndylib}" \
+						"${f}"
+					eend $?
+				fi
+			done
+		done
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles/syntax
+	doins utils/vim/*.vim
+
+	if use clang; then
+		cd tools/clang || die
+
+		if use static-analyzer ; then
+			dobin tools/scan-build/ccc-analyzer
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			dobin tools/scan-build/scan-build
+
+			insinto /usr/share/${PN}
+			doins tools/scan-build/scanview.css
+			doins tools/scan-build/sorttable.js
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule __init__.py cindex.py enumerations.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.5.1.ebuild b/sys-devel/llvm/llvm-3.5.1.ebuild
new file mode 100644
index 0000000..52f8309
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.5.1.ebuild
@@ -0,0 +1,530 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+	!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.5.0-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+	+static-analyzer test xml video_cards_radeon
+	kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	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}] )
+	ocaml? ( dev-lang/ocaml:0= )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	app-arch/xz-utils
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	!!<dev-python/configparser-3.3.0.2
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99
+		!>=sys-devel/clang-9999 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	default
+
+	rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+		|| die "symlinks removal failed"
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch
+	# Make ocaml warnings non-fatal, bug #537308
+	sed -e "/RUN/s/-warn-error A//" -i test/Bindings/Ocaml/*ml  || die
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch
+		epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+		eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+	fi
+
+	if use prefix && use clang; then
+		sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+			projects/compiler-rt/make/platform/clang_*.mk || die
+	fi
+
+	local sub_files=(
+		Makefile.config.in
+		Makefile.rules
+		tools/llvm-config/llvm-config.cpp
+	)
+	use clang && sub_files+=(
+		tools/clang/lib/Driver/Tools.cpp
+		tools/clang/tools/scan-build/scan-build
+	)
+
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	# note: we're setting the main libdir intentionally.
+	# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+	einfo "Fixing install dirs"
+	sed -e "s,@libdir@,$(get_libdir),g" \
+		-e "s,@PF@,${PF},g" \
+		-e "s,@EPREFIX@,${EPREFIX},g" \
+		-i "${sub_files[@]}" \
+		|| die "install paths sed failed"
+
+	if use clang; then
+		# constantly fails for a long time, likely due to our patches
+		rm tools/clang/test/Driver/cross-linux.c || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+}
+
+multilib_src_configure() {
+	# disable timestamps since they confuse ccache
+	local conf_flags=(
+		--disable-timestamps
+		--enable-keep-symbols
+		--enable-shared
+		--with-optimize-option=
+		$(tc-is-static-only && echo --disable-shared)
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)
+		$(use_enable libedit)
+		$(use_enable ncurses terminfo)
+		$(use_enable libffi)
+	)
+
+	# well, it's used only by clang executable c-index-test
+	if multilib_is_native_abi && use clang && use xml; then
+		conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+	else
+		conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+	fi
+
+	local targets bindings
+	if use multitarget; then
+		targets='all'
+	else
+		targets='host,cpp'
+		use video_cards_radeon && targets+=',r600'
+	fi
+	conf_flags+=( --enable-targets=${targets} )
+
+	if multilib_is_native_abi; then
+		use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+		# extra commas don't hurt
+		use ocaml && bindings+=',ocaml'
+	fi
+
+	[[ ${bindings} ]] || bindings='none'
+	conf_flags+=( --enable-bindings=${bindings} )
+
+	if use libffi; then
+		local CPPFLAGS=${CPPFLAGS}
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+
+	ECONF_SOURCE=${S} \
+	econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+	MAKEARGS=(
+		VERBOSE=1
+		REQUIRES_RTTI=1
+		GENTOO_LIBDIR=$(get_libdir)
+	)
+
+	# for tests, we want it all! otherwise, we may use a little filtering...
+	# adding ONLY_TOOLS also disables unittest building...
+	if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+		local tools=( llvm-config )
+		use clang && tools+=( clang )
+
+		if multilib_is_native_abi; then
+			tools+=(
+				opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+				llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+				llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+				llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+				llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+			)
+
+			# the build system runs explicitly specified tools in parallel,
+			# so we need to split it into two runs
+			if [[ ${1} != -1 ]]; then
+				# those require lto
+				tools+=( llvm-lto )
+				use gold && tools+=( gold )
+
+				# those require clang :)
+				# we need to explicitly specify all its tools
+				# since we're passing BUILD_CLANG_ONLY
+				use clang && tools+=(
+					clang/tools/{clang-check,clang-format,extra}
+				)
+			fi
+		fi
+
+		MAKEARGS+=(
+			# filter tools + disable unittests implicitly
+			ONLY_TOOLS="${tools[*]}"
+
+			# this disables unittests & docs from clang
+			BUILD_CLANG_ONLY=YES
+		)
+	fi
+}
+
+multilib_src_compile() {
+	local MAKEARGS
+	set_makeargs -1
+	emake "${MAKEARGS[@]}"
+
+	if multilib_is_native_abi; then
+		set_makeargs
+		emake -C tools "${MAKEARGS[@]}"
+
+		if use doc; then
+			emake -C "${S}"/docs -f Makefile.sphinx man
+			use clang && emake -C "${S}"/tools/clang/docs/tools \
+				BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+			emake -C "${S}"/docs -f Makefile.sphinx html
+		fi
+	fi
+
+	if use debug; then
+		pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+		pax-mark m Debug+Asserts+Checks/bin/lli
+		pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+	else
+		pax-mark m Release/bin/llvm-rtdyld
+		pax-mark m Release/bin/lli
+		pax-mark m Release/bin/lli-child-target
+	fi
+}
+
+multilib_src_test() {
+	local MAKEARGS
+	set_makeargs
+
+	# build the remaining tools & unittests
+	emake "${MAKEARGS[@]}"
+
+	pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+	pax-mark m unittests/Support/Release/SupportTests
+
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+	emake "${MAKEARGS[@]}" check
+	use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied below
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-${PV}
+			/usr/bin/clang++-${PV}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+	local MAKEARGS
+	set_makeargs
+
+	local root=${D}/_${ABI}
+
+	emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+	multibuild_merge_root "${root}" "${D}"
+
+	if ! multilib_is_native_abi; then
+		# Backwards compat, will be happily removed someday.
+		dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+	else
+		# Install docs.
+		if use doc; then
+			doman "${S}"/docs/_build/man/*.1
+			use clang && doman "${T}"/clang.1
+			dohtml -r "${S}"/docs/_build/html/
+		else
+			if ! use clang; then
+				rm "${WORKDIR}"/${PN}-3.5.0-manpages/clang.1 || die
+			fi
+			doman "${WORKDIR}"/${PN}-3.5.0-manpages/*.1
+		fi
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+			dosym ../../../../$(get_libdir)/LLVMgold.so \
+				/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+		fi
+	fi
+
+	# apply CHOST and PV to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ )
+		local i
+
+		# append ${PV} and symlink back
+		# TODO: use alternatives.eclass? does that make any sense?
+		# maybe with USE=-clang on :0 and USE=clang on older
+		for i in "${clang_tools[@]}"; do
+			mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+			dosym "${i}"-${PV} /usr/bin/${i}
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${PV}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${PV}"
+			done
+		fi
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= ndylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		libpvminor=${libpv%.[0-9]*}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			# + omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${lib} \
+				"${ED}"/usr/lib/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+			# omit clang libs if not enabled
+			[[ -f "${f}" ]] || continue
+
+			scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+			while read odylib ; do
+				ndylib=
+				case ${odylib} in
+					*/libclang.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+						;;
+					*/libLLVM-${libpv}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+						;;
+					*/libLLVM-${libpvminor}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+						;;
+					*/libLTO.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+						;;
+				esac
+				if [[ -n ${ndylib} ]] ; then
+					ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+					install_name_tool \
+						-change "${odylib}" "${ndylib}" \
+						"${f}"
+					eend $?
+				fi
+			done
+		done
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles/syntax
+	doins utils/vim/*.vim
+
+	if use clang; then
+		cd tools/clang || die
+
+		if use static-analyzer ; then
+			dobin tools/scan-build/ccc-analyzer
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			dobin tools/scan-build/scan-build
+
+			insinto /usr/share/${PN}
+			doins tools/scan-build/scanview.css
+			doins tools/scan-build/sorttable.js
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule __init__.py cindex.py enumerations.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.5.2.ebuild b/sys-devel/llvm/llvm-3.5.2.ebuild
new file mode 100644
index 0000000..8a8c32c
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.5.2.ebuild
@@ -0,0 +1,532 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+	!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.5.0-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.5"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+	+static-analyzer test xml video_cards_radeon
+	kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	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}] )
+	ocaml? ( dev-lang/ocaml:0= )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	app-arch/xz-utils
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.3
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	kernel_Darwin? ( sys-libs/libcxx )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	!!<dev-python/configparser-3.3.0.2
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99
+		!>=sys-devel/clang-9999 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	default
+
+	rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+		|| die "symlinks removal failed"
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch
+	epatch "${FILESDIR}"/${P}-gcc-5.1.patch
+	# Make ocaml warnings non-fatal, bug #537308
+	sed -e "/RUN/s/-warn-error A//" -i test/Bindings/Ocaml/*ml  || die
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch
+		epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+		eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+	fi
+
+	if use prefix && use clang; then
+		sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+			projects/compiler-rt/make/platform/clang_*.mk || die
+	fi
+
+	local sub_files=(
+		Makefile.config.in
+		Makefile.rules
+		tools/llvm-config/llvm-config.cpp
+	)
+	use clang && sub_files+=(
+		tools/clang/lib/Driver/Tools.cpp
+		tools/clang/tools/scan-build/scan-build
+	)
+
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	# note: we're setting the main libdir intentionally.
+	# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+	einfo "Fixing install dirs"
+	sed -e "s,@libdir@,$(get_libdir),g" \
+		-e "s,@PF@,${PF},g" \
+		-e "s,@EPREFIX@,${EPREFIX},g" \
+		-i "${sub_files[@]}" \
+		|| die "install paths sed failed"
+
+	if use clang; then
+		# constantly fails for a long time, likely due to our patches
+		rm tools/clang/test/Driver/cross-linux.c || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+}
+
+multilib_src_configure() {
+	# disable timestamps since they confuse ccache
+	local conf_flags=(
+		--disable-timestamps
+		--enable-keep-symbols
+		--enable-shared
+		--with-optimize-option=
+		$(tc-is-static-only && echo --disable-shared)
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)
+		$(use_enable libedit)
+		$(use_enable ncurses terminfo)
+		$(use_enable libffi)
+	)
+
+	# well, it's used only by clang executable c-index-test
+	if multilib_is_native_abi && use clang && use xml; then
+		conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+	else
+		conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+	fi
+
+	local targets bindings
+	if use multitarget; then
+		targets='all'
+	else
+		targets='host,cpp'
+		use video_cards_radeon && targets+=',r600'
+	fi
+	conf_flags+=( --enable-targets=${targets} )
+
+	if multilib_is_native_abi; then
+		use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+		# extra commas don't hurt
+		use ocaml && bindings+=',ocaml'
+	fi
+
+	[[ ${bindings} ]] || bindings='none'
+	conf_flags+=( --enable-bindings=${bindings} )
+
+	if use libffi; then
+		local CPPFLAGS=${CPPFLAGS}
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+
+	ECONF_SOURCE=${S} \
+	econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+	MAKEARGS=(
+		VERBOSE=1
+		REQUIRES_RTTI=1
+		GENTOO_LIBDIR=$(get_libdir)
+	)
+
+	# for tests, we want it all! otherwise, we may use a little filtering...
+	# adding ONLY_TOOLS also disables unittest building...
+	if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+		local tools=( llvm-config )
+		use clang && tools+=( clang )
+
+		if multilib_is_native_abi; then
+			tools+=(
+				opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+				llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+				llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+				llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+				llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+			)
+
+			# the build system runs explicitly specified tools in parallel,
+			# so we need to split it into two runs
+			if [[ ${1} != -1 ]]; then
+				# those require lto
+				tools+=( llvm-lto )
+				use gold && tools+=( gold )
+
+				# those require clang :)
+				# we need to explicitly specify all its tools
+				# since we're passing BUILD_CLANG_ONLY
+				use clang && tools+=(
+					clang/tools/{clang-check,clang-format,extra}
+				)
+			fi
+		fi
+
+		MAKEARGS+=(
+			# filter tools + disable unittests implicitly
+			ONLY_TOOLS="${tools[*]}"
+
+			# this disables unittests & docs from clang
+			BUILD_CLANG_ONLY=YES
+		)
+	fi
+}
+
+multilib_src_compile() {
+	local MAKEARGS
+	set_makeargs -1
+	emake "${MAKEARGS[@]}"
+
+	if multilib_is_native_abi; then
+		set_makeargs
+		emake -C tools "${MAKEARGS[@]}"
+
+		if use doc; then
+			emake -C "${S}"/docs -f Makefile.sphinx man
+			use clang && emake -C "${S}"/tools/clang/docs/tools \
+				BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+			emake -C "${S}"/docs -f Makefile.sphinx html
+		fi
+	fi
+
+	if use debug; then
+		pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+		pax-mark m Debug+Asserts+Checks/bin/lli
+		pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+	else
+		pax-mark m Release/bin/llvm-rtdyld
+		pax-mark m Release/bin/lli
+		pax-mark m Release/bin/lli-child-target
+	fi
+}
+
+multilib_src_test() {
+	local MAKEARGS
+	set_makeargs
+
+	# build the remaining tools & unittests
+	emake "${MAKEARGS[@]}"
+
+	pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+	pax-mark m unittests/Support/Release/SupportTests
+
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+	emake "${MAKEARGS[@]}" check
+	use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied below
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-${PV}
+			/usr/bin/clang++-${PV}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+	local MAKEARGS
+	set_makeargs
+
+	local root=${D}/_${ABI}
+
+	emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+	multibuild_merge_root "${root}" "${D}"
+
+	if ! multilib_is_native_abi; then
+		# Backwards compat, will be happily removed someday.
+		dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+	else
+		# Install docs.
+		if use doc; then
+			doman "${S}"/docs/_build/man/*.1
+			use clang && doman "${T}"/clang.1
+			dohtml -r "${S}"/docs/_build/html/
+		else
+			if ! use clang; then
+				rm "${WORKDIR}"/${PN}-3.5.0-manpages/clang.1 || die
+			fi
+			doman "${WORKDIR}"/${PN}-3.5.0-manpages/*.1
+		fi
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+			dosym ../../../../$(get_libdir)/LLVMgold.so \
+				/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+		fi
+	fi
+
+	# apply CHOST and PV to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ )
+		local i
+
+		# append ${PV} and symlink back
+		# TODO: use alternatives.eclass? does that make any sense?
+		# maybe with USE=-clang on :0 and USE=clang on older
+		for i in "${clang_tools[@]}"; do
+			mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+			dosym "${i}"-${PV} /usr/bin/${i}
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${PV}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${PV}"
+			done
+		fi
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= ndylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		libpvminor=${libpv%.[0-9]*}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			# + omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${lib} \
+				"${ED}"/usr/lib/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+			# omit clang libs if not enabled
+			[[ -f "${f}" ]] || continue
+
+			scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+			while read odylib ; do
+				ndylib=
+				case ${odylib} in
+					*/libclang.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+						;;
+					*/libLLVM-${libpv}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+						;;
+					*/libLLVM-${libpvminor}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+						;;
+					*/libLTO.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+						;;
+				esac
+				if [[ -n ${ndylib} ]] ; then
+					ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+					install_name_tool \
+						-change "${odylib}" "${ndylib}" \
+						"${f}"
+					eend $?
+				fi
+			done
+		done
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles/syntax
+	doins utils/vim/*.vim
+
+	if use clang; then
+		cd tools/clang || die
+
+		if use static-analyzer ; then
+			dobin tools/scan-build/ccc-analyzer
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			dobin tools/scan-build/scan-build
+
+			insinto /usr/share/${PN}
+			doins tools/scan-build/scanview.css
+			doins tools/scan-build/sorttable.js
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule __init__.py cindex.py enumerations.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.6.0.ebuild b/sys-devel/llvm/llvm-3.6.0.ebuild
new file mode 100644
index 0000000..b789793
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.6.0.ebuild
@@ -0,0 +1,534 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+	!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+	+static-analyzer test xml video_cards_radeon
+	kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	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}] )
+	ocaml? (
+		dev-lang/ocaml:0=
+		dev-ml/findlib
+		dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	app-arch/xz-utils
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	!!<dev-python/configparser-3.3.0.2
+	ocaml? ( test? ( dev-ml/ounit ) )
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99
+		!>=sys-devel/clang-9999 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P/_}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	default
+
+	rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+		|| die "symlinks removal failed"
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+	epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch
+	# Make ocaml warnings non-fatal, bug #537308
+	sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml  || die
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+		epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+		eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+	fi
+
+	if use prefix && use clang; then
+		sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+			projects/compiler-rt/make/platform/clang_*.mk || die
+	fi
+
+	local sub_files=(
+		Makefile.config.in
+		Makefile.rules
+		tools/llvm-config/llvm-config.cpp
+	)
+	use clang && sub_files+=(
+		tools/clang/lib/Driver/Tools.cpp
+		tools/clang/tools/scan-build/scan-build
+	)
+
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	# note: we're setting the main libdir intentionally.
+	# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+	einfo "Fixing install dirs"
+	sed -e "s,@libdir@,$(get_libdir),g" \
+		-e "s,@PF@,${PF},g" \
+		-e "s,@EPREFIX@,${EPREFIX},g" \
+		-i "${sub_files[@]}" \
+		|| die "install paths sed failed"
+
+	if use clang; then
+		# constantly fails for a long time, likely due to our patches
+		rm tools/clang/test/Driver/cross-linux.c || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+}
+
+multilib_src_configure() {
+	# disable timestamps since they confuse ccache
+	local conf_flags=(
+		--disable-timestamps
+		--enable-keep-symbols
+		--enable-shared
+		--with-optimize-option=
+		$(tc-is-static-only && echo --disable-shared)
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)
+		$(use_enable libedit)
+		$(use_enable ncurses terminfo)
+		$(use_enable libffi)
+	)
+
+	# well, it's used only by clang executable c-index-test
+	if multilib_is_native_abi && use clang && use xml; then
+		conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+	else
+		conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+	fi
+
+	local targets bindings
+	if use multitarget; then
+		targets='all'
+	else
+		targets='host,cpp'
+		use video_cards_radeon && targets+=',r600'
+	fi
+	conf_flags+=( --enable-targets=${targets} )
+
+	if multilib_is_native_abi; then
+		use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+		# extra commas don't hurt
+		use ocaml && bindings+=',ocaml'
+	fi
+
+	[[ ${bindings} ]] || bindings='none'
+	conf_flags+=( --enable-bindings=${bindings} )
+
+	if use libffi; then
+		local CPPFLAGS=${CPPFLAGS}
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+
+	ECONF_SOURCE=${S} \
+	econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+	MAKEARGS=(
+		VERBOSE=1
+		REQUIRES_RTTI=1
+		GENTOO_LIBDIR=$(get_libdir)
+	)
+
+	# for tests, we want it all! otherwise, we may use a little filtering...
+	# adding ONLY_TOOLS also disables unittest building...
+	if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+		local tools=( llvm-config )
+		use clang && tools+=( clang )
+
+		if multilib_is_native_abi; then
+			tools+=(
+				opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+				llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+				llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+				llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+				llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+			)
+
+			# the build system runs explicitly specified tools in parallel,
+			# so we need to split it into two runs
+			if [[ ${1} != -1 ]]; then
+				# those require lto
+				tools+=( llvm-lto )
+				use gold && tools+=( gold )
+
+				# those require clang :)
+				# we need to explicitly specify all its tools
+				# since we're passing BUILD_CLANG_ONLY
+				use clang && tools+=(
+					clang/tools/{clang-check,clang-format,extra}
+				)
+			fi
+		fi
+
+		MAKEARGS+=(
+			# filter tools + disable unittests implicitly
+			ONLY_TOOLS="${tools[*]}"
+
+			# this disables unittests & docs from clang
+			BUILD_CLANG_ONLY=YES
+		)
+	fi
+}
+
+multilib_src_compile() {
+	local MAKEARGS
+	set_makeargs -1
+	emake "${MAKEARGS[@]}"
+
+	if multilib_is_native_abi; then
+		set_makeargs
+		emake -C tools "${MAKEARGS[@]}"
+
+		if use doc; then
+			emake -C "${S}"/docs -f Makefile.sphinx man
+			use clang && emake -C "${S}"/tools/clang/docs/tools \
+				BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+			emake -C "${S}"/docs -f Makefile.sphinx html
+		fi
+	fi
+
+	if use debug; then
+		pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+		pax-mark m Debug+Asserts+Checks/bin/lli
+		pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+	else
+		pax-mark m Release/bin/llvm-rtdyld
+		pax-mark m Release/bin/lli
+		pax-mark m Release/bin/lli-child-target
+	fi
+}
+
+multilib_src_test() {
+	local MAKEARGS
+	set_makeargs
+
+	# build the remaining tools & unittests
+	emake "${MAKEARGS[@]}"
+
+	pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+	pax-mark m unittests/Support/Release/SupportTests
+
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+	emake "${MAKEARGS[@]}" check
+	use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied below
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-${PV}
+			/usr/bin/clang++-${PV}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+	local MAKEARGS
+	set_makeargs
+
+	local root=${D}/_${ABI}
+
+	emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+	multibuild_merge_root "${root}" "${D}"
+
+	if ! multilib_is_native_abi; then
+		# Backwards compat, will be happily removed someday.
+		dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+	else
+		# Install docs.
+		if use doc; then
+			doman "${S}"/docs/_build/man/*.1
+			use clang && doman "${T}"/clang.1
+			dohtml -r "${S}"/docs/_build/html/
+		else
+			if ! use clang; then
+				rm "${WORKDIR}"/${P}-manpages/clang.1 || die
+			fi
+			doman "${WORKDIR}"/${P}-manpages/*.1
+		fi
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+			dosym ../../../../$(get_libdir)/LLVMgold.so \
+				/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+		fi
+	fi
+
+	# apply CHOST and PV to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ )
+		local i
+
+		# append ${PV} and symlink back
+		# TODO: use alternatives.eclass? does that make any sense?
+		# maybe with USE=-clang on :0 and USE=clang on older
+		for i in "${clang_tools[@]}"; do
+			mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+			dosym "${i}"-${PV} /usr/bin/${i}
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${PV}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${PV}"
+			done
+		fi
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= ndylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		libpvminor=${libpv%.[0-9]*}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			# + omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${lib} \
+				"${ED}"/usr/lib/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+			# omit clang libs if not enabled
+			[[ -f "${f}" ]] || continue
+
+			scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+			while read odylib ; do
+				ndylib=
+				case ${odylib} in
+					*/libclang.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+						;;
+					*/libLLVM-${libpv}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+						;;
+					*/libLLVM-${libpvminor}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+						;;
+					*/libLTO.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+						;;
+				esac
+				if [[ -n ${ndylib} ]] ; then
+					ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+					install_name_tool \
+						-change "${odylib}" "${ndylib}" \
+						"${f}"
+					eend $?
+				fi
+			done
+		done
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles/syntax
+	doins utils/vim/*.vim
+
+	if use clang; then
+		cd tools/clang || die
+
+		if use static-analyzer ; then
+			dobin tools/scan-build/ccc-analyzer
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			dobin tools/scan-build/scan-build
+
+			insinto /usr/share/${PN}
+			doins tools/scan-build/scanview.css
+			doins tools/scan-build/sorttable.js
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule __init__.py cindex.py enumerations.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.6.1.ebuild b/sys-devel/llvm/llvm-3.6.1.ebuild
new file mode 100644
index 0000000..6cc8a46
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.6.1.ebuild
@@ -0,0 +1,541 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+	!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+	+static-analyzer test xml video_cards_radeon
+	kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	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}] )
+	ocaml? (
+		dev-lang/ocaml:0=
+		dev-ml/findlib
+		dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	app-arch/xz-utils
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	kernel_Darwin? ( sys-libs/libcxx )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	!!<dev-python/configparser-3.3.0.2
+	ocaml? ( test? ( dev-ml/ounit ) )
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99
+		!>=sys-devel/clang-9999 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P/_}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	default
+
+	rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+		|| die "symlinks removal failed"
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+	epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch
+	epatch "${FILESDIR}"/${PN}-3.6.0-ocaml-ctypes-0.4.0.patch
+	# Make ocaml warnings non-fatal, bug #537308
+	sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml  || die
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+		epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+		eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+
+		# Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444
+		epatch "${FILESDIR}"/clang-3.6-fbsd-gcc49.patch
+	fi
+
+	if use prefix && use clang; then
+		sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+			projects/compiler-rt/make/platform/clang_*.mk || die
+	fi
+
+	local sub_files=(
+		Makefile.config.in
+		Makefile.rules
+		tools/llvm-config/llvm-config.cpp
+	)
+	use clang && sub_files+=(
+		tools/clang/lib/Driver/Tools.cpp
+		tools/clang/tools/scan-build/scan-build
+	)
+
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	# note: we're setting the main libdir intentionally.
+	# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+	einfo "Fixing install dirs"
+	sed -e "s,@libdir@,$(get_libdir),g" \
+		-e "s,@PF@,${PF},g" \
+		-e "s,@EPREFIX@,${EPREFIX},g" \
+		-i "${sub_files[@]}" \
+		|| die "install paths sed failed"
+
+	if use clang; then
+		# constantly fails for a long time, likely due to our patches
+		rm tools/clang/test/Driver/cross-linux.c || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+}
+
+multilib_src_configure() {
+	# disable timestamps since they confuse ccache
+	local conf_flags=(
+		--disable-timestamps
+		--enable-keep-symbols
+		--enable-shared
+		--with-optimize-option=
+		$(tc-is-static-only && echo --disable-shared)
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)
+		$(use_enable libedit)
+		$(use_enable ncurses terminfo)
+		$(use_enable libffi)
+	)
+
+	# well, it's used only by clang executable c-index-test
+	if multilib_is_native_abi && use clang && use xml; then
+		conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+	else
+		conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+	fi
+
+	local targets bindings
+	if use multitarget; then
+		targets='all'
+	else
+		targets='host,cpp'
+		use video_cards_radeon && targets+=',r600'
+	fi
+	conf_flags+=( --enable-targets=${targets} )
+
+	if multilib_is_native_abi; then
+		use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+		# extra commas don't hurt
+		use ocaml && bindings+=',ocaml'
+	fi
+
+	[[ ${bindings} ]] || bindings='none'
+	conf_flags+=( --enable-bindings=${bindings} )
+
+	if use libffi; then
+		local CPPFLAGS=${CPPFLAGS}
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+
+	# Enable large file support, bug #550708
+	append-lfs-flags
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+
+	ECONF_SOURCE=${S} \
+	econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+	MAKEARGS=(
+		VERBOSE=1
+		REQUIRES_RTTI=1
+		GENTOO_LIBDIR=$(get_libdir)
+	)
+
+	# for tests, we want it all! otherwise, we may use a little filtering...
+	# adding ONLY_TOOLS also disables unittest building...
+	if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+		local tools=( llvm-config )
+		use clang && tools+=( clang )
+
+		if multilib_is_native_abi; then
+			tools+=(
+				opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+				llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+				llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+				llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+				llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+			)
+
+			# the build system runs explicitly specified tools in parallel,
+			# so we need to split it into two runs
+			if [[ ${1} != -1 ]]; then
+				# those require lto
+				tools+=( llvm-lto )
+				use gold && tools+=( gold )
+
+				# those require clang :)
+				# we need to explicitly specify all its tools
+				# since we're passing BUILD_CLANG_ONLY
+				use clang && tools+=(
+					clang/tools/{clang-check,clang-format,extra}
+				)
+			fi
+		fi
+
+		MAKEARGS+=(
+			# filter tools + disable unittests implicitly
+			ONLY_TOOLS="${tools[*]}"
+
+			# this disables unittests & docs from clang
+			BUILD_CLANG_ONLY=YES
+		)
+	fi
+}
+
+multilib_src_compile() {
+	local MAKEARGS
+	set_makeargs -1
+	emake "${MAKEARGS[@]}"
+
+	if multilib_is_native_abi; then
+		set_makeargs
+		emake -C tools "${MAKEARGS[@]}"
+
+		if use doc; then
+			emake -C "${S}"/docs -f Makefile.sphinx man
+			use clang && emake -C "${S}"/tools/clang/docs/tools \
+				BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+			emake -C "${S}"/docs -f Makefile.sphinx html
+		fi
+	fi
+
+	if use debug; then
+		pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+		pax-mark m Debug+Asserts+Checks/bin/lli
+		pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+	else
+		pax-mark m Release/bin/llvm-rtdyld
+		pax-mark m Release/bin/lli
+		pax-mark m Release/bin/lli-child-target
+	fi
+}
+
+multilib_src_test() {
+	local MAKEARGS
+	set_makeargs
+
+	# build the remaining tools & unittests
+	emake "${MAKEARGS[@]}"
+
+	pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+	pax-mark m unittests/Support/Release/SupportTests
+
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+	emake "${MAKEARGS[@]}" check
+	use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied below
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-${PV}
+			/usr/bin/clang++-${PV}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+	local MAKEARGS
+	set_makeargs
+
+	local root=${D}/_${ABI}
+
+	emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+	multibuild_merge_root "${root}" "${D}"
+
+	if ! multilib_is_native_abi; then
+		# Backwards compat, will be happily removed someday.
+		dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+	else
+		# Install docs.
+		if use doc; then
+			doman "${S}"/docs/_build/man/*.1
+			use clang && doman "${T}"/clang.1
+			dohtml -r "${S}"/docs/_build/html/
+		else
+			if ! use clang; then
+				rm "${WORKDIR}"/${P}-manpages/clang.1 || die
+			fi
+			doman "${WORKDIR}"/${P}-manpages/*.1
+		fi
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+			dosym ../../../../$(get_libdir)/LLVMgold.so \
+				/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+		fi
+	fi
+
+	# apply CHOST and PV to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ )
+		local i
+
+		# append ${PV} and symlink back
+		# TODO: use alternatives.eclass? does that make any sense?
+		# maybe with USE=-clang on :0 and USE=clang on older
+		for i in "${clang_tools[@]}"; do
+			mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+			dosym "${i}"-${PV} /usr/bin/${i}
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${PV}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${PV}"
+			done
+		fi
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= ndylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		libpvminor=${libpv%.[0-9]*}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			# + omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${lib} \
+				"${ED}"/usr/lib/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+			# omit clang libs if not enabled
+			[[ -f "${f}" ]] || continue
+
+			scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+			while read odylib ; do
+				ndylib=
+				case ${odylib} in
+					*/libclang.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+						;;
+					*/libLLVM-${libpv}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+						;;
+					*/libLLVM-${libpvminor}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+						;;
+					*/libLTO.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+						;;
+				esac
+				if [[ -n ${ndylib} ]] ; then
+					ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+					install_name_tool \
+						-change "${odylib}" "${ndylib}" \
+						"${f}"
+					eend $?
+				fi
+			done
+		done
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles/syntax
+	doins utils/vim/*.vim
+
+	if use clang; then
+		cd tools/clang || die
+
+		if use static-analyzer ; then
+			dobin tools/scan-build/ccc-analyzer
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			dobin tools/scan-build/scan-build
+
+			insinto /usr/share/${PN}
+			doins tools/scan-build/scanview.css
+			doins tools/scan-build/sorttable.js
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule __init__.py cindex.py enumerations.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.6.2.ebuild b/sys-devel/llvm/llvm-3.6.2.ebuild
new file mode 100644
index 0000000..2e7bc9a
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.6.2.ebuild
@@ -0,0 +1,541 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit eutils flag-o-matic multibuild multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+	!doc? ( https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.6.1-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/3.6"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
+	+static-analyzer test xml video_cards_radeon
+	kernel_Darwin kernel_FreeBSD"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	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}] )
+	ocaml? (
+		dev-lang/ocaml:0=
+		dev-ml/findlib
+		dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	app-arch/xz-utils
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	kernel_Darwin? ( sys-libs/libcxx )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	!!<dev-python/configparser-3.3.0.2
+	ocaml? ( test? ( dev-ml/ounit ) )
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99
+		!>=sys-devel/clang-9999 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P/_}.src
+
+# Some people actually override that in make.conf. That sucks since
+# we need to run install per-directory, and ninja can't do that...
+# so why did it call itself ninja in the first place?
+CMAKE_MAKEFILE_GENERATOR=emake
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	default
+
+	rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
+		|| die "symlinks removal failed"
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
+	epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch
+	epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch
+	epatch "${FILESDIR}"/${PN}-3.6.0-ocaml-ctypes-0.4.0.patch
+	# Make ocaml warnings non-fatal, bug #537308
+	sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml  || die
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+		epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
+		eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
+
+		# Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444
+		epatch "${FILESDIR}"/clang-3.6-fbsd-gcc49.patch
+	fi
+
+	if use prefix && use clang; then
+		sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
+			projects/compiler-rt/make/platform/clang_*.mk || die
+	fi
+
+	local sub_files=(
+		Makefile.config.in
+		Makefile.rules
+		tools/llvm-config/llvm-config.cpp
+	)
+	use clang && sub_files+=(
+		tools/clang/lib/Driver/Tools.cpp
+		tools/clang/tools/scan-build/scan-build
+	)
+
+	# unfortunately ./configure won't listen to --mandir and the-like, so take
+	# care of this.
+	# note: we're setting the main libdir intentionally.
+	# where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
+	einfo "Fixing install dirs"
+	sed -e "s,@libdir@,$(get_libdir),g" \
+		-e "s,@PF@,${PF},g" \
+		-e "s,@EPREFIX@,${EPREFIX},g" \
+		-i "${sub_files[@]}" \
+		|| die "install paths sed failed"
+
+	if use clang; then
+		# constantly fails for a long time, likely due to our patches
+		rm tools/clang/test/Driver/cross-linux.c || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+}
+
+multilib_src_configure() {
+	# disable timestamps since they confuse ccache
+	local conf_flags=(
+		--disable-timestamps
+		--enable-keep-symbols
+		--enable-shared
+		--with-optimize-option=
+		$(tc-is-static-only && echo --disable-shared)
+		$(use_enable !debug optimized)
+		$(use_enable debug assertions)
+		$(use_enable debug expensive-checks)
+		$(use_enable libedit)
+		$(use_enable ncurses terminfo)
+		$(use_enable libffi)
+	)
+
+	# well, it's used only by clang executable c-index-test
+	if multilib_is_native_abi && use clang && use xml; then
+		conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
+	else
+		conf_flags+=( ac_cv_prog_XML2CONFIG="" )
+	fi
+
+	local targets bindings
+	if use multitarget; then
+		targets='all'
+	else
+		targets='host,cpp'
+		use video_cards_radeon && targets+=',r600'
+	fi
+	conf_flags+=( --enable-targets=${targets} )
+
+	if multilib_is_native_abi; then
+		use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
+		# extra commas don't hurt
+		use ocaml && bindings+=',ocaml'
+	fi
+
+	[[ ${bindings} ]] || bindings='none'
+	conf_flags+=( --enable-bindings=${bindings} )
+
+	if use libffi; then
+		local CPPFLAGS=${CPPFLAGS}
+		append-cppflags "$(pkg-config --cflags libffi)"
+	fi
+
+	# Enable large file support, bug #550708
+	append-lfs-flags
+	# llvm prefers clang over gcc, so we may need to force that
+	tc-export CC CXX
+
+	ECONF_SOURCE=${S} \
+	econf "${conf_flags[@]}"
+}
+
+set_makeargs() {
+	MAKEARGS=(
+		VERBOSE=1
+		REQUIRES_RTTI=1
+		GENTOO_LIBDIR=$(get_libdir)
+	)
+
+	# for tests, we want it all! otherwise, we may use a little filtering...
+	# adding ONLY_TOOLS also disables unittest building...
+	if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
+		local tools=( llvm-config )
+		use clang && tools+=( clang )
+
+		if multilib_is_native_abi; then
+			tools+=(
+				opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
+				llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
+				llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
+				llvm-size llvm-stress llvm-mcmarkup llvm-profdata
+				llvm-symbolizer obj2yaml yaml2obj lto bugpoint
+			)
+
+			# the build system runs explicitly specified tools in parallel,
+			# so we need to split it into two runs
+			if [[ ${1} != -1 ]]; then
+				# those require lto
+				tools+=( llvm-lto )
+				use gold && tools+=( gold )
+
+				# those require clang :)
+				# we need to explicitly specify all its tools
+				# since we're passing BUILD_CLANG_ONLY
+				use clang && tools+=(
+					clang/tools/{clang-check,clang-format,extra}
+				)
+			fi
+		fi
+
+		MAKEARGS+=(
+			# filter tools + disable unittests implicitly
+			ONLY_TOOLS="${tools[*]}"
+
+			# this disables unittests & docs from clang
+			BUILD_CLANG_ONLY=YES
+		)
+	fi
+}
+
+multilib_src_compile() {
+	local MAKEARGS
+	set_makeargs -1
+	emake "${MAKEARGS[@]}"
+
+	if multilib_is_native_abi; then
+		set_makeargs
+		emake -C tools "${MAKEARGS[@]}"
+
+		if use doc; then
+			emake -C "${S}"/docs -f Makefile.sphinx man
+			use clang && emake -C "${S}"/tools/clang/docs/tools \
+				BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
+			emake -C "${S}"/docs -f Makefile.sphinx html
+		fi
+	fi
+
+	if use debug; then
+		pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
+		pax-mark m Debug+Asserts+Checks/bin/lli
+		pax-mark m Debug+Asserts+Checks/bin/lli-child-target
+	else
+		pax-mark m Release/bin/llvm-rtdyld
+		pax-mark m Release/bin/lli
+		pax-mark m Release/bin/lli-child-target
+	fi
+}
+
+multilib_src_test() {
+	local MAKEARGS
+	set_makeargs
+
+	# build the remaining tools & unittests
+	emake "${MAKEARGS[@]}"
+
+	pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+	pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
+	pax-mark m unittests/Support/Release/SupportTests
+
+	# respect TMPDIR!
+	local -x LIT_PRESERVES_TMP=1
+	emake "${MAKEARGS[@]}" check
+	use clang && emake "${MAKEARGS[@]}" -C tools/clang test
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied below
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-${PV}
+			/usr/bin/clang++-${PV}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
+}
+
+multilib_src_install() {
+	local MAKEARGS
+	set_makeargs
+
+	local root=${D}/_${ABI}
+
+	emake "${MAKEARGS[@]}" DESTDIR="${root}" install
+	multibuild_merge_root "${root}" "${D}"
+
+	if ! multilib_is_native_abi; then
+		# Backwards compat, will be happily removed someday.
+		dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
+	else
+		# Install docs.
+		if use doc; then
+			doman "${S}"/docs/_build/man/*.1
+			use clang && doman "${T}"/clang.1
+			dohtml -r "${S}"/docs/_build/html/
+		else
+			if ! use clang; then
+				rm "${WORKDIR}"/${PN}-3.6.1-manpages/clang.1 || die
+			fi
+			doman "${WORKDIR}"/${PN}-3.6.1-manpages/*.1
+		fi
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
+			dosym ../../../../$(get_libdir)/LLVMgold.so \
+				/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
+		fi
+	fi
+
+	# apply CHOST and PV to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ )
+		local i
+
+		# append ${PV} and symlink back
+		# TODO: use alternatives.eclass? does that make any sense?
+		# maybe with USE=-clang on :0 and USE=clang on older
+		for i in "${clang_tools[@]}"; do
+			mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+			dosym "${i}"-${PV} /usr/bin/${i}
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${PV}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${PV}"
+			done
+		fi
+	fi
+
+	# Fix install_names on Darwin.  The build system is too complicated
+	# to just fix this, so we correct it post-install
+	local lib= f= odylib= ndylib= libpv=${PV}
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		eval $(grep PACKAGE_VERSION= configure)
+		[[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
+		libpvminor=${libpv%.[0-9]*}
+		for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
+			# libEnhancedDisassembly is Darwin10 only, so non-fatal
+			# + omit clang libs if not enabled
+			[[ -f ${ED}/usr/lib/${lib} ]] || continue
+
+			ebegin "fixing install_name of $lib"
+			install_name_tool \
+				-id "${EPREFIX}"/usr/lib/${lib} \
+				"${ED}"/usr/lib/${lib}
+			eend $?
+		done
+		for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
+			# omit clang libs if not enabled
+			[[ -f "${f}" ]] || continue
+
+			scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
+			while read odylib ; do
+				ndylib=
+				case ${odylib} in
+					*/libclang.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libclang.dylib
+						;;
+					*/libLLVM-${libpv}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
+						;;
+					*/libLLVM-${libpvminor}.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
+						;;
+					*/libLTO.dylib)
+						ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
+						;;
+				esac
+				if [[ -n ${ndylib} ]] ; then
+					ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+					install_name_tool \
+						-change "${odylib}" "${ndylib}" \
+						"${f}"
+					eend $?
+				fi
+			done
+		done
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles/syntax
+	doins utils/vim/*.vim
+
+	if use clang; then
+		cd tools/clang || die
+
+		if use static-analyzer ; then
+			dobin tools/scan-build/ccc-analyzer
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			dobin tools/scan-build/scan-build
+
+			insinto /usr/share/${PN}
+			doins tools/scan-build/scanview.css
+			doins tools/scan-build/sorttable.js
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule __init__.py cindex.py enumerations.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.7.0-r1.ebuild b/sys-devel/llvm/llvm-3.7.0-r1.ebuild
new file mode 100644
index 0000000..931796d
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.7.0-r1.ebuild
@@ -0,0 +1,509 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit check-reqs cmake-utils eutils flag-o-matic multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils \
+	linux-info
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+	lldb? ( http://llvm.org/releases/${PV}/lldb-${PV}.src.tar.xz )
+	!doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi lldb multitarget ncurses ocaml
+	python +static-analyzer test xml video_cards_radeon kernel_Darwin"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
+	)
+	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}] )
+	ocaml? (
+		dev-lang/ocaml:0=
+		dev-ml/findlib
+		dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	kernel_Darwin? ( sys-libs/libcxx )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	gold? ( sys-libs/binutils-libs )
+	libffi? ( virtual/pkgconfig )
+	lldb? ( dev-lang/swig )
+	!!<dev-python/configparser-3.3.0.2
+	ocaml? ( test? ( dev-ml/ounit ) )
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	lldb? ( clang )
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P/_}.src
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	default
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+
+	if use lldb; then
+		mv "${WORKDIR}"/lldb-${PV/_}.src "${S}"/tools/lldb \
+			|| die "lldb source directory move failed"
+	fi
+}
+
+src_prepare() {
+	# Make ocaml warnings non-fatal, bug #537308
+	sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml  || die
+	# Fix libdir for ocaml bindings install, bug #559134
+	epatch "${FILESDIR}"/cmake/${P}-ocaml-multilib.patch
+
+	# Make it possible to override Sphinx HTML install dirs
+	# https://llvm.org/bugs/show_bug.cgi?id=23780
+	epatch "${FILESDIR}"/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
+
+	# Prevent race conditions with parallel Sphinx runs
+	# https://llvm.org/bugs/show_bug.cgi?id=23781
+	epatch "${FILESDIR}"/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
+
+	# Prevent installing libgtest
+	# https://llvm.org/bugs/show_bug.cgi?id=18341
+	epatch "${FILESDIR}"/cmake/0004-cmake-Do-not-install-libgtest.patch
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+
+		sed -i -e "s^@EPREFIX@^${EPREFIX}^" \
+			tools/clang/tools/scan-build/scan-build || die
+
+		# Install clang runtime into /usr/lib/clang
+		# https://llvm.org/bugs/show_bug.cgi?id=23792
+		epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
+		epatch "${FILESDIR}"/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
+
+		# Make it possible to override CLANG_LIBDIR_SUFFIX
+		# (that is used only to find LLVMgold.so)
+		# https://llvm.org/bugs/show_bug.cgi?id=23793
+		epatch "${FILESDIR}"/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
+
+		# Fix WX sections, bug #421527
+		find "${S}"/projects/compiler-rt/lib/builtins -type f -name \*.S -exec sed \
+			 -e '$a\\n#if defined(__linux__) && defined(__ELF__)\n.section .note.GNU-stack,"",%progbits\n#endif' \
+			 -i {} \; || die
+	fi
+
+	if use lldb; then
+		# Do not install dummy readline.so module from
+		# https://llvm.org/bugs/show_bug.cgi?id=18841
+		sed -e 's/add_subdirectory(readline)/#&/' \
+			-i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
+	fi
+
+	# User patches
+	epatch_user
+	if kernel_is -lt 2 6 32; then
+		# on RHEL5, linux/perf_event.h (needing kernel >=2.6.32) is not available.
+		# https://llvm.org/bugs/show_bug.cgi?id=17901
+		elog "Removing compiler-rt on RHEL 5..."
+		rm -r projects/compiler-rt || die "Removing compiler-rt failed."
+	fi
+
+	python_setup
+
+	# Native libdir is used to hold LLVMgold.so
+	NATIVE_LIBDIR=$(get_libdir)
+}
+
+multilib_src_configure() {
+	local targets
+	if use multitarget; then
+		targets=all
+	else
+		targets='host;CppBackend'
+		use video_cards_radeon && targets+=';AMDGPU'
+	fi
+
+	local ffi_cflags ffi_ldflags
+	if use libffi; then
+		ffi_cflags=$(pkg-config --cflags-only-I libffi)
+		ffi_ldflags=$(pkg-config --libs-only-L libffi)
+	fi
+
+	local libdir=$(get_libdir)
+	local mycmakeargs=(
+		"${mycmakeargs[@]}"
+		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+
+		-DBUILD_SHARED_LIBS=ON
+		-DLLVM_ENABLE_TIMESTAMPS=OFF
+		-DLLVM_TARGETS_TO_BUILD="${targets}"
+		-DLLVM_BUILD_TESTS=$(usex test)
+
+		-DLLVM_ENABLE_FFI=$(usex libffi)
+		-DLLVM_ENABLE_TERMINFO=$(usex ncurses)
+		-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}"
+
+		-DHAVE_HISTEDIT_H=$(usex libedit)
+	)
+
+	if use lldb; then
+		mycmakeargs+=(
+			-DLLDB_DISABLE_LIBEDIT=$(usex !libedit)
+			-DLLDB_DISABLE_CURSES=$(usex !ncurses)
+			-DLLDB_ENABLE_TERMINFO=$(usex ncurses)
+		)
+	fi
+
+	if ! multilib_is_native_abi || ! use ocaml; then
+		mycmakeargs+=(
+			-DOCAMLFIND=NO
+		)
+	fi
+#	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
+
+	if multilib_is_native_abi; then
+		mycmakeargs+=(
+			-DLLVM_BUILD_DOCS=$(usex doc)
+			-DLLVM_ENABLE_SPHINX=$(usex doc)
+			-DLLVM_ENABLE_DOXYGEN=OFF
+			-DLLVM_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/html"
+			-DSPHINX_WARNINGS_AS_ERRORS=OFF
+			-DLLVM_INSTALL_UTILS=ON
+		)
+
+		if use clang; then
+			mycmakeargs+=(
+				-DCLANG_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/clang"
+			)
+		fi
+
+		if use gold; then
+			mycmakeargs+=(
+				-DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include
+			)
+		fi
+
+		if use lldb; then
+			mycmakeargs+=(
+				-DLLDB_DISABLE_PYTHON=$(usex !python)
+			)
+		fi
+
+	else
+		if use clang; then
+			mycmakeargs+=(
+				# disable compiler-rt on non-native ABI because:
+				# 1. it fails to configure because of -m32
+				# 2. it is shared between ABIs so no point building
+				# it multiple times
+				-DLLVM_EXTERNAL_COMPILER_RT_BUILD=OFF
+				-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=OFF
+			)
+		fi
+		if use lldb; then
+			mycmakeargs+=(
+				# only run swig on native abi
+				-DLLDB_DISABLE_PYTHON=ON
+			)
+		fi
+	fi
+
+	if use clang; then
+		mycmakeargs+=(
+			-DCLANG_ENABLE_ARCMT=$(usex static-analyzer)
+			-DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
+			-DCLANG_LIBDIR_SUFFIX="${NATIVE_LIBDIR#lib}"
+		)
+
+		# -- not needed when compiler-rt is built with host compiler --
+		# cmake passes host C*FLAGS to compiler-rt build
+		# which is performed using clang, so we need to filter out
+		# some flags clang does not support
+		# (if you know some more flags that don't work, let us know)
+		#filter-flags -msahf -frecord-gcc-switches
+	fi
+
+	cmake-utils_src_configure
+}
+
+multilib_src_compile() {
+	cmake-utils_src_compile
+	# TODO: not sure why this target is not correctly called
+	multilib_is_native_abi && use doc && use ocaml && cmake-utils_src_make docs/ocaml_doc
+
+	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
+	local test_targets=( check )
+	# clang tests won't work on non-native ABI because we skip compiler-rt
+	multilib_is_native_abi && use clang && test_targets+=( check-clang )
+	cmake-utils_src_make "${test_targets[@]}"
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied in multilib_src_install()!
+		CLANG_VERSION=${PV%.*}
+
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-cl
+			/usr/bin/clang-${CLANG_VERSION}
+			/usr/bin/clang++-${CLANG_VERSION}
+			/usr/bin/clang-cl-${CLANG_VERSION}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+}
+
+multilib_src_install() {
+	cmake-utils_src_install
+
+	if multilib_is_native_abi; then
+		# Install man pages.
+		use doc || doman "${WORKDIR}"/${P}-manpages/*.1
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins"
+			dosym "../../../../$(get_libdir)/LLVMgold.so" \
+				"/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so"
+		fi
+	fi
+
+	# apply CHOST and CLANG_VERSION to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ clang-cl )
+		local i
+
+		# cmake gives us:
+		# - clang-X.Y
+		# - clang -> clang-X.Y
+		# - clang++, clang-cl -> clang
+		# we want to have:
+		# - clang-X.Y
+		# - clang++-X.Y, clang-cl-X.Y -> clang-X.Y
+		# - clang, clang++, clang-cl -> clang*-X.Y
+		# so we need to fix the two tools
+		for i in "${clang_tools[@]:1}"; do
+			rm "${ED%/}/usr/bin/${i}" || die
+			dosym "clang-${CLANG_VERSION}" "/usr/bin/${i}-${CLANG_VERSION}"
+			dosym "${i}-${CLANG_VERSION}" "/usr/bin/${i}"
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${CLANG_VERSION}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${CLANG_VERSION}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${CLANG_VERSION}"
+			done
+		fi
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles
+	doins -r utils/vim/*/
+	# some users may find it useful
+	dodoc utils/vim/vimrc
+
+	if use clang; then
+		pushd tools/clang >/dev/null || die
+
+		if use static-analyzer ; then
+			pushd tools/scan-build >/dev/null || die
+
+			dobin ccc-analyzer scan-build
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			doman scan-build.1
+
+			insinto /usr/share/llvm
+			doins scanview.css sorttable.js
+
+			popd >/dev/null || die
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule *.py Resources
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule *.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			# Removed for RHEL5.
+			if kernel_is -ge 2 6 32; then
+				python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+			fi
+		}
+		python_foreach_impl python_inst
+		popd >/dev/null || die
+	fi
+}
+
+pkg_postinst() {
+	if use clang; then
+		elog "To enable OpenMP support in clang, install sys-libs/libomp"
+		elog "and use the '-fopenmp=libomp' command line option"
+	fi
+}

diff --git a/sys-devel/llvm/llvm-3.7.0.ebuild b/sys-devel/llvm/llvm-3.7.0.ebuild
new file mode 100644
index 0000000..8da56ff
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.7.0.ebuild
@@ -0,0 +1,492 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit check-reqs cmake-utils eutils flag-o-matic multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
+	clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
+		http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
+	lldb? ( http://llvm.org/releases/${PV}/lldb-${PV}.src.tar.xz )
+	!doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="clang debug doc gold libedit +libffi lldb multitarget ncurses ocaml
+	python +static-analyzer test xml video_cards_radeon kernel_Darwin"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2= )
+	)
+	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}] )
+	ocaml? (
+		dev-lang/ocaml:0=
+		dev-ml/findlib
+		dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	kernel_Darwin? ( sys-libs/libcxx )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	lldb? ( dev-lang/swig )
+	!!<dev-python/configparser-3.3.0.2
+	ocaml? ( test? ( dev-ml/ounit ) )
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	lldb? ( clang )
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+S=${WORKDIR}/${P/_}.src
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	default
+
+	if use clang; then
+		mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
+			|| die "clang source directory move failed"
+		mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
+			|| die "compiler-rt source directory move failed"
+		mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
+			|| die "clang-tools-extra source directory move failed"
+	fi
+
+	if use lldb; then
+		mv "${WORKDIR}"/lldb-${PV/_}.src "${S}"/tools/lldb \
+			|| die "lldb source directory move failed"
+	fi
+}
+
+src_prepare() {
+	# Make ocaml warnings non-fatal, bug #537308
+	sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml  || die
+	# Fix libdir for ocaml bindings install, bug #559134
+	epatch "${FILESDIR}"/cmake/${P}-ocaml-multilib.patch
+
+	# Make it possible to override Sphinx HTML install dirs
+	# https://llvm.org/bugs/show_bug.cgi?id=23780
+	epatch "${FILESDIR}"/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
+
+	# Prevent race conditions with parallel Sphinx runs
+	# https://llvm.org/bugs/show_bug.cgi?id=23781
+	epatch "${FILESDIR}"/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
+
+	# Prevent installing libgtest
+	# https://llvm.org/bugs/show_bug.cgi?id=18341
+	epatch "${FILESDIR}"/cmake/0004-cmake-Do-not-install-libgtest.patch
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+
+		sed -i -e "s^@EPREFIX@^${EPREFIX}^" \
+			tools/clang/tools/scan-build/scan-build || die
+
+		# Install clang runtime into /usr/lib/clang
+		# https://llvm.org/bugs/show_bug.cgi?id=23792
+		epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch
+		epatch "${FILESDIR}"/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
+
+		# Make it possible to override CLANG_LIBDIR_SUFFIX
+		# (that is used only to find LLVMgold.so)
+		# https://llvm.org/bugs/show_bug.cgi?id=23793
+		epatch "${FILESDIR}"/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
+
+		# Fix WX sections, bug #421527
+		find "${S}"/projects/compiler-rt/lib/builtins -type f -name \*.S -exec sed \
+			 -e '$a\\n#if defined(__linux__) && defined(__ELF__)\n.section .note.GNU-stack,"",%progbits\n#endif' \
+			 -i {} \; || die
+
+		# Workaround bug #553416 until upstream fixes it
+		epatch "${FILESDIR}"/clang-3.7-strip_doc_refs.patch
+	fi
+
+	if use lldb; then
+		# Do not install dummy readline.so module from
+		# https://llvm.org/bugs/show_bug.cgi?id=18841
+		sed -e 's/add_subdirectory(readline)/#&/' \
+			-i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+
+	# Native libdir is used to hold LLVMgold.so
+	NATIVE_LIBDIR=$(get_libdir)
+}
+
+multilib_src_configure() {
+	local targets
+	if use multitarget; then
+		targets=all
+	else
+		targets='host;CppBackend'
+		use video_cards_radeon && targets+=';AMDGPU'
+	fi
+
+	local ffi_cflags ffi_ldflags
+	if use libffi; then
+		ffi_cflags=$(pkg-config --cflags-only-I libffi)
+		ffi_ldflags=$(pkg-config --libs-only-L libffi)
+	fi
+
+	local libdir=$(get_libdir)
+	local mycmakeargs=(
+		"${mycmakeargs[@]}"
+		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+
+		-DBUILD_SHARED_LIBS=ON
+		-DLLVM_ENABLE_TIMESTAMPS=OFF
+		-DLLVM_TARGETS_TO_BUILD="${targets}"
+		-DLLVM_BUILD_TESTS=$(usex test)
+
+		-DLLVM_ENABLE_FFI=$(usex libffi)
+		-DLLVM_ENABLE_TERMINFO=$(usex ncurses)
+		-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}"
+
+		-DHAVE_HISTEDIT_H=$(usex libedit)
+	)
+
+	if use lldb; then
+		mycmakeargs+=(
+			-DLLDB_DISABLE_LIBEDIT=$(usex !libedit)
+			-DLLDB_DISABLE_CURSES=$(usex !ncurses)
+			-DLLDB_ENABLE_TERMINFO=$(usex ncurses)
+		)
+	fi
+
+	if ! multilib_is_native_abi || ! use ocaml; then
+		mycmakeargs+=(
+			-DOCAMLFIND=NO
+		)
+	fi
+#	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
+
+	if multilib_is_native_abi; then
+		mycmakeargs+=(
+			-DLLVM_BUILD_DOCS=$(usex doc)
+			-DLLVM_ENABLE_SPHINX=$(usex doc)
+			-DLLVM_ENABLE_DOXYGEN=OFF
+			-DLLVM_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/html"
+		)
+
+		if use clang; then
+			mycmakeargs+=(
+				-DCLANG_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/clang"
+			)
+		fi
+
+		if use gold; then
+			mycmakeargs+=(
+				-DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include
+			)
+		fi
+
+		if use lldb; then
+			mycmakeargs+=(
+				-DLLDB_DISABLE_PYTHON=$(usex !python)
+			)
+		fi
+
+	else
+		if use clang; then
+			mycmakeargs+=(
+				# disable compiler-rt on non-native ABI because:
+				# 1. it fails to configure because of -m32
+				# 2. it is shared between ABIs so no point building
+				# it multiple times
+				-DLLVM_EXTERNAL_COMPILER_RT_BUILD=OFF
+				-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=OFF
+			)
+		fi
+		if use lldb; then
+			mycmakeargs+=(
+				# only run swig on native abi
+				-DLLDB_DISABLE_PYTHON=ON
+			)
+		fi
+	fi
+
+	if use clang; then
+		mycmakeargs+=(
+			-DCLANG_ENABLE_ARCMT=$(usex static-analyzer)
+			-DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
+			-DCLANG_LIBDIR_SUFFIX="${NATIVE_LIBDIR#lib}"
+		)
+
+		# -- not needed when compiler-rt is built with host compiler --
+		# cmake passes host C*FLAGS to compiler-rt build
+		# which is performed using clang, so we need to filter out
+		# some flags clang does not support
+		# (if you know some more flags that don't work, let us know)
+		#filter-flags -msahf -frecord-gcc-switches
+	fi
+
+	cmake-utils_src_configure
+}
+
+multilib_src_compile() {
+	cmake-utils_src_compile
+	# TODO: not sure why this target is not correctly called
+	multilib_is_native_abi && use doc && use ocaml && cmake-utils_src_make docs/ocaml_doc
+
+	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
+	local test_targets=( check )
+	# clang tests won't work on non-native ABI because we skip compiler-rt
+	multilib_is_native_abi && use clang && test_targets+=( check-clang )
+	cmake-utils_src_make "${test_targets[@]}"
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied in multilib_src_install()!
+		CLANG_VERSION=${PV%.*}
+
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-cl
+			/usr/bin/clang-${CLANG_VERSION}
+			/usr/bin/clang++-${CLANG_VERSION}
+			/usr/bin/clang-cl-${CLANG_VERSION}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+}
+
+multilib_src_install() {
+	cmake-utils_src_install
+
+	if multilib_is_native_abi; then
+		# Install man pages.
+		use doc || doman "${WORKDIR}"/${P}-manpages/*.1
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins"
+			dosym "../../../../$(get_libdir)/LLVMgold.so" \
+				"/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so"
+		fi
+	fi
+
+	# apply CHOST and CLANG_VERSION to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ clang-cl )
+		local i
+
+		# cmake gives us:
+		# - clang-X.Y
+		# - clang -> clang-X.Y
+		# - clang++, clang-cl -> clang
+		# we want to have:
+		# - clang-X.Y
+		# - clang++-X.Y, clang-cl-X.Y -> clang-X.Y
+		# - clang, clang++, clang-cl -> clang*-X.Y
+		# so we need to fix the two tools
+		for i in "${clang_tools[@]:1}"; do
+			rm "${ED%/}/usr/bin/${i}" || die
+			dosym "clang-${CLANG_VERSION}" "/usr/bin/${i}-${CLANG_VERSION}"
+			dosym "${i}-${CLANG_VERSION}" "/usr/bin/${i}"
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${CLANG_VERSION}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${CLANG_VERSION}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${CLANG_VERSION}"
+			done
+		fi
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles
+	doins -r utils/vim/*/
+	# some users may find it useful
+	dodoc utils/vim/vimrc
+
+	if use clang; then
+		pushd tools/clang >/dev/null || die
+
+		if use static-analyzer ; then
+			pushd tools/scan-build >/dev/null || die
+
+			dobin ccc-analyzer scan-build
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			doman scan-build.1
+
+			insinto /usr/share/llvm
+			doins scanview.css sorttable.js
+
+			popd >/dev/null || die
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule *.py Resources
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule *.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+		popd >/dev/null || die
+	fi
+}

diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild
new file mode 100644
index 0000000..1d0a6e6
--- /dev/null
+++ b/sys-devel/llvm/llvm-9999.ebuild
@@ -0,0 +1,508 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+PYTHON_COMPAT=( python2_7 pypy )
+
+inherit check-reqs cmake-utils eutils flag-o-matic git-r3 multilib \
+	multilib-minimal python-r1 toolchain-funcs pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI=""
+EGIT_REPO_URI="http://llvm.org/git/llvm.git
+	https://github.com/llvm-mirror/llvm.git"
+
+LICENSE="UoI-NCSA"
+SLOT="0/${PV}"
+KEYWORDS=""
+IUSE="clang debug +doc gold libedit +libffi lldb multitarget ncurses ocaml
+	python +static-analyzer test xml video_cards_radeon kernel_Darwin"
+
+COMMON_DEPEND="
+	sys-libs/zlib:0=
+	clang? (
+		python? ( ${PYTHON_DEPS} )
+		static-analyzer? (
+			dev-lang/perl:*
+			${PYTHON_DEPS}
+		)
+		xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
+	)
+	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}] )
+	ocaml? (
+		dev-lang/ocaml:0=
+		dev-ml/findlib
+		dev-ml/ocaml-ctypes )"
+# configparser-3.2 breaks the build (3.3 or none at all are fine)
+DEPEND="${COMMON_DEPEND}
+	dev-lang/perl
+	>=sys-devel/make-3.81
+	>=sys-devel/flex-2.5.4
+	>=sys-devel/bison-1.875d
+	|| ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
+		( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
+	)
+	|| ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
+	kernel_Darwin? ( sys-libs/libcxx )
+	clang? ( xml? ( virtual/pkgconfig ) )
+	doc? ( dev-python/sphinx )
+	libffi? ( virtual/pkgconfig )
+	lldb? ( dev-lang/swig )
+	!!<dev-python/configparser-3.3.0.2
+	ocaml? ( test? ( dev-ml/ounit ) )
+	${PYTHON_DEPS}"
+RDEPEND="${COMMON_DEPEND}
+	clang? ( !<=sys-devel/clang-${PV}-r99 )
+	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
+PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
+
+# pypy gives me around 1700 unresolved tests due to open file limit
+# being exceeded. probably GC does not close them fast enough.
+REQUIRED_USE="${PYTHON_REQUIRED_USE}
+	lldb? ( clang )
+	test? ( || ( $(python_gen_useflags 'python*') ) )"
+
+pkg_pretend() {
+	# in megs
+	# !clang !debug !multitarget -O2       400
+	# !clang !debug  multitarget -O2       550
+	#  clang !debug !multitarget -O2       950
+	#  clang !debug  multitarget -O2      1200
+	# !clang  debug  multitarget -O2      5G
+	#  clang !debug  multitarget -O0 -g  12G
+	#  clang  debug  multitarget -O2     16G
+	#  clang  debug  multitarget -O0 -g  14G
+
+	local build_size=550
+	use clang && build_size=1200
+
+	if use debug; then
+		ewarn "USE=debug is known to increase the size of package considerably"
+		ewarn "and cause the tests to fail."
+		ewarn
+
+		(( build_size *= 14 ))
+	elif is-flagq '-g?(gdb)?([1-9])'; then
+		ewarn "The C++ compiler -g option is known to increase the size of the package"
+		ewarn "considerably. If you run out of space, please consider removing it."
+		ewarn
+
+		(( build_size *= 10 ))
+	fi
+
+	# Multiply by number of ABIs :).
+	local abis=( $(multilib_get_enabled_abis) )
+	(( build_size *= ${#abis[@]} ))
+
+	local CHECKREQS_DISK_BUILD=${build_size}M
+	check-reqs_pkg_pretend
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		echo 'int main() {return 0;}' > "${T}"/test.cxx || die
+		ebegin "Trying to build a C++11 test program"
+		if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
+			eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
+			eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
+			eerror "to gcc-4.7 or an equivalent version supporting C++11."
+			die "Currently active compiler does not support -std=c++11"
+		fi
+		eend ${?}
+	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+}
+
+src_unpack() {
+	if use clang; then
+		git-r3_fetch "http://llvm.org/git/compiler-rt.git
+			https://github.com/llvm-mirror/compiler-rt.git"
+		git-r3_fetch "http://llvm.org/git/clang.git
+			https://github.com/llvm-mirror/clang.git"
+		git-r3_fetch "http://llvm.org/git/clang-tools-extra.git
+			https://github.com/llvm-mirror/clang-tools-extra.git"
+	fi
+	if use lldb; then
+		git-r3_fetch "http://llvm.org/git/lldb.git
+			https://github.com/llvm-mirror/lldb.git"
+	fi
+	git-r3_fetch
+
+	if use clang; then
+		git-r3_checkout http://llvm.org/git/compiler-rt.git \
+			"${S}"/projects/compiler-rt
+		git-r3_checkout http://llvm.org/git/clang.git \
+			"${S}"/tools/clang
+		git-r3_checkout http://llvm.org/git/clang-tools-extra.git \
+			"${S}"/tools/clang/tools/extra
+	fi
+	if use lldb; then
+		git-r3_checkout http://llvm.org/git/lldb.git \
+			"${S}"/tools/lldb
+	fi
+	git-r3_checkout
+}
+
+src_prepare() {
+	# Make ocaml warnings non-fatal, bug #537308
+	sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml  || die
+	# Fix libdir for ocaml bindings install, bug #559134
+	epatch "${FILESDIR}"/cmake/${PN}-3.7.0-ocaml-multilib.patch
+
+	# Make it possible to override Sphinx HTML install dirs
+	# https://llvm.org/bugs/show_bug.cgi?id=23780
+	epatch "${FILESDIR}"/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
+
+	# Prevent race conditions with parallel Sphinx runs
+	# https://llvm.org/bugs/show_bug.cgi?id=23781
+	epatch "${FILESDIR}"/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
+
+	# Prevent installing libgtest
+	# https://llvm.org/bugs/show_bug.cgi?id=18341
+	epatch "${FILESDIR}"/cmake/0004-cmake-Do-not-install-libgtest.patch
+
+	# Allow custom cmake build types (like 'Gentoo')
+	epatch "${FILESDIR}"/cmake/${PN}-3.8-allow_custom_cmake_build_types.patch
+
+	if use clang; then
+		# Automatically select active system GCC's libraries, bugs #406163 and #417913
+		epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch
+
+		epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch
+
+		sed -i -e "s^@EPREFIX@^${EPREFIX}^" \
+			tools/clang/tools/scan-build/scan-build || die
+
+		# Install clang runtime into /usr/lib/clang
+		# https://llvm.org/bugs/show_bug.cgi?id=23792
+		epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix-3.8.patch
+		epatch "${FILESDIR}"/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch
+
+		# Make it possible to override CLANG_LIBDIR_SUFFIX
+		# (that is used only to find LLVMgold.so)
+		# https://llvm.org/bugs/show_bug.cgi?id=23793
+		epatch "${FILESDIR}"/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch
+
+		# Fix WX sections, bug #421527
+		find "${S}"/projects/compiler-rt/lib/builtins -type f -name \*.S -exec sed \
+			 -e '$a\\n#if defined(__linux__) && defined(__ELF__)\n.section .note.GNU-stack,"",%progbits\n#endif' \
+			 -i {} \; || die
+	fi
+
+	if use lldb; then
+		# Do not install dummy readline.so module from
+		# https://llvm.org/bugs/show_bug.cgi?id=18841
+		sed -e 's/add_subdirectory(readline)/#&/' \
+			-i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
+	fi
+
+	# User patches
+	epatch_user
+
+	python_setup
+
+	# Native libdir is used to hold LLVMgold.so
+	NATIVE_LIBDIR=$(get_libdir)
+}
+
+multilib_src_configure() {
+	local targets
+	if use multitarget; then
+		targets=all
+	else
+		targets='host;CppBackend'
+		use video_cards_radeon && targets+=';AMDGPU'
+	fi
+
+	local ffi_cflags ffi_ldflags
+	if use libffi; then
+		ffi_cflags=$(pkg-config --cflags-only-I libffi)
+		ffi_ldflags=$(pkg-config --libs-only-L libffi)
+	fi
+
+	local libdir=$(get_libdir)
+	local mycmakeargs=(
+		"${mycmakeargs[@]}"
+		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
+
+		-DBUILD_SHARED_LIBS=ON
+		-DLLVM_ENABLE_TIMESTAMPS=OFF
+		-DLLVM_TARGETS_TO_BUILD="${targets}"
+		-DLLVM_BUILD_TESTS=$(usex test)
+
+		-DLLVM_ENABLE_FFI=$(usex libffi)
+		-DLLVM_ENABLE_TERMINFO=$(usex ncurses)
+		-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}"
+
+		-DHAVE_HISTEDIT_H=$(usex libedit)
+	)
+
+	if use lldb; then
+		mycmakeargs+=(
+			-DLLDB_DISABLE_LIBEDIT=$(usex !libedit)
+			-DLLDB_DISABLE_CURSES=$(usex !ncurses)
+			-DLLDB_ENABLE_TERMINFO=$(usex ncurses)
+		)
+	fi
+
+	if ! multilib_is_native_abi || ! use ocaml; then
+		mycmakeargs+=(
+			-DOCAMLFIND=NO
+		)
+	fi
+#	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
+
+	if multilib_is_native_abi; then
+		mycmakeargs+=(
+			-DLLVM_BUILD_DOCS=$(usex doc)
+			-DLLVM_ENABLE_SPHINX=$(usex doc)
+			-DLLVM_ENABLE_DOXYGEN=OFF
+			-DLLVM_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/html"
+			-DSPHINX_WARNINGS_AS_ERRORS=OFF
+			-DLLVM_INSTALL_UTILS=ON
+		)
+
+		if use clang; then
+			mycmakeargs+=(
+				-DCLANG_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/clang"
+			)
+		fi
+
+		if use gold; then
+			mycmakeargs+=(
+				-DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include
+			)
+		fi
+
+		if use lldb; then
+			mycmakeargs+=(
+				-DLLDB_DISABLE_PYTHON=$(usex !python)
+			)
+		fi
+
+	else
+		if use clang; then
+			mycmakeargs+=(
+				# disable compiler-rt on non-native ABI because:
+				# 1. it fails to configure because of -m32
+				# 2. it is shared between ABIs so no point building
+				# it multiple times
+				-DLLVM_EXTERNAL_COMPILER_RT_BUILD=OFF
+				-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=OFF
+			)
+		fi
+		if use lldb; then
+			mycmakeargs+=(
+				# only run swig on native abi
+				-DLLDB_DISABLE_PYTHON=ON
+			)
+		fi
+	fi
+
+	if use clang; then
+		mycmakeargs+=(
+			-DCLANG_ENABLE_ARCMT=$(usex static-analyzer)
+			-DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
+			-DCLANG_LIBDIR_SUFFIX="${NATIVE_LIBDIR#lib}"
+		)
+
+		# -- not needed when compiler-rt is built with host compiler --
+		# cmake passes host C*FLAGS to compiler-rt build
+		# which is performed using clang, so we need to filter out
+		# some flags clang does not support
+		# (if you know some more flags that don't work, let us know)
+		#filter-flags -msahf -frecord-gcc-switches
+	fi
+
+	cmake-utils_src_configure
+}
+
+multilib_src_compile() {
+	cmake-utils_src_compile
+	# TODO: not sure why this target is not correctly called
+	multilib_is_native_abi && use doc && use ocaml && cmake-utils_src_make docs/ocaml_doc
+
+	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
+	local test_targets=( check )
+	# clang tests won't work on non-native ABI because we skip compiler-rt
+	multilib_is_native_abi && use clang && test_targets+=( check-clang )
+	cmake-utils_src_make "${test_targets[@]}"
+}
+
+src_install() {
+	local MULTILIB_CHOST_TOOLS=(
+		/usr/bin/llvm-config
+	)
+
+	local MULTILIB_WRAPPED_HEADERS=(
+		/usr/include/llvm/Config/config.h
+		/usr/include/llvm/Config/llvm-config.h
+	)
+
+	if use clang; then
+		# note: magic applied in multilib_src_install()!
+		CLANG_VERSION=3.8
+
+		MULTILIB_CHOST_TOOLS+=(
+			/usr/bin/clang
+			/usr/bin/clang++
+			/usr/bin/clang-cl
+			/usr/bin/clang-${CLANG_VERSION}
+			/usr/bin/clang++-${CLANG_VERSION}
+			/usr/bin/clang-cl-${CLANG_VERSION}
+		)
+
+		MULTILIB_WRAPPED_HEADERS+=(
+			/usr/include/clang/Config/config.h
+		)
+	fi
+
+	multilib-minimal_src_install
+}
+
+multilib_src_install() {
+	cmake-utils_src_install
+
+	if multilib_is_native_abi; then
+		# Install docs.
+		#use doc && dohtml -r "${S}"/docs/_build/html/
+
+		# Symlink the gold plugin.
+		if use gold; then
+			dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins"
+			dosym "../../../../$(get_libdir)/LLVMgold.so" \
+				"/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so"
+		fi
+	fi
+
+	# apply CHOST and CLANG_VERSION to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ clang-cl )
+		local i
+
+		# cmake gives us:
+		# - clang-X.Y
+		# - clang -> clang-X.Y
+		# - clang++, clang-cl -> clang
+		# we want to have:
+		# - clang-X.Y
+		# - clang++-X.Y, clang-cl-X.Y -> clang-X.Y
+		# - clang, clang++, clang-cl -> clang*-X.Y
+		# so we need to fix the two tools
+		for i in "${clang_tools[@]:1}"; do
+			rm "${ED%/}/usr/bin/${i}" || die
+			dosym "clang-${CLANG_VERSION}" "/usr/bin/${i}-${CLANG_VERSION}"
+			dosym "${i}-${CLANG_VERSION}" "/usr/bin/${i}"
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${CLANG_VERSION}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${CLANG_VERSION}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${CLANG_VERSION}"
+			done
+		fi
+	fi
+}
+
+multilib_src_install_all() {
+	insinto /usr/share/vim/vimfiles
+	doins -r utils/vim/*/
+	# some users may find it useful
+	dodoc utils/vim/vimrc
+
+	if use clang; then
+		pushd tools/clang >/dev/null || die
+
+		if use static-analyzer ; then
+			pushd tools/scan-build >/dev/null || die
+
+			dobin ccc-analyzer scan-build
+			dosym ccc-analyzer /usr/bin/c++-analyzer
+			doman scan-build.1
+
+			insinto /usr/share/llvm
+			doins scanview.css sorttable.js
+
+			popd >/dev/null || die
+		fi
+
+		python_inst() {
+			if use static-analyzer ; then
+				pushd tools/scan-view >/dev/null || die
+
+				python_doscript scan-view
+
+				touch __init__.py || die
+				python_moduleinto clang
+				python_domodule *.py Resources
+
+				popd >/dev/null || die
+			fi
+
+			if use python ; then
+				pushd bindings/python/clang >/dev/null || die
+
+				python_moduleinto clang
+				python_domodule *.py
+
+				popd >/dev/null || die
+			fi
+
+			# AddressSanitizer symbolizer (currently separate)
+			python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+		}
+		python_foreach_impl python_inst
+		popd >/dev/null || die
+	fi
+}
+
+pkg_postinst() {
+	if use clang; then
+		elog "To enable OpenMP support in clang, install sys-libs/libomp"
+		elog "and use the '-fopenmp=libomp' command line option"
+	fi
+}

diff --git a/sys-devel/llvm/metadata.xml b/sys-devel/llvm/metadata.xml
new file mode 100644
index 0000000..53210f7
--- /dev/null
+++ b/sys-devel/llvm/metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer>
+		<email>voyageur@gentoo.org</email>
+		<name>Bernard Cafarelli</name>
+	</maintainer>
+	<maintainer>
+		<email>mgorny@gentoo.org</email>
+		<name>Michał Górny</name>
+	</maintainer>
+	<longdescription>Low Level Virtual Machine (LLVM) is:
+   1. A compilation strategy designed to enable effective program optimization across the entire lifetime of a program. LLVM supports effective optimization at compile time, link-time (particularly interprocedural), run-time and offline (i.e., after software is installed), while remaining transparent to developers and maintaining compatibility with existing build scripts.
+   2. A virtual instruction set - LLVM is a low-level object code representation that uses simple RISC-like instructions, but provides rich, language-independent, type information and dataflow (SSA) information about operands. This combination enables sophisticated transformations on object code, while remaining light-weight enough to be attached to the executable. This combination is key to allowing link-time, run-time, and offline transformations.
+   3. A compiler infrastructure - LLVM is also a collection of source code that implements the language and compilation strategy. The primary components of the LLVM infrastructure are a GCC-based C and C++ front-end, a link-time optimization framework with a growing set of global and interprocedural analyses and transformations, static back-ends for many popular (and some obscure) architectures, a back-end which emits portable C code, and a Just-In-Time compilers for several architectures.
+   4. LLVM does not imply things that you would expect from a high-level virtual machine. It does not require garbage collection or run-time code generation (In fact, LLVM makes a great static compiler!). Note that optional LLVM components can be used to build high-level virtual machines and other systems that need these services.</longdescription>
+	<use>
+		<flag name='clang'>Build the clang C/C++ compiler</flag>
+		<flag name='cmake'>Enable cmake support (experimental)</flag>
+		<flag name='doc'>Build and install the HTML documentation and regenerate the man pages</flag>
+		<flag name='gold'>Build the gold linker plugin</flag>
+		<flag name='lldb'>Build the lldb debugger</flag>
+		<flag name='multitarget'>Build all host targets (default: host only)</flag>
+		<flag name='ncurses'>Support querying terminal properties using ncurses' terminfo</flag>
+		<flag name='static-analyzer'>Install the Clang static analyzer (requires USE=clang)</flag>
+		<flag name='udis86'>Enable support for <pkg>dev-libs/udis86</pkg> disassembler library</flag>
+	</use>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-21  4:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-21  4:31 [gentoo-commits] dev/heroxbd:master commit in: sys-devel/llvm/files/cmake/, sys-devel/llvm/files/, Benda XU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox