public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2015-08-24 15:03 Bernard Cafarelli
  0 siblings, 0 replies; 11+ messages in thread
From: Bernard Cafarelli @ 2015-08-24 15:03 UTC (permalink / raw
  To: gentoo-commits

commit:     8d50a4336ee1622d2571e7dded7834c6c19989af
Author:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 24 15:01:00 2015 +0000
Commit:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
CommitDate: Mon Aug 24 15:03:05 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8d50a433

sys-devel/llvm: add rc version for testing

Package-Manager: portage-2.2.20.1

 sys-devel/llvm/Manifest                            |   5 +
 .../llvm/files/clang-3.7-strip_doc_refs.patch      |  42 ++
 sys-devel/llvm/llvm-3.7.0_rc2.ebuild               | 486 +++++++++++++++++++++
 sys-devel/llvm/metadata.xml                        |   2 +-
 4 files changed, 534 insertions(+), 1 deletion(-)

diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
index 3a40917..9a7eb59 100644
--- a/sys-devel/llvm/Manifest
+++ b/sys-devel/llvm/Manifest
@@ -6,6 +6,7 @@ DIST cfe-3.5.2.src.tar.xz 8268008 SHA256 4feb575f74fb3a74b6245400460230141bf610f
 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.0rc2.src.tar.xz 9141532 SHA256 a371a416af039eec9291b9acc167911ad9c8d9f3494111c8e53beb07b7f5dfaa SHA512 3592980a6d488228d269ae8b1147abd4b7a2f159829e25eef2cff0ccad28bec61e6fb531e74a2b55eb428a5c0dce0ba74c5a6276544b2676b6b6c3297b532d8e WHIRLPOOL 9ce3b7fa1ccaa9c61adabcede0125e21cd5bd2caf849458987c2fe1736d27c03c49a4c385ccba9a22d994d6ec6aa11dfaadfcb92310b91395010379645e8c0a0
 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
@@ -13,6 +14,7 @@ DIST clang-tools-extra-3.5.2.src.tar.xz 215804 SHA256 f21a374d74b194d8c984546266
 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.0rc2.src.tar.xz 276624 SHA256 3c51ded360181d180227857b72ea7b32c5febf777188911b23c44a1c24feb7d4 SHA512 8fff1bf61752ee1b72a126174823365f004fe5a08bd87a32de4f5895ec8e044c78a814e8fab306055478e35b1485dc19d0c3156e90a9946b9239e2be3dfe7956 WHIRLPOOL f148e686b8d6e95051a851af31d758ef47ae0b08d87487518c6898c4767e73b538d95574d143f2fc6504f0ecd1553c3bae76524d369e195fa8a26e634104ad71
 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
@@ -21,6 +23,8 @@ DIST compiler-rt-3.5.2.src.tar.xz 1093000 SHA256 542d7aadd21e7fe35bea0a7912bc965
 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.0rc2.src.tar.xz 1191940 SHA256 67574dee852919b3ab3259c7b4c06e9568d3afa55d918737a409171e8cd92639 SHA512 7f664af340d7d3699348199d2c5817fa1cb4264f2119e4d061dbf88f6f0ed2eea78c4d2dafa198dd9013f7ff2fb11342e0d5181d6ff9838e9c7a01872430e937 WHIRLPOOL 1db2de9ef18412b71ed8d9ea2ac5a14056426acbd26de8852a9dfa9d82175db8b98b5944b3389b08ff0eeb10cd49601f619a8906375001c4fdd3668e58c602a1
+DIST lldb-3.7.0rc2.src.tar.xz 10645800 SHA256 56a3e14de7568f1fa151f7d1af014dfc4f54e589c062ba04b2d9b7ae1f28e1ae SHA512 af55731213fa65e96daff5ed95d7b101609103575ffe854e75296ca7cc6001e7b2d3198a3301573b4f70cdfea6752e5db736ba6e17937adce316ef6206d4b2a4 WHIRLPOOL 16eac78fcd2c3f8988450885dd4a52cf41b6f0367878811ef72f784b67cec8fb14591ca205a9b443691e8e7d702a7667c4e7aded3aaa2ac3276d022c8dc2d615
 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
@@ -40,3 +44,4 @@ DIST llvm-3.6.0.src.tar.xz 12750908 SHA256 b39a69e501b49e8f73ff75c9ad72313681ee5
 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.0rc2.src.tar.xz 14624620 SHA256 36a79ba3198afb5c973d89ec2e4ef1d4587d97fa3b3f51fb1badcd7c0c868213 SHA512 c4cbde12650e6b6537b2d1d6cdae85e0f009cbd69c848579ca45946564a7667b212883a9cf49c82e28c9efe978dcc1ce1ac9c21b506c31149b7f69a4f996e0d0 WHIRLPOOL 81015661b5e1a1b1b8f2e264403b9c7d809782f8fa3ba6090343e6a9f6f85dba361b449bf2d72ff80d27bbea87ee63ca94f3c23b6478e10858e5b2f53384d52f

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/llvm-3.7.0_rc2.ebuild b/sys-devel/llvm/llvm-3.7.0_rc2.ebuild
new file mode 100644
index 0000000..b2ed256
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.7.0_rc2.ebuild
@@ -0,0 +1,486 @@
+# 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/pre-releases/${PV/_rc*}/${PV/3.7.0_}/${P/_}.src.tar.xz
+	clang? ( http://llvm.org/pre-releases/${PV/_rc*}/${PV/3.7.0_}/compiler-rt-${PV/_}.src.tar.xz
+		http://llvm.org/pre-releases/${PV/_rc*}/${PV/3.7.0_}/cfe-${PV/_}.src.tar.xz
+		http://llvm.org/pre-releases/${PV/_rc*}/${PV/3.7.0_}/clang-tools-extra-${PV/_}.src.tar.xz )
+	lldb? ( http://llvm.org/pre-releases/${PV/_rc*}/${PV/3.7.0_}/lldb-${PV/_}.src.tar.xz )"
+#	!doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P/_rc*}-manpages.tar.bz2 )"
+
+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= )
+	)
+	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:5=[${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
+
+	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
+
+	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
+
+	# 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
+
+		# 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
+
+	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=${PN%.*}
+
+		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
+}

diff --git a/sys-devel/llvm/metadata.xml b/sys-devel/llvm/metadata.xml
index 7698800..53210f7 100644
--- a/sys-devel/llvm/metadata.xml
+++ b/sys-devel/llvm/metadata.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
 	<maintainer>
 		<email>voyageur@gentoo.org</email>


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2015-12-02 19:55 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2015-12-02 19:55 UTC (permalink / raw
  To: gentoo-commits

commit:     8eff1b80294e92ebc2f0273980ccabdc615f85f3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  2 19:27:50 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Dec  2 19:55:48 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8eff1b80

sys-devel/llvm: Fix bogus flags and paths in llvm-config, #565358

Fix llvm-config to avoid bogus results. In particular:

1. Limit --cflags and --cxxflags to package-specific flags. Do not
output the whole flag-string used during the build. This fixes libclc
build issues when LLVM build flags were not tolerated by clang.

2. Fix library names and paths to use shared library suffix rather than
static library suffix, especially that we do not install static
libraries.

3. Wipe out --system-libs since they should not be required for dynamic
linking.

4. Ban --obj-root and --src-root when running outside source tree, since
we are not installing any sources and therefore their results would
always be bogus.

Based on patch provided by Steven Newbury.

Fixes: https://bugs.gentoo.org/565358

 sys-devel/llvm/files/llvm-3.7-llvm-config.patch    | 113 +++++++++++++++++++++
 .../{llvm-9999.ebuild => llvm-3.7.0-r3.ebuild}     | 104 +++++++++++--------
 sys-devel/llvm/llvm-9999.ebuild                    |   4 +
 3 files changed, 181 insertions(+), 40 deletions(-)

diff --git a/sys-devel/llvm/files/llvm-3.7-llvm-config.patch b/sys-devel/llvm/files/llvm-3.7-llvm-config.patch
new file mode 100644
index 0000000..932c92b
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.7-llvm-config.patch
@@ -0,0 +1,113 @@
+From 8a51e9673859eb3fb819f0d1dad5e2a60d1a3c0a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 2 Dec 2015 16:04:56 +0100
+Subject: [PATCH] llvm-config: Clean up exported values, update for shared
+ linking
+
+Gentoo-specific fixup for llvm-config, including:
+- wiping build-specific CFLAGS, CXXFLAGS,
+- updating library suffixes for shared libs,
+- wiping --system-libs for shared linking,
+- banning --obj-root and --src-root due to no sources installed.
+
+Thanks to Steven Newbury for the initial patch.
+
+Bug: https://bugs.gentoo.org/565358
+Bug: https://bugs.gentoo.org/501684
+---
+ tools/llvm-config/CMakeLists.txt    |  11 ++++++++---
+ tools/llvm-config/llvm-config.cpp   |  22 ++++++++++++++++------
+ utils/llvm-build/llvmbuild/main.py  |   4 +++-
+ 4 files changed, 27 insertions(+), 10 deletions(-)
+
+diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
+index edbd8c9..9a801bd 100644
+--- a/tools/llvm-config/CMakeLists.txt
++++ b/tools/llvm-config/CMakeLists.txt
+@@ -22,12 +22,17 @@ get_property(COMPILE_FLAGS TARGET llvm-config PROPERTY COMPILE_FLAGS)
+ set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR})
+ set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
+ set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
++# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler
++# specific flags will be set when we don't know what compiler will be used
++# with external project utilising llvm-config.  C++ Standard is required.
++# TODO: figure out if we can remove -std=c++11 and move it to revdeps.
++set(LLVM_CFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
++set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+ # Use the C++ link flags, since they should be a superset of C link flags.
+ set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
+ set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
+-set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
++# We don't do static libs, so we don't need to supply any system-libs
++set(LLVM_SYSTEM_LIBS "")
+ string(REPLACE ";" " " LLVM_TARGETS_BUILT "${LLVM_TARGETS_TO_BUILD}")
+ configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY)
+ 
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 879b9ab..d2c43fa 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -323,10 +323,19 @@ int main(int argc, char **argv) {
+ #else
+         OS << "ON\n";
+ #endif
+-      } else if (Arg == "--obj-root") {
+-        OS << ActivePrefix << '\n';
+-      } else if (Arg == "--src-root") {
+-        OS << LLVM_SRC_ROOT << '\n';
++      } else if (Arg == "--obj-root" || Arg == "--src-root") {
++        if (IsInDevelopmentTree) {
++          if (Arg == "--obj-root") {
++            OS << ActivePrefix << '\n';
++          } else {
++            OS << LLVM_SRC_ROOT << '\n';
++          }
++        } else {
++          // sources are not installed
++          llvm::errs() << "llvm-config: sources not installed, "
++                       << Arg << " not available\n";
++          exit(1);
++        }
+       } else {
+         usage();
+       }
+@@ -360,8 +369,9 @@ int main(int argc, char **argv) {
+           OS << ActiveLibDir << '/' << Lib;
+         } else if (PrintLibs) {
+           // If this is a typical library name, include it using -l.
+-          if (Lib.startswith("lib") && Lib.endswith(".a")) {
+-            OS << "-l" << Lib.slice(3, Lib.size()-2);
++          if (Lib.startswith("lib") && Lib.endswith(LTDL_SHLIB_EXT)) {
++            // sizeof counts trailing NUL
++            OS << "-l" << Lib.slice(3, Lib.size()-sizeof(LTDL_SHLIB_EXT)+1);
+             continue;
+           }
+ 
+diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
+index 353741f..4ba5e91 100644
+--- a/utils/llvm-build/llvmbuild/main.py
++++ b/utils/llvm-build/llvmbuild/main.py
+@@ -393,6 +393,8 @@ subdirectories = %s
+ //
+ //===----------------------------------------------------------------------===//
+ 
++#include "llvm/Config/config.h"
++
+ """)
+         f.write('struct AvailableComponent {\n')
+         f.write('  /// The name of the component.\n')
+@@ -413,7 +415,7 @@ subdirectories = %s
+             if library_name is None:
+                 library_name_as_cstr = '0'
+             else:
+-                library_name_as_cstr = '"lib%s.a"' % library_name
++                library_name_as_cstr = '"lib%s" LTDL_SHLIB_EXT' % library_name
+             f.write('  { "%s", %s, %d, { %s } },\n' % (
+                 name, library_name_as_cstr, is_installed,
+                 ', '.join('"%s"' % dep
+
+-- 
+2.6.3
+

diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-3.7.0-r3.ebuild
similarity index 82%
copy from sys-devel/llvm/llvm-9999.ebuild
copy to sys-devel/llvm/llvm-3.7.0-r3.ebuild
index a413692..4fe4d69 100644
--- a/sys-devel/llvm/llvm-9999.ebuild
+++ b/sys-devel/llvm/llvm-3.7.0-r3.ebuild
@@ -7,19 +7,22 @@ EAPI=5
 : ${CMAKE_MAKEFILE_GENERATOR:=ninja}
 PYTHON_COMPAT=( python2_7 pypy )
 
-inherit check-reqs cmake-utils eutils flag-o-matic git-r3 multilib \
+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=""
-EGIT_REPO_URI="http://llvm.org/git/llvm.git
-	https://github.com/llvm-mirror/llvm.git"
+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=""
-IUSE="clang debug +doc gold libedit +libffi lldb multitarget ncurses ocaml
+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="
@@ -39,7 +42,8 @@ COMMON_DEPEND="
 	ocaml? (
 		>=dev-lang/ocaml-4.00.0:0=
 		dev-ml/findlib
-		dev-ml/ocaml-ctypes )"
+		dev-ml/ocaml-ctypes
+		!!<=sys-devel/llvm-3.7.0-r1[ocaml] )"
 # configparser-3.2 breaks the build (3.3 or none at all are fine)
 DEPEND="${COMMON_DEPEND}
 	dev-lang/perl
@@ -71,6 +75,8 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE}
 	lldb? ( clang xml )
 	test? ( || ( $(python_gen_useflags 'python*') ) )"
 
+S=${WORKDIR}/${P/_}.src
+
 pkg_pretend() {
 	# in megs
 	# !clang !debug !multitarget -O2       400
@@ -124,40 +130,30 @@ pkg_setup() {
 }
 
 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
+	default
 
 	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
+		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
-		git-r3_checkout http://llvm.org/git/lldb.git \
-			"${S}"/tools/lldb
+		mv "${WORKDIR}"/lldb-${PV/_}.src "${S}"/tools/lldb \
+			|| die "lldb source directory move failed"
 	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
+	epatch "${FILESDIR}"/cmake/${P}-ocaml-multilib.patch
+	# Do not build/install ocaml docs with USE=-doc, bug #562008
+	epatch "${FILESDIR}"/cmake/${P}-ocaml-build_doc.patch
 
 	# Make it possible to override Sphinx HTML install dirs
 	# https://llvm.org/bugs/show_bug.cgi?id=23780
@@ -171,20 +167,28 @@ src_prepare() {
 	# 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
+	# Fix llvm-config for shared linking and sane flags
+	# https://bugs.gentoo.org/show_bug.cgi?id=565358
+	epatch "${FILESDIR}"/llvm-3.7-llvm-config.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.8-gentoo-install.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/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
 
+		# Do not force -march flags on arm platforms
+		# https://bugs.gentoo.org/show_bug.cgi?id=562706
+		epatch "${FILESDIR}"/cmake/${P}-compiler_rt_arm_march_flags.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
@@ -201,6 +205,15 @@ src_prepare() {
 		# https://llvm.org/bugs/show_bug.cgi?id=18841
 		sed -e 's/add_subdirectory(readline)/#&/' \
 			-i tools/lldb/scripts/Python/modules/CMakeLists.txt || die
+
+		# Fix Python paths, bugs #562436 and #562438
+		epatch "${FILESDIR}"/${PN}-3.7-lldb_python.patch
+		sed -e "s/GENTOO_LIBDIR/$(get_libdir)/" \
+			-i tools/lldb/scripts/Python/finishSwigPythonLLDB.py || die
+
+		# Fix build with ncurses[tinfo], #560474
+		# http://llvm.org/viewvc/llvm-project?view=revision&revision=247842
+		epatch "${FILESDIR}"/cmake/${P}-lldb_tinfo.patch
 	fi
 
 	# User patches
@@ -382,7 +395,7 @@ src_install() {
 
 	if use clang; then
 		# note: magic applied in multilib_src_install()!
-		CLANG_VERSION=3.8
+		CLANG_VERSION=${PV%.*}
 
 		MULTILIB_CHOST_TOOLS+=(
 			/usr/bin/clang
@@ -405,8 +418,8 @@ multilib_src_install() {
 	cmake-utils_src_install
 
 	if multilib_is_native_abi; then
-		# Install docs.
-		#use doc && dohtml -r "${S}"/docs/_build/html/
+		# Install man pages.
+		use doc || doman "${WORKDIR}"/${P}-manpages/*.1
 
 		# Symlink the gold plugin.
 		if use gold; then
@@ -461,9 +474,22 @@ multilib_src_install_all() {
 	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/bin >/dev/null || die
+				pushd tools/scan-view >/dev/null || die
 
 				python_doscript scan-view
 
@@ -472,8 +498,6 @@ multilib_src_install_all() {
 				python_domodule *.py Resources
 
 				popd >/dev/null || die
-
-				# TODO: remove files installed in /usr/share
 			fi
 
 			if use python ; then

diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild
index a413692..ce52542 100644
--- a/sys-devel/llvm/llvm-9999.ebuild
+++ b/sys-devel/llvm/llvm-9999.ebuild
@@ -174,6 +174,10 @@ src_prepare() {
 	# Allow custom cmake build types (like 'Gentoo')
 	epatch "${FILESDIR}"/cmake/${PN}-3.8-allow_custom_cmake_build_types.patch
 
+	# Fix llvm-config for shared linking and sane flags
+	# https://bugs.gentoo.org/show_bug.cgi?id=565358
+	epatch "${FILESDIR}"/llvm-3.7-llvm-config.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


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-01-07 22:10 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2016-01-07 22:10 UTC (permalink / raw
  To: gentoo-commits

commit:     7a54b2144ec6ba5f875ac855a0570994f9898dde
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  7 09:44:41 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jan  7 22:09:41 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7a54b214

sys-devel/llvm: Drop ancient 2.9 version

 sys-devel/llvm/Manifest                            |   1 -
 .../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/llvm-2.9-r2.ebuild                  | 175 ---------------------
 4 files changed, 247 deletions(-)

diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
index f23c5de..340f77a 100644
--- a/sys-devel/llvm/Manifest
+++ b/sys-devel/llvm/Manifest
@@ -20,7 +20,6 @@ DIST compiler-rt-3.7.0.src.tar.xz 1192832 SHA256 227fa998520bc94974a428dc8e7654d
 DIST compiler-rt-3.7.1.src.tar.xz 1181772 SHA256 9d4769e4a927d3824bcb7a9c82b01e307c68588e6de4e7f04ab82d82c5af8181 SHA512 bf434519ea0838264c30de1e1e8681320aa868df0ecc825a45c659077b963a4120c18216946558cbf8aea24a8ac8ec39af2066dab906bc7cabc0894d51d61325 WHIRLPOOL 0bea047e48622884a6fc6bb3826046e9de5b3192006cc41c0ccd9d6c611674869c3c15988b531a0f7d9fea2cf951b90ecef385b85db765c6f99a48692fdcf223
 DIST lldb-3.7.0.src.tar.xz 10649660 SHA256 f4d7505bc111044eaa4033af012221e492938405b62522b8e3e354c20c4b71e9 SHA512 52157782ef13e2c8b7b35ff3ccc05887195fe46ddb6bafcf0707a3c46c1e034734b55342b8dbfc46cae7a8c3cb1012345284e4bedb2344c5016b8d19a12e90df WHIRLPOOL 8c0803a51820ec67944e27061c858e95a92aefa38a1540241fead2b63c5b065c1268cf958b14d8841f62fc8aea5da1e20204704426598bfc2c4e61bcda135c43
 DIST lldb-3.7.1.src.tar.xz 10650524 SHA256 9a0bc315ef55f44c98cdf92d064df0847f453ed156dd0ef6a87e04f5fd6a0e01 SHA512 d2d3e1052026edd6ef9113ff5362acb4a32cef598098b4031c35e389301130ef2e1bda594f30de4d65c9fdc0beaecdd35afcf36676eb540baad34015aca294d1 WHIRLPOOL bba9c700788f0cf86ac1de51383a223e1c92f724719cdd327d83189cb77714c1e10fb78569aeed3b3c639062a3410bb114f646a271fd0d9e8c9a8e45d090330a
-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

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
deleted file mode 100644
index b95d7d7..0000000
--- a/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch
+++ /dev/null
@@ -1,57 +0,0 @@
---- 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
deleted file mode 100644
index a48ad96..0000000
--- a/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch
+++ /dev/null
@@ -1,14 +0,0 @@
----
- 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/llvm-2.9-r2.ebuild b/sys-devel/llvm/llvm-2.9-r2.ebuild
deleted file mode 100644
index 515e387..0000000
--- a/sys-devel/llvm/llvm-2.9-r2.ebuild
+++ /dev/null
@@ -1,175 +0,0 @@
-# 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
-}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-01-07 22:10 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2016-01-07 22:10 UTC (permalink / raw
  To: gentoo-commits

commit:     6edc90a1c470d99ac0afb01430d7549882b3c73c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  7 14:01:32 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jan  7 22:09:41 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6edc90a1

sys-devel/llvm: Remove ancient 3.0 version

 sys-devel/llvm/Manifest                            |   1 -
 .../llvm-3.0-PPCCompilationCallbackC_static.patch  |  27 ---
 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 --
 sys-devel/llvm/llvm-3.0-r2.ebuild                  | 181 ---------------------
 6 files changed, 247 deletions(-)

diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
index 340f77a..90b47c4 100644
--- a/sys-devel/llvm/Manifest
+++ b/sys-devel/llvm/Manifest
@@ -20,7 +20,6 @@ DIST compiler-rt-3.7.0.src.tar.xz 1192832 SHA256 227fa998520bc94974a428dc8e7654d
 DIST compiler-rt-3.7.1.src.tar.xz 1181772 SHA256 9d4769e4a927d3824bcb7a9c82b01e307c68588e6de4e7f04ab82d82c5af8181 SHA512 bf434519ea0838264c30de1e1e8681320aa868df0ecc825a45c659077b963a4120c18216946558cbf8aea24a8ac8ec39af2066dab906bc7cabc0894d51d61325 WHIRLPOOL 0bea047e48622884a6fc6bb3826046e9de5b3192006cc41c0ccd9d6c611674869c3c15988b531a0f7d9fea2cf951b90ecef385b85db765c6f99a48692fdcf223
 DIST lldb-3.7.0.src.tar.xz 10649660 SHA256 f4d7505bc111044eaa4033af012221e492938405b62522b8e3e354c20c4b71e9 SHA512 52157782ef13e2c8b7b35ff3ccc05887195fe46ddb6bafcf0707a3c46c1e034734b55342b8dbfc46cae7a8c3cb1012345284e4bedb2344c5016b8d19a12e90df WHIRLPOOL 8c0803a51820ec67944e27061c858e95a92aefa38a1540241fead2b63c5b065c1268cf958b14d8841f62fc8aea5da1e20204704426598bfc2c4e61bcda135c43
 DIST lldb-3.7.1.src.tar.xz 10650524 SHA256 9a0bc315ef55f44c98cdf92d064df0847f453ed156dd0ef6a87e04f5fd6a0e01 SHA512 d2d3e1052026edd6ef9113ff5362acb4a32cef598098b4031c35e389301130ef2e1bda594f30de4d65c9fdc0beaecdd35afcf36676eb540baad34015aca294d1 WHIRLPOOL bba9c700788f0cf86ac1de51383a223e1c92f724719cdd327d83189cb77714c1e10fb78569aeed3b3c639062a3410bb114f646a271fd0d9e8c9a8e45d090330a
-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

diff --git a/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch
deleted file mode 100644
index 04e4024..0000000
--- a/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-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-gold_LTO_link.patch b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch
deleted file mode 100644
index 031448d..0000000
--- a/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- 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
deleted file mode 100644
index 18f5cf6..0000000
--- a/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 69ba74d..0000000
--- a/sys-devel/llvm/files/llvm-3.0-set_soname.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-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/llvm-3.0-r2.ebuild b/sys-devel/llvm/llvm-3.0-r2.ebuild
deleted file mode 100644
index a0caca1..0000000
--- a/sys-devel/llvm/llvm-3.0-r2.ebuild
+++ /dev/null
@@ -1,181 +0,0 @@
-# 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
-}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-01-07 22:10 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2016-01-07 22:10 UTC (permalink / raw
  To: gentoo-commits

commit:     2f983b04ab255ca5426554141b165a9df55a7337
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  7 15:33:00 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jan  7 22:09:41 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f983b04

sys-devel/llvm: Remove ancient 3.2 version

 sys-devel/llvm/Manifest                       |   2 -
 sys-devel/llvm/files/llvm-3.0-PPC_macro.patch |  43 ------
 sys-devel/llvm/llvm-3.2.ebuild                | 206 --------------------------
 3 files changed, 251 deletions(-)

diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
index b0970e7..6112cab 100644
--- a/sys-devel/llvm/Manifest
+++ b/sys-devel/llvm/Manifest
@@ -20,8 +20,6 @@ DIST compiler-rt-3.7.0.src.tar.xz 1192832 SHA256 227fa998520bc94974a428dc8e7654d
 DIST compiler-rt-3.7.1.src.tar.xz 1181772 SHA256 9d4769e4a927d3824bcb7a9c82b01e307c68588e6de4e7f04ab82d82c5af8181 SHA512 bf434519ea0838264c30de1e1e8681320aa868df0ecc825a45c659077b963a4120c18216946558cbf8aea24a8ac8ec39af2066dab906bc7cabc0894d51d61325 WHIRLPOOL 0bea047e48622884a6fc6bb3826046e9de5b3192006cc41c0ccd9d6c611674869c3c15988b531a0f7d9fea2cf951b90ecef385b85db765c6f99a48692fdcf223
 DIST lldb-3.7.0.src.tar.xz 10649660 SHA256 f4d7505bc111044eaa4033af012221e492938405b62522b8e3e354c20c4b71e9 SHA512 52157782ef13e2c8b7b35ff3ccc05887195fe46ddb6bafcf0707a3c46c1e034734b55342b8dbfc46cae7a8c3cb1012345284e4bedb2344c5016b8d19a12e90df WHIRLPOOL 8c0803a51820ec67944e27061c858e95a92aefa38a1540241fead2b63c5b065c1268cf958b14d8841f62fc8aea5da1e20204704426598bfc2c4e61bcda135c43
 DIST lldb-3.7.1.src.tar.xz 10650524 SHA256 9a0bc315ef55f44c98cdf92d064df0847f453ed156dd0ef6a87e04f5fd6a0e01 SHA512 d2d3e1052026edd6ef9113ff5362acb4a32cef598098b4031c35e389301130ef2e1bda594f30de4d65c9fdc0beaecdd35afcf36676eb540baad34015aca294d1 WHIRLPOOL bba9c700788f0cf86ac1de51383a223e1c92f724719cdd327d83189cb77714c1e10fb78569aeed3b3c639062a3410bb114f646a271fd0d9e8c9a8e45d090330a
-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

diff --git a/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch
deleted file mode 100644
index c485e9b..0000000
--- a/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-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/llvm-3.2.ebuild b/sys-devel/llvm/llvm-3.2.ebuild
deleted file mode 100644
index 3b7ebd1..0000000
--- a/sys-devel/llvm/llvm-3.2.ebuild
+++ /dev/null
@@ -1,206 +0,0 @@
-# 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
-}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-01-25 15:28 Bernard Cafarelli
  0 siblings, 0 replies; 11+ messages in thread
From: Bernard Cafarelli @ 2016-01-25 15:28 UTC (permalink / raw
  To: gentoo-commits

commit:     ef49044e3259463b2eb25bc8e125507b0b6f583f
Author:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 25 15:27:14 2016 +0000
Commit:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
CommitDate: Mon Jan 25 15:27:23 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef49044e

sys-devel/llvm: fix live ebuild

Update clang version, bug #572396
Update llvm-config patch, bug #572564

Package-Manager: portage-2.2.27

 sys-devel/llvm/files/llvm-3.9-llvm-config.patch | 75 +++++++++++++++++++++++++
 sys-devel/llvm/llvm-9999.ebuild                 |  6 +-
 2 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/sys-devel/llvm/files/llvm-3.9-llvm-config.patch b/sys-devel/llvm/files/llvm-3.9-llvm-config.patch
new file mode 100644
index 0000000..90984e6
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.9-llvm-config.patch
@@ -0,0 +1,75 @@
+diff -Naur llvm-9999.orig/tools/llvm-config/CMakeLists.txt llvm-9999/tools/llvm-config/CMakeLists.txt
+--- llvm-9999.orig/tools/llvm-config/CMakeLists.txt	2016-01-25 14:47:55.447301061 +0100
++++ llvm-9999/tools/llvm-config/CMakeLists.txt	2016-01-25 14:54:03.897257098 +0100
+@@ -22,8 +22,12 @@
+ set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR})
+ set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
+ set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
++# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler
++# specific flags will be set when we don't know what compiler will be used
++# with external project utilising llvm-config.  C++ Standard is required.
++# TODO: figure out if we can remove -std=c++11 and move it to revdeps.
+ set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
++set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+ set(LLVM_BUILD_SYSTEM cmake)
+ set(LLVM_HAS_RTTI ${LLVM_CONFIG_HAS_RTTI})
+ set(LLVM_DYLIB_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}${LLVM_VERSION_SUFFIX}")
+@@ -31,7 +35,8 @@
+ # Use the C++ link flags, since they should be a superset of C link flags.
+ set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
+ set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
+-set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
++# We don't do static libs, so we don't need to supply any system-libs
++set(LLVM_SYSTEM_LIBS "")
+ if(BUILD_SHARED_LIBS)
+   set(LLVM_ENABLE_SHARED ON)
+ else()
+diff -Naur llvm-9999.orig/tools/llvm-config/llvm-config.cpp llvm-9999/tools/llvm-config/llvm-config.cpp
+--- llvm-9999.orig/tools/llvm-config/llvm-config.cpp	2016-01-25 14:47:55.447301061 +0100
++++ llvm-9999/tools/llvm-config/llvm-config.cpp	2016-01-25 14:57:05.286236312 +0100
+@@ -532,10 +532,19 @@
+         OS << LLVM_HAS_RTTI << '\n';
+       } else if (Arg == "--shared-mode") {
+         PrintSharedMode = true;
+-      } else if (Arg == "--obj-root") {
+-        OS << ActivePrefix << '\n';
+-      } else if (Arg == "--src-root") {
+-        OS << LLVM_SRC_ROOT << '\n';
++      } else if (Arg == "--obj-root" || Arg == "--src-root") {
++        if (IsInDevelopmentTree) {
++          if (Arg == "--obj-root") {
++            OS << ActivePrefix << '\n';
++          } else {
++            OS << LLVM_SRC_ROOT << '\n';
++          }
++        } else {
++          // sources are not installed
++          llvm::errs() << "llvm-config: sources not installed, "
++                       << Arg << " not available\n";
++          exit(1);
++        }
+       } else if (Arg == "--link-shared") {
+         LinkMode = LinkModeShared;
+       } else if (Arg == "--link-static") {
+diff -Naur llvm-9999.orig/utils/llvm-build/llvmbuild/main.py llvm-9999/utils/llvm-build/llvmbuild/main.py
+--- llvm-9999.orig/utils/llvm-build/llvmbuild/main.py	2016-01-25 14:47:55.511301054 +0100
++++ llvm-9999/utils/llvm-build/llvmbuild/main.py	2016-01-25 14:58:13.014228689 +0100
+@@ -393,6 +393,8 @@
+ //
+ //===----------------------------------------------------------------------===//
+ 
++#include "llvm/Config/config.h"
++
+ """)
+         f.write('struct AvailableComponent {\n')
+         f.write('  /// The name of the component.\n')
+@@ -413,7 +415,7 @@
+             if library_name is None:
+                 library_name_as_cstr = 'nullptr'
+             else:
+-                library_name_as_cstr = '"lib%s.a"' % library_name
++                library_name_as_cstr = '"lib%s" LTDL_SHLIB_EXT' % library_name
+             if is_installed:
+                 is_installed_as_cstr = 'true'
+             else:

diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild
index 16c4d32..d9adc68 100644
--- a/sys-devel/llvm/llvm-9999.ebuild
+++ b/sys-devel/llvm/llvm-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -160,7 +160,7 @@ src_prepare() {
 
 	# Fix llvm-config for shared linking and sane flags
 	# https://bugs.gentoo.org/show_bug.cgi?id=565358
-	epatch "${FILESDIR}"/llvm-3.8-llvm-config.patch
+	epatch "${FILESDIR}"/llvm-3.9-llvm-config.patch
 
 	# disable use of SDK on OSX, bug #568758
 	sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
@@ -374,7 +374,7 @@ src_install() {
 
 	if use clang; then
 		# note: magic applied in multilib_src_install()!
-		CLANG_VERSION=3.8
+		CLANG_VERSION=3.9
 
 		MULTILIB_CHOST_TOOLS+=(
 			/usr/bin/clang


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-03-28 15:57 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2016-03-28 15:57 UTC (permalink / raw
  To: gentoo-commits

commit:     b14c1f316ec560606a2606f5b6d821f41b2844de
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 21:04:33 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 28 15:57:20 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b14c1f31

sys-devel/llvm: Update llvm-config patches for improved compatibility

Backport upstream r252532 that improves llvm-config support for shared
libraries, adding --shared-mode option in particular, along with
--build-system option needed for it. Also fix --build-mode to report
"Release" rather than non-standard "Gentoo" type.

Bug: https://bugs.gentoo.org/show_bug.cgi?id=578304

 .../llvm/files/llvm-3.7.1-llvm-config-0.patch      |  83 +++
 .../llvm/files/llvm-3.7.1-llvm-config-1.patch      | 453 +++++++++++++++++
 .../llvm/files/llvm-3.7.1-llvm-config-2.patch      | 113 +++++
 .../llvm/files/llvm-3.7.1-llvm-config-3.patch      |  29 ++
 sys-devel/llvm/llvm-3.7.1-r1.ebuild                | 559 +++++++++++++++++++++
 5 files changed, 1237 insertions(+)

diff --git a/sys-devel/llvm/files/llvm-3.7.1-llvm-config-0.patch b/sys-devel/llvm/files/llvm-3.7.1-llvm-config-0.patch
new file mode 100644
index 0000000..87f9ff8
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.7.1-llvm-config-0.patch
@@ -0,0 +1,83 @@
+From a59464503a7e059ddfd3fb4308753b692d03d996 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Wed, 9 Sep 2015 16:39:30 +0000
+Subject: [PATCH 1/4] llvm-config: Add --build-system option
+
+Summary:
+This can be used for distinguishing between cmake and autoconf builds.
+Users may need this in order to handle inconsistencies between the
+outputs of the two build systems.
+
+Reviewers: echristo, chandlerc, beanz
+
+Subscribers: llvm-commits
+
+Differential Revision: http://reviews.llvm.org/D11838
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247159 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ tools/llvm-config/BuildVariables.inc.in | 1 +
+ tools/llvm-config/CMakeLists.txt        | 2 ++
+ tools/llvm-config/Makefile              | 2 ++
+ tools/llvm-config/llvm-config.cpp       | 3 +++
+ 4 files changed, 8 insertions(+)
+
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index 3f51f49..0f28fad 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_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
+index edbd8c9..dd53460 100644
+--- a/tools/llvm-config/CMakeLists.txt
++++ b/tools/llvm-config/CMakeLists.txt
+@@ -24,6 +24,8 @@ set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
+ set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+ set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+ set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
++set(LLVM_BUILD_SYSTEM cmake)
++
+ # Use the C++ link flags, since they should be a superset of C link flags.
+ set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
+ set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
+diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
+index 1ff8b6f..c2b5e8f 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_BUILD_SYSTEM@/autoconf/' \
++	  >> 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 879b9ab..4ce8f10 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -157,6 +157,7 @@ Options:\n\
+   --host-target     Target triple used to configure LLVM.\n\
+   --build-mode      Print build mode of LLVM tree (e.g. Debug or Release).\n\
+   --assertion-mode  Print assertion mode of LLVM tree (ON or OFF).\n\
++  --build-system    Print the build system used to build LLVM (autoconf or cmake).\n\
+ Typical components:\n\
+   all               All LLVM libraries (default).\n\
+   engine            Either a native JIT or a bitcode interpreter.\n";
+@@ -323,6 +324,8 @@ int main(int argc, char **argv) {
+ #else
+         OS << "ON\n";
+ #endif
++      } else if (Arg == "--build-system") {
++        OS << LLVM_BUILD_SYSTEM << '\n';
+       } else if (Arg == "--obj-root") {
+         OS << ActivePrefix << '\n';
+       } else if (Arg == "--src-root") {
+-- 
+2.7.4
+

diff --git a/sys-devel/llvm/files/llvm-3.7.1-llvm-config-1.patch b/sys-devel/llvm/files/llvm-3.7.1-llvm-config-1.patch
new file mode 100644
index 0000000..214a3bb
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.7.1-llvm-config-1.patch
@@ -0,0 +1,453 @@
+From 55433193c56e6b2e0792c3ca1b0ef3881ab01138 Mon Sep 17 00:00:00 2001
+From: Richard Diamond <wichard@vitalitystudios.com>
+Date: Mon, 9 Nov 2015 23:15:38 +0000
+Subject: [PATCH 2/4] Fix `llvm-config` to adapt to the install environment.
+
+Summary:
+This patch does a couple of things:
+
+  - Adds a new argument `--shared-mode` which accepts a list of components and prints whether or not the provided components need to be linked statically or shared.
+  - Fixes `--libnames` when CMake BUILD_SHARED_LIBS is used.
+  - Fixes `--libnames`, `--libs`, and `--libfiles` for dylib when static components aren't installed.
+  - Fixes `--libnames`, `--libs`, `--libfiles`, and `--components` to use LLVM_DYLIB_COMPONENTS as the component manifest for dylib linking.
+  - Uses the host platform's usual convention for filename extensions and such, instead of always defaulting to Unix-izms.
+
+Because I don't own a Mac, I am not able to test the Mac platform dependent stuff locally. If someone would be willing to run a build for me on their machine (unless there's a better option), I'd appreciate it.
+
+Reviewers: jfb, brad.king, whitequark, beanz
+
+Subscribers: beanz, jauhien, llvm-commits
+
+Differential Revision: http://reviews.llvm.org/D13198
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252532 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ bindings/ocaml/Makefile.ocaml           |   2 +
+ tools/llvm-config/BuildVariables.inc.in |   3 +
+ tools/llvm-config/CMakeLists.txt        |   5 +
+ tools/llvm-config/llvm-config.cpp       | 265 +++++++++++++++++++++++++++++---
+ 4 files changed, 253 insertions(+), 22 deletions(-)
+
+diff --git a/bindings/ocaml/Makefile.ocaml b/bindings/ocaml/Makefile.ocaml
+index 1f65a7b..22b96a2 100644
+--- a/bindings/ocaml/Makefile.ocaml
++++ b/bindings/ocaml/Makefile.ocaml
+@@ -277,6 +277,8 @@ uninstall-local:: uninstall-deplibs
+ 
+ build-deplibs: $(OutputLibs)
+ 
++$(OcamlDir)/%.so: $(LibDir)/%.so
++	$(Verb) ln -sf $< $@
+ $(OcamlDir)/%.a: $(LibDir)/%.a
+ 	$(Verb) ln -sf $< $@
+ 
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index 0f28fad..e384838 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -27,3 +27,6 @@
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
++#define LLVM_ENABLE_DYLIB "@LLVM_BUILD_LLVM_DYLIB@"
++#define LLVM_ENABLE_SHARED "@LLVM_ENABLE_SHARED@"
++#define LLVM_DYLIB_COMPONENTS "@LLVM_DYLIB_COMPONENTS@"
+diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
+index dd53460..173f6dc 100644
+--- a/tools/llvm-config/CMakeLists.txt
++++ b/tools/llvm-config/CMakeLists.txt
+@@ -30,6 +30,11 @@ set(LLVM_BUILD_SYSTEM cmake)
+ set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
+ set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
+ set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
++if(BUILD_SHARED_LIBS)
++  set(LLVM_ENABLE_SHARED ON)
++else()
++  set(LLVM_ENABLE_SHARED OFF)
++endif()
+ string(REPLACE ";" " " LLVM_TARGETS_BUILT "${LLVM_TARGETS_TO_BUILD}")
+ configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY)
+ 
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 4ce8f10..51efbd8 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -30,6 +30,7 @@
+ #include <cstdlib>
+ #include <set>
+ #include <vector>
++#include <unordered_set>
+ 
+ using namespace llvm;
+ 
+@@ -51,12 +52,16 @@ using namespace llvm;
+ /// \param Name - The component to traverse.
+ /// \param ComponentMap - A prebuilt map of component names to descriptors.
+ /// \param VisitedComponents [in] [out] - The set of already visited components.
+-/// \param RequiredLibs [out] - The ordered list of required libraries.
++/// \param RequiredLibs [out] - The ordered list of required
++/// libraries.
++/// \param GetComponentNames - Get the component names instead of the
++/// library name.
+ static void VisitComponent(StringRef Name,
+                            const StringMap<AvailableComponent*> &ComponentMap,
+                            std::set<AvailableComponent*> &VisitedComponents,
+                            std::vector<StringRef> &RequiredLibs,
+-                           bool IncludeNonInstalled) {
++                           bool IncludeNonInstalled, bool GetComponentNames,
++                           const std::string *ActiveLibDir, bool *HasMissing) {
+   // Lookup the component.
+   AvailableComponent *AC = ComponentMap.lookup(Name);
+   assert(AC && "Invalid component name!");
+@@ -74,12 +79,22 @@ static void VisitComponent(StringRef Name,
+   // Otherwise, visit all the dependencies.
+   for (unsigned i = 0; AC->RequiredLibraries[i]; ++i) {
+     VisitComponent(AC->RequiredLibraries[i], ComponentMap, VisitedComponents,
+-                   RequiredLibs, IncludeNonInstalled);
++                   RequiredLibs, IncludeNonInstalled, GetComponentNames,
++                   ActiveLibDir, HasMissing);
++  }
++
++  if (GetComponentNames) {
++    RequiredLibs.push_back(Name);
++    return;
+   }
+ 
+   // Add to the required library list.
+-  if (AC->Library)
++  if (AC->Library) {
++    if (!IncludeNonInstalled && HasMissing && !*HasMissing && ActiveLibDir) {
++      *HasMissing = !sys::fs::exists(*ActiveLibDir + "/" + AC->Library);
++    }
+     RequiredLibs.push_back(AC->Library);
++  }
+ }
+ 
+ /// \brief Compute the list of required libraries for a given list of
+@@ -91,9 +106,12 @@ static void VisitComponent(StringRef Name,
+ /// are required to link the given components.
+ /// \param IncludeNonInstalled - Whether non-installed components should be
+ /// reported.
++/// \param GetComponentNames - True if one would prefer the component names.
+ static void ComputeLibsForComponents(const std::vector<StringRef> &Components,
+                                      std::vector<StringRef> &RequiredLibs,
+-                                     bool IncludeNonInstalled) {
++                                     bool IncludeNonInstalled, bool GetComponentNames,
++                                     const std::string *ActiveLibDir,
++                                     bool *HasMissing) {
+   std::set<AvailableComponent*> VisitedComponents;
+ 
+   // Build a map of component names to information.
+@@ -116,7 +134,8 @@ static void ComputeLibsForComponents(const std::vector<StringRef> &Components,
+     }
+ 
+     VisitComponent(ComponentLower, ComponentMap, VisitedComponents,
+-                   RequiredLibs, IncludeNonInstalled);
++                   RequiredLibs, IncludeNonInstalled, GetComponentNames,
++                   ActiveLibDir, HasMissing);
+   }
+ 
+   // The list is now ordered with leafs first, we want the libraries to printed
+@@ -157,6 +176,7 @@ Options:\n\
+   --host-target     Target triple used to configure LLVM.\n\
+   --build-mode      Print build mode of LLVM tree (e.g. Debug or Release).\n\
+   --assertion-mode  Print assertion mode of LLVM tree (ON or OFF).\n\
++  --shared-mode     Print how the provided components can be collectively linked (`shared` or `static`).\n\
+   --build-system    Print the build system used to build LLVM (autoconf or cmake).\n\
+ Typical components:\n\
+   all               All LLVM libraries (default).\n\
+@@ -172,10 +192,38 @@ std::string GetExecutablePath(const char *Argv0) {
+   return llvm::sys::fs::getMainExecutable(Argv0, P);
+ }
+ 
++/// \brief Expand the semi-colon delimited LLVM_DYLIB_COMPONENTS into
++/// the full list of components.
++std::vector<StringRef> GetAllDyLibComponents(const bool IsInDevelopmentTree,
++                                             const bool GetComponentNames) {
++  std::vector<StringRef> DyLibComponents;
++  {
++    StringRef DyLibComponentsStr(LLVM_DYLIB_COMPONENTS);
++    size_t Offset = 0;
++    while (true) {
++      const size_t NextOffset = DyLibComponentsStr.find(';', Offset);
++      DyLibComponents.push_back(DyLibComponentsStr.substr(Offset, NextOffset));
++      if (NextOffset == std::string::npos) {
++        break;
++      }
++      Offset = NextOffset + 1;
++    }
++
++    assert(DyLibComponents.size() > 0);
++  }
++
++  std::vector<StringRef> Components;
++  ComputeLibsForComponents(DyLibComponents, Components,
++                           /*IncludeNonInstalled=*/IsInDevelopmentTree,
++                           GetComponentNames, nullptr, nullptr);
++
++  return std::move(Components);
++}
++
+ int main(int argc, char **argv) {
+   std::vector<StringRef> Components;
+   bool PrintLibs = false, PrintLibNames = false, PrintLibFiles = false;
+-  bool PrintSystemLibs = false;
++  bool PrintSystemLibs = false, PrintSharedMode = false;
+   bool HasAnyOption = false;
+ 
+   // llvm-config is designed to support being run both from a development tree
+@@ -270,6 +318,108 @@ int main(int argc, char **argv) {
+     ActiveIncludeOption = "-I" + ActiveIncludeDir;
+   }
+ 
++  /// We only use `shared library` mode in cases where the static library form
++  /// of the components provided are not available; note however that this is
++  /// skipped if we're run from within the build dir. However, once installed,
++  /// we still need to provide correct output when the static archives are
++  /// removed or, as in the case of CMake's `BUILD_SHARED_LIBS`, never present
++  /// in the first place. This can't be done at configure/build time.
++
++  StringRef SharedExt, SharedVersionedExt, SharedDir, SharedPrefix, StaticExt,
++    StaticPrefix, StaticDir = "lib";
++  const Triple HostTriple(Triple::normalize(LLVM_DEFAULT_TARGET_TRIPLE));
++  if (HostTriple.isOSWindows()) {
++    SharedExt = "dll";
++    SharedVersionedExt = PACKAGE_VERSION ".dll";
++    StaticExt = "a";
++    SharedDir = ActiveBinDir;
++    StaticDir = ActiveLibDir;
++    StaticPrefix = SharedPrefix = "";
++  } else if (HostTriple.isOSDarwin()) {
++    SharedExt = "dylib";
++    SharedVersionedExt = PACKAGE_VERSION ".dylib";
++    StaticExt = "a";
++    StaticDir = SharedDir = ActiveLibDir;
++    StaticPrefix = SharedPrefix = "lib";
++  } else {
++    // default to the unix values:
++    SharedExt = "so";
++    SharedVersionedExt = PACKAGE_VERSION ".so";
++    StaticExt = "a";
++    StaticDir = SharedDir = ActiveLibDir;
++    StaticPrefix = SharedPrefix = "lib";
++  }
++
++  const bool BuiltDyLib = (std::strcmp(LLVM_ENABLE_DYLIB, "ON") == 0);
++
++  enum { CMake, AutoConf } ConfigTool;
++  if (std::strcmp(LLVM_BUILD_SYSTEM, "cmake") == 0) {
++    ConfigTool = CMake;
++  } else {
++    ConfigTool = AutoConf;
++  }
++
++  /// CMake style shared libs, ie each component is in a shared library.
++  const bool BuiltSharedLibs =
++      (ConfigTool == CMake && std::strcmp(LLVM_ENABLE_SHARED, "ON") == 0);
++
++  bool DyLibExists = false;
++  const std::string DyLibName =
++    (SharedPrefix + "LLVM-" + SharedVersionedExt).str();
++
++  if (BuiltDyLib) {
++    DyLibExists = sys::fs::exists(SharedDir + "/" + DyLibName);
++  }
++
++  /// Get the component's library name without the lib prefix and the
++  /// extension. Returns true if Lib is in a recognized format.
++  auto GetComponentLibraryNameSlice = [&](const StringRef &Lib,
++                                          StringRef &Out) {
++    if (Lib.startswith("lib")) {
++      unsigned FromEnd;
++      if (Lib.endswith(StaticExt)) {
++        FromEnd = StaticExt.size() + 1;
++      } else if (Lib.endswith(SharedExt)) {
++        FromEnd = SharedExt.size() + 1;
++      } else {
++        FromEnd = 0;
++      }
++
++      if (FromEnd != 0) {
++        Out = Lib.slice(3, Lib.size() - FromEnd);
++        return true;
++      }
++    }
++
++    return false;
++  };
++  /// Maps Unixizms to the host platform.
++  auto GetComponentLibraryFileName = [&](const StringRef &Lib,
++                                         const bool ForceShared) {
++    std::string LibFileName = Lib;
++    StringRef LibName;
++    if (GetComponentLibraryNameSlice(Lib, LibName)) {
++      if (BuiltSharedLibs || ForceShared) {
++        LibFileName = (SharedPrefix + LibName + "." + SharedExt).str();
++      } else {
++        // default to static
++        LibFileName = (StaticPrefix + LibName + "." + StaticExt).str();
++      }
++    }
++
++    return LibFileName;
++  };
++  /// Get the full path for a possibly shared component library.
++  auto GetComponentLibraryPath = [&](const StringRef &Name,
++                                     const bool ForceShared) {
++    auto LibFileName = GetComponentLibraryFileName(Name, ForceShared);
++    if (BuiltSharedLibs || ForceShared) {
++      return (SharedDir + "/" + LibFileName).str();
++    } else {
++      return (StaticDir + "/" + LibFileName).str();
++    }
++  };
++
+   raw_ostream &OS = outs();
+   for (int i = 1; i != argc; ++i) {
+     StringRef Arg = argv[i];
+@@ -303,13 +453,33 @@ int main(int argc, char **argv) {
+       } else if (Arg == "--libfiles") {
+         PrintLibFiles = true;
+       } else if (Arg == "--components") {
++        /// If there are missing static archives and a dylib was
++        /// built, print LLVM_DYLIB_COMPONENTS instead of everything
++        /// in the manifest.
++        std::vector<StringRef> Components;
+         for (unsigned j = 0; j != array_lengthof(AvailableComponents); ++j) {
+           // Only include non-installed components when in a development tree.
+           if (!AvailableComponents[j].IsInstalled && !IsInDevelopmentTree)
+             continue;
+ 
+-          OS << ' ';
+-          OS << AvailableComponents[j].Name;
++          Components.push_back(AvailableComponents[j].Name);
++          if (AvailableComponents[j].Library && !IsInDevelopmentTree) {
++            if (DyLibExists &&
++                !sys::fs::exists(GetComponentLibraryPath(
++                    AvailableComponents[j].Library, false))) {
++              Components = GetAllDyLibComponents(IsInDevelopmentTree, true);
++              std::sort(Components.begin(), Components.end());
++              break;
++            }
++          }
++        }
++
++        for (unsigned I = 0; I < Components.size(); ++I) {
++          if (I) {
++            OS << ' ';
++          }
++
++          OS << Components[I];
+         }
+         OS << '\n';
+       } else if (Arg == "--targets-built") {
+@@ -324,6 +494,8 @@ int main(int argc, char **argv) {
+ #else
+         OS << "ON\n";
+ #endif
++      } else if (Arg == "--shared-mode") {
++        PrintSharedMode = true;
+       } else if (Arg == "--build-system") {
+         OS << LLVM_BUILD_SYSTEM << '\n';
+       } else if (Arg == "--obj-root") {
+@@ -341,35 +513,84 @@ int main(int argc, char **argv) {
+   if (!HasAnyOption)
+     usage();
+ 
+-  if (PrintLibs || PrintLibNames || PrintLibFiles || PrintSystemLibs) {
++  if (PrintLibs || PrintLibNames || PrintLibFiles || PrintSystemLibs ||
++      PrintSharedMode) {
++
++    if (PrintSharedMode && BuiltSharedLibs) {
++      OS << "shared\n";
++      return 0;
++    }
++
+     // If no components were specified, default to "all".
+     if (Components.empty())
+       Components.push_back("all");
+ 
+     // Construct the list of all the required libraries.
+     std::vector<StringRef> RequiredLibs;
++    bool HasMissing = false;
+     ComputeLibsForComponents(Components, RequiredLibs,
+-                             /*IncludeNonInstalled=*/IsInDevelopmentTree);
++                             /*IncludeNonInstalled=*/IsInDevelopmentTree, false,
++                             &ActiveLibDir, &HasMissing);
++
++    if (PrintSharedMode) {
++      std::unordered_set<std::string> FullDyLibComponents;
++      std::vector<StringRef> DyLibComponents =
++          GetAllDyLibComponents(IsInDevelopmentTree, false);
++
++      for (auto &Component : DyLibComponents) {
++        FullDyLibComponents.insert(Component);
++      }
++      DyLibComponents.clear();
++
++      for (auto &Lib : RequiredLibs) {
++        if (!FullDyLibComponents.count(Lib)) {
++          OS << "static\n";
++          return 0;
++        }
++      }
++      FullDyLibComponents.clear();
++
++      if (HasMissing && DyLibExists) {
++        OS << "shared\n";
++        return 0;
++      } else {
++        OS << "static\n";
++        return 0;
++      }
++    }
+ 
+     if (PrintLibs || PrintLibNames || PrintLibFiles) {
+-      for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
+-        StringRef Lib = RequiredLibs[i];
+-        if (i)
+-          OS << ' ';
+ 
++      auto PrintForLib = [&](const StringRef &Lib, const bool ForceShared) {
+         if (PrintLibNames) {
+-          OS << Lib;
++          OS << GetComponentLibraryFileName(Lib, ForceShared);
+         } else if (PrintLibFiles) {
+-          OS << ActiveLibDir << '/' << Lib;
++          OS << GetComponentLibraryPath(Lib, ForceShared);
+         } else if (PrintLibs) {
+           // If this is a typical library name, include it using -l.
+-          if (Lib.startswith("lib") && Lib.endswith(".a")) {
+-            OS << "-l" << Lib.slice(3, Lib.size()-2);
+-            continue;
++          StringRef LibName;
++          if (Lib.startswith("lib")) {
++            if (GetComponentLibraryNameSlice(Lib, LibName)) {
++              OS << "-l" << LibName;
++            } else {
++              OS << "-l:" << GetComponentLibraryFileName(Lib, ForceShared);
++            }
++          } else {
++            // Otherwise, print the full path.
++            OS << GetComponentLibraryPath(Lib, ForceShared);
+           }
++        }
++      };
++
++      if (HasMissing && DyLibExists) {
++        PrintForLib(DyLibName, true);
++      } else {
++        for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
++          StringRef Lib = RequiredLibs[i];
++          if (i)
++            OS << ' ';
+ 
+-          // Otherwise, print the full path.
+-          OS << ActiveLibDir << '/' << Lib;
++          PrintForLib(Lib, false);
+         }
+       }
+       OS << '\n';
+-- 
+2.7.4
+

diff --git a/sys-devel/llvm/files/llvm-3.7.1-llvm-config-2.patch b/sys-devel/llvm/files/llvm-3.7.1-llvm-config-2.patch
new file mode 100644
index 0000000..2895d38
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.7.1-llvm-config-2.patch
@@ -0,0 +1,113 @@
+From 4abc261d14c886c21d24f639293a60ce45c1dca3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 2 Dec 2015 16:04:56 +0100
+Subject: [PATCH 3/4] llvm-config: Clean up exported values, update for shared
+ linking
+
+Gentoo-specific fixup for llvm-config, including:
+- wiping build-specific CFLAGS, CXXFLAGS,
+- updating library suffixes for shared libs,
+- wiping --system-libs for shared linking,
+- banning --obj-root and --src-root due to no sources installed,
+- making --build-mode return "Release" rather than "Gentoo".
+
+Thanks to Steven Newbury for the initial patch.
+
+Bug: https://bugs.gentoo.org/565358
+Bug: https://bugs.gentoo.org/501684
+---
+ tools/llvm-config/CMakeLists.txt   | 11 ++++++++---
+ tools/llvm-config/llvm-config.cpp  | 20 +++++++++++++++-----
+ utils/llvm-build/llvmbuild/main.py |  4 +++-
+ 3 files changed, 26 insertions(+), 9 deletions(-)
+
+diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
+index 173f6dc..013ea8c 100644
+--- a/tools/llvm-config/CMakeLists.txt
++++ b/tools/llvm-config/CMakeLists.txt
+@@ -22,14 +22,19 @@ get_property(COMPILE_FLAGS TARGET llvm-config PROPERTY COMPILE_FLAGS)
+ set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR})
+ set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
+ set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
++# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler
++# specific flags will be set when we don't know what compiler will be used
++# with external project utilising llvm-config.  C++ Standard is required.
++# TODO: figure out if we can remove -std=c++11 and move it to revdeps.
++set(LLVM_CFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
++set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+ set(LLVM_BUILD_SYSTEM cmake)
+ 
+ # Use the C++ link flags, since they should be a superset of C link flags.
+ set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
+ set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
+-set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
++# We don't do static libs, so we don't need to supply any system-libs
++set(LLVM_SYSTEM_LIBS "")
+ if(BUILD_SHARED_LIBS)
+   set(LLVM_ENABLE_SHARED ON)
+ else()
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 51efbd8..315e5e1 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -487,7 +487,8 @@ int main(int argc, char **argv) {
+       } else if (Arg == "--host-target") {
+         OS << Triple::normalize(LLVM_DEFAULT_TARGET_TRIPLE) << '\n';
+       } else if (Arg == "--build-mode") {
+-        OS << build_mode << '\n';
++        // force Release since we force non-standard Gentoo build mode
++        OS << "Release" << '\n';
+       } else if (Arg == "--assertion-mode") {
+ #if defined(NDEBUG)
+         OS << "OFF\n";
+@@ -498,10 +499,19 @@ int main(int argc, char **argv) {
+         PrintSharedMode = true;
+       } else if (Arg == "--build-system") {
+         OS << LLVM_BUILD_SYSTEM << '\n';
+-      } else if (Arg == "--obj-root") {
+-        OS << ActivePrefix << '\n';
+-      } else if (Arg == "--src-root") {
+-        OS << LLVM_SRC_ROOT << '\n';
++      } else if (Arg == "--obj-root" || Arg == "--src-root") {
++        if (IsInDevelopmentTree) {
++          if (Arg == "--obj-root") {
++            OS << ActivePrefix << '\n';
++          } else {
++            OS << LLVM_SRC_ROOT << '\n';
++          }
++        } else {
++          // sources are not installed
++          llvm::errs() << "llvm-config: sources not installed, "
++                       << Arg << " not available\n";
++          exit(1);
++        }
+       } else {
+         usage();
+       }
+diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
+index 353741f..4ba5e91 100644
+--- a/utils/llvm-build/llvmbuild/main.py
++++ b/utils/llvm-build/llvmbuild/main.py
+@@ -393,6 +393,8 @@ subdirectories = %s
+ //
+ //===----------------------------------------------------------------------===//
+ 
++#include "llvm/Config/config.h"
++
+ """)
+         f.write('struct AvailableComponent {\n')
+         f.write('  /// The name of the component.\n')
+@@ -413,7 +415,7 @@ subdirectories = %s
+             if library_name is None:
+                 library_name_as_cstr = '0'
+             else:
+-                library_name_as_cstr = '"lib%s.a"' % library_name
++                library_name_as_cstr = '"lib%s" LTDL_SHLIB_EXT' % library_name
+             f.write('  { "%s", %s, %d, { %s } },\n' % (
+                 name, library_name_as_cstr, is_installed,
+                 ', '.join('"%s"' % dep
+-- 
+2.7.4
+

diff --git a/sys-devel/llvm/files/llvm-3.7.1-llvm-config-3.patch b/sys-devel/llvm/files/llvm-3.7.1-llvm-config-3.patch
new file mode 100644
index 0000000..7a1547e
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.7.1-llvm-config-3.patch
@@ -0,0 +1,29 @@
+From 9308d1858852bdc6f099025ca0482d7b3a32a9aa Mon Sep 17 00:00:00 2001
+From: NAKAMURA Takumi <geek4civic@gmail.com>
+Date: Wed, 10 Feb 2016 01:12:55 +0000
+Subject: [PATCH 4/4] llvm-config: Quick fix for cross compilation. Don't be
+ confsed between host and target. It has been there since r252532.
+
+FIXME: The clause may use conditions of host compiler, not HOST_TRIPLE.
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260343 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ tools/llvm-config/llvm-config.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 315e5e1..346c9d9 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -327,7 +327,7 @@ int main(int argc, char **argv) {
+ 
+   StringRef SharedExt, SharedVersionedExt, SharedDir, SharedPrefix, StaticExt,
+     StaticPrefix, StaticDir = "lib";
+-  const Triple HostTriple(Triple::normalize(LLVM_DEFAULT_TARGET_TRIPLE));
++  const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE));
+   if (HostTriple.isOSWindows()) {
+     SharedExt = "dll";
+     SharedVersionedExt = PACKAGE_VERSION ".dll";
+-- 
+2.7.4
+

diff --git a/sys-devel/llvm/llvm-3.7.1-r1.ebuild b/sys-devel/llvm/llvm-3.7.1-r1.ebuild
new file mode 100644
index 0000000..5ae3bc6
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.7.1-r1.ebuild
@@ -0,0 +1,559 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+PYTHON_COMPAT=( python2_7 )
+
+inherit check-reqs cmake-utils eutils flag-o-matic multilib \
+	multilib-minimal python-single-r1 toolchain-funcs pax-utils 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 )
+	lldb? ( http://llvm.org/releases/${PV}/lldb-${PV}.src.tar.xz )
+	!doc? ( http://dev.gentoo.org/~voyageur/distfiles/${PN}-3.7.0-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 kernel_FreeBSD"
+
+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-4.00.0:0=
+		dev-ml/findlib
+		dev-ml/ocaml-ctypes
+		!!<=sys-devel/llvm-3.7.0-r1[ocaml] )"
+# 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-${PV%_rc*}.9999 )
+	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 xml )"
+
+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/${PN}-3.7.0-ocaml-multilib.patch
+	# Do not build/install ocaml docs with USE=-doc, bug #562008
+	epatch "${FILESDIR}"/cmake/${PN}-3.7.0-ocaml-build_doc.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
+
+	# Fix llvm-config for shared linking, sane flags and return values
+	# in order:
+	# - backported r247159 that adds --build-system (needed for later code)
+	# - backported r252532 that adds better shared linking support
+	# - our fixes
+	# - backported r260343 that fixes cross-compilation
+	# combination of backported upstream r252532 with our patch
+	# https://bugs.gentoo.org/show_bug.cgi?id=565358
+	epatch "${FILESDIR}"/llvm-3.7.1-llvm-config-0.patch
+	epatch "${FILESDIR}"/llvm-3.7.1-llvm-config-1.patch
+	epatch "${FILESDIR}"/llvm-3.7.1-llvm-config-2.patch
+	epatch "${FILESDIR}"/llvm-3.7.1-llvm-config-3.patch
+
+	# Fix msan with newer kernels, #569894
+	epatch "${FILESDIR}"/llvm-3.7-msan-fix.patch
+
+	# disable use of SDK on OSX, bug #568758
+	sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || 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
+
+		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
+
+		# Do not force -march flags on arm platforms
+		# https://bugs.gentoo.org/show_bug.cgi?id=562706
+		epatch "${FILESDIR}"/cmake/${PN}-3.7.0-compiler_rt_arm_march_flags.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
+
+		pushd projects/compiler-rt >/dev/null || die
+
+		# Fix msan with newer kernels, compiler-rt part, #569894
+		epatch "${FILESDIR}"/compiler-rt-3.7-msan-fix.patch
+
+		# Fix WX sections, bug #421527
+		find 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
+
+		popd >/dev/null || 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
+
+		# Fix Python paths, bugs #562436 and #562438
+		epatch "${FILESDIR}"/${PN}-3.7-lldb_python.patch
+		sed -e "s/GENTOO_LIBDIR/$(get_libdir)/" \
+			-i tools/lldb/scripts/Python/finishSwigPythonLLDB.py || die
+
+		# Fix build with ncurses[tinfo], #560474
+		# http://llvm.org/viewvc/llvm-project?view=revision&revision=247842
+		epatch "${FILESDIR}"/cmake/${PN}-3.7.0-lldb_tinfo.patch
+	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;BPF;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=(
+		-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 clang; then
+		mycmakeargs+=(
+			-DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml)
+			# libgomp support fails to find headers without explicit -I
+			# furthermore, it provides only syntax checking
+			-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
+		)
+	fi
+
+	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
+
+	# Remove unnecessary headers on FreeBSD, bug #417171
+	if use kernel_FreeBSD && use clang; then
+		rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h || die
+	fi
+}
+
+multilib_src_install() {
+	cmake-utils_src_install
+
+	if multilib_is_native_abi; then
+		# Install man pages.
+		use doc || doman "${WORKDIR}"/${PN}-3.7.0-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
+
+		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)
+		dobin "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
+
+		popd >/dev/null || die
+
+		python_fix_shebang "${ED}"
+		if use lldb && use python; then
+			python_optimize
+		fi
+	fi
+}
+
+pkg_postinst() {
+	if use clang && ! has_version sys-libs/libomp; then
+		elog "To enable OpenMP support in clang, install sys-libs/libomp."
+	fi
+}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-03-28 21:31 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2016-03-28 21:31 UTC (permalink / raw
  To: gentoo-commits

commit:     3c90ddbcb3f0bbee391074c17bc6ca6ef909bd23
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 28 20:25:17 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 28 21:31:31 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c90ddbc

sys-devel/llvm: Update llvm-config & restore shared libs in 3.8, #578392

 sys-devel/llvm/files/llvm-3.8-llvm-config.patch    | 43 ++++++++++++++--------
 sys-devel/llvm/files/llvm-3.8-soversion.patch      | 28 ++++++++++++++
 .../{llvm-3.8.0.ebuild => llvm-3.8.0-r1.ebuild}    |  6 ++-
 3 files changed, 60 insertions(+), 17 deletions(-)

diff --git a/sys-devel/llvm/files/llvm-3.8-llvm-config.patch b/sys-devel/llvm/files/llvm-3.8-llvm-config.patch
index acc0601..3eace43 100644
--- a/sys-devel/llvm/files/llvm-3.8-llvm-config.patch
+++ b/sys-devel/llvm/files/llvm-3.8-llvm-config.patch
@@ -1,6 +1,6 @@
-From cc0ac62d1c03206bc3a1edba4d60f97921b854f5 Mon Sep 17 00:00:00 2001
+From 5ed05738769643b7c652f798fa6c3aa30c7f0b2b Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
-Date: Fri, 4 Dec 2015 20:45:33 +0100
+Date: Wed, 2 Dec 2015 16:04:56 +0100
 Subject: [PATCH] llvm-config: Clean up exported values, update for shared
  linking
 
@@ -8,32 +8,34 @@ Gentoo-specific fixup for llvm-config, including:
 - wiping build-specific CFLAGS, CXXFLAGS,
 - updating library suffixes for shared libs,
 - wiping --system-libs for shared linking,
-- banning --obj-root and --src-root due to no sources installed.
+- banning --obj-root and --src-root due to no sources installed,
+- making --build-mode return "Release" rather than "Gentoo".
 
 Thanks to Steven Newbury for the initial patch.
 
 Bug: https://bugs.gentoo.org/565358
 Bug: https://bugs.gentoo.org/501684
 ---
- tools/llvm-config/CMakeLists.txt   |  9 +++++++--
- tools/llvm-config/llvm-config.cpp  | 17 +++++++++++++----
- utils/llvm-build/llvmbuild/main.py |  5 ++++-
- 3 files changed, 24 insertions(+), 7 deletions(-)
+ tools/llvm-config/CMakeLists.txt   | 11 ++++++++---
+ tools/llvm-config/llvm-config.cpp  | 20 +++++++++++++++-----
+ utils/llvm-build/llvmbuild/main.py |  4 +++-
+ 3 files changed, 26 insertions(+), 9 deletions(-)
 
 diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
-index 83794bb..21fd845 100644
+index 83794bb..eba6f45 100644
 --- a/tools/llvm-config/CMakeLists.txt
 +++ b/tools/llvm-config/CMakeLists.txt
 @@ -22,15 +22,20 @@ get_property(COMPILE_FLAGS TARGET llvm-config PROPERTY COMPILE_FLAGS)
  set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR})
  set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
  set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
 +# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler
 +# specific flags will be set when we don't know what compiler will be used
 +# with external project utilising llvm-config.  C++ Standard is required.
 +# TODO: figure out if we can remove -std=c++11 and move it to revdeps.
- set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
--set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
++set(LLVM_CFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
 +set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
  set(LLVM_BUILD_SYSTEM cmake)
  set(LLVM_HAS_RTTI ${LLVM_CONFIG_HAS_RTTI})
@@ -48,10 +50,20 @@ index 83794bb..21fd845 100644
    set(LLVM_ENABLE_SHARED ON)
  else()
 diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 80f6279..b16b9a3 100644
+index 80f6279..5c65c57 100644
 --- a/tools/llvm-config/llvm-config.cpp
 +++ b/tools/llvm-config/llvm-config.cpp
-@@ -497,10 +497,19 @@ int main(int argc, char **argv) {
+@@ -484,7 +484,8 @@ int main(int argc, char **argv) {
+       } else if (Arg == "--host-target") {
+         OS << Triple::normalize(LLVM_DEFAULT_TARGET_TRIPLE) << '\n';
+       } else if (Arg == "--build-mode") {
+-        OS << build_mode << '\n';
++        // force Release since we force non-standard Gentoo build mode
++        OS << "Release" << '\n';
+       } else if (Arg == "--assertion-mode") {
+ #if defined(NDEBUG)
+         OS << "OFF\n";
+@@ -497,10 +498,19 @@ int main(int argc, char **argv) {
          OS << LLVM_HAS_RTTI << '\n';
        } else if (Arg == "--shared-mode") {
          PrintSharedMode = true;
@@ -76,7 +88,7 @@ index 80f6279..b16b9a3 100644
          usage();
        }
 diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
-index f2472f6..a29fc83 100644
+index f2472f6..c89c77a 100644
 --- a/utils/llvm-build/llvmbuild/main.py
 +++ b/utils/llvm-build/llvmbuild/main.py
 @@ -393,6 +393,8 @@ subdirectories = %s
@@ -88,16 +100,15 @@ index f2472f6..a29fc83 100644
  """)
          f.write('struct AvailableComponent {\n')
          f.write('  /// The name of the component.\n')
-@@ -413,7 +415,8 @@ subdirectories = %s
+@@ -413,7 +415,7 @@ subdirectories = %s
              if library_name is None:
                  library_name_as_cstr = 'nullptr'
              else:
 -                library_name_as_cstr = '"lib%s.a"' % library_name
 +                library_name_as_cstr = '"lib%s" LTDL_SHLIB_EXT' % library_name
-+
              if is_installed:
                  is_installed_as_cstr = 'true'
              else:
 -- 
-2.6.3
+2.7.4
 

diff --git a/sys-devel/llvm/files/llvm-3.8-soversion.patch b/sys-devel/llvm/files/llvm-3.8-soversion.patch
new file mode 100644
index 0000000..1a30643
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.8-soversion.patch
@@ -0,0 +1,28 @@
+From 3da7d5f7f928aa2aa5e7436b27908bb7e7eb3cc1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 28 Mar 2016 22:21:19 +0200
+Subject: [PATCH] cmake: Restore SOVERSIONs on shared libraries
+
+---
+ cmake/modules/AddLLVM.cmake | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index a829751..a7e0688 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -436,6 +436,11 @@ function(llvm_add_library name)
+         PREFIX ""
+         )
+     endif()
++
++    set_target_properties(${name}
++      PROPERTIES
++      SOVERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}
++      VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
+   endif()
+ 
+   if(ARG_MODULE OR ARG_SHARED)
+-- 
+2.7.4
+

diff --git a/sys-devel/llvm/llvm-3.8.0.ebuild b/sys-devel/llvm/llvm-3.8.0-r1.ebuild
similarity index 98%
rename from sys-devel/llvm/llvm-3.8.0.ebuild
rename to sys-devel/llvm/llvm-3.8.0-r1.ebuild
index f8e26f5..41f1d79 100644
--- a/sys-devel/llvm/llvm-3.8.0.ebuild
+++ b/sys-devel/llvm/llvm-3.8.0-r1.ebuild
@@ -175,6 +175,10 @@ src_prepare() {
 	# https://bugs.gentoo.org/show_bug.cgi?id=565358
 	epatch "${FILESDIR}"/llvm-3.8-llvm-config.patch
 
+	# Restore SOVERSIONs for shared libraries
+	# https://bugs.gentoo.org/show_bug.cgi?id=578392
+	epatch "${FILESDIR}"/llvm-3.8-soversion.patch
+
 	# disable use of SDK on OSX, bug #568758
 	sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
 
@@ -249,7 +253,7 @@ multilib_src_configure() {
 	local mycmakeargs=(
 		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
 
-		-DLLVM_LINK_LLVM_DYLIB=ON
+		-DBUILD_SHARED_LIBS=ON
 		-DLLVM_ENABLE_TIMESTAMPS=OFF
 		-DLLVM_TARGETS_TO_BUILD="${targets}"
 		-DLLVM_BUILD_TESTS=$(usex test)


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-07-03  7:17 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2016-07-03  7:17 UTC (permalink / raw
  To: gentoo-commits

commit:     bcee044c4c0e9f12b663f8886f181a7d46acea66
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  3 06:50:42 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul  3 07:17:44 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcee044c

sys-devel/llvm: Fix static analyzer -isystem support, #586168

 .../llvm/files/clang-3.7.1-ccc-analyzer-isystem.patch  | 18 ++++++++++++++++++
 sys-devel/llvm/llvm-3.7.1-r3.ebuild                    |  3 +++
 2 files changed, 21 insertions(+)

diff --git a/sys-devel/llvm/files/clang-3.7.1-ccc-analyzer-isystem.patch b/sys-devel/llvm/files/clang-3.7.1-ccc-analyzer-isystem.patch
new file mode 100644
index 0000000..78ca922
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.7.1-ccc-analyzer-isystem.patch
@@ -0,0 +1,18 @@
+https://bugs.gentoo.org/586168
+
+Index: tools/clang/tools/scan-build/ccc-analyzer
+===================================================================
+--- a/tools/clang/tools/scan-build/ccc-analyzer	(revision 250980)
++++ b/tools/clang/tools/scan-build/ccc-analyzer	(working copy)
+@@ -586,9 +586,9 @@
+   }
+ 
+   # Compile mode flags.
+-  if ($Arg =~ /^-[D,I,U,isystem](.*)$/) {
++  if ($Arg =~ /^-(D|I|U|isystem)(.*)$/) {
+     my $Tmp = $Arg;
+-    if ($1 eq '') {
++    if ($2 eq '') {
+       # FIXME: Check if we are going off the end.
+       ++$i;
+       $Tmp = $Arg . $ARGV[$i];

diff --git a/sys-devel/llvm/llvm-3.7.1-r3.ebuild b/sys-devel/llvm/llvm-3.7.1-r3.ebuild
index d134a06..5f6e184 100644
--- a/sys-devel/llvm/llvm-3.7.1-r3.ebuild
+++ b/sys-devel/llvm/llvm-3.7.1-r3.ebuild
@@ -189,6 +189,9 @@ src_prepare() {
 		eapply "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch
 		eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
 
+		# Fix -isystem support in ccc-analyzer
+		eapply "${FILESDIR}"/clang-3.7.1-ccc-analyzer-isystem.patch
+
 		sed -i -e "s^@EPREFIX@^${EPREFIX}^" \
 			tools/clang/tools/scan-build/scan-build || die
 


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

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-07-05 19:04 Michał Górny
  0 siblings, 0 replies; 11+ messages in thread
From: Michał Górny @ 2016-07-05 19:04 UTC (permalink / raw
  To: gentoo-commits

commit:     d77c5d128cd577ccc618b0ba2b3317a519405526
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  4 20:33:59 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul  5 19:04:35 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d77c5d12

sys-devel/llvm: Drop 3.4.2

 sys-devel/llvm/Manifest                            |   5 -
 ...clang-3.1-gentoo-runtime-gcc-detection-v3.patch |  29 --
 .../llvm/files/clang-3.4-darwin_build_fix.patch    |  47 --
 .../llvm/files/clang-3.4-gentoo-install.patch      |  80 ---
 .../llvm/files/llvm-3.3-cmake-modulepath.patch     |  24 -
 .../llvm/files/llvm-3.4-cmake-configparser.patch   |  35 --
 sys-devel/llvm/files/llvm-3.4-gentoo-install.patch |  96 ----
 sys-devel/llvm/llvm-3.4.2.ebuild                   | 571 ---------------------
 sys-devel/llvm/metadata.xml                        |   2 -
 9 files changed, 889 deletions(-)

diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
index be88838..b21128e 100644
--- a/sys-devel/llvm/Manifest
+++ b/sys-devel/llvm/Manifest
@@ -1,16 +1,13 @@
-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.2.src.tar.xz 8268008 SHA256 4feb575f74fb3a74b6245400460230141bf610f235ef3a25008cfe6137828620 SHA512 2ad9a7daa8e62cdbf47b001aa6b937a06ae7e6396dcd1832797e2d98036522443ccfca9f1253e16d531a99d1edf237fcd2b457c55491ff68ca4534a2396ca52f WHIRLPOOL 51789ba2a3193d404b26d26b999fc47f1bc4b56b45048078cc51e4ff5c31d834d360ee0c2d16096c060f85acab6de9055dc375569348ae3307e4b280406f2d9e
 DIST cfe-3.6.2.src.tar.xz 8617576 SHA256 ae9180466a23acb426d12444d866b266ff2289b266064d362462e44f8d4699f3 SHA512 ed837c48f38d8998efd675b56477c8681dcedfcf3f71bba65930f145501289bebb6fe6a6d9de336548f94c381d016b99f10c58e046b885449755d44ac782de03 WHIRLPOOL a17419cea329999c8662c0008dbd0391ed5f52045d0175488979e7620f6a9a21b08e451a5e21d3bf944597bb37934a8228fa89c09d773882359822d59bd447a8
 DIST cfe-3.7.1.src.tar.xz 9110616 SHA256 56e2164c7c2a1772d5ed2a3e57485ff73ff06c97dff12edbeea1acc4412b0674 SHA512 8e3285a32ad0fd4721fa77c4fb9709f31bb4e4f7cb5245357aaf57b0767b6ef18a30d902b59d1437a6febffb6c2128214f9ce5aa913bb298743221a28c4f9de5 WHIRLPOOL ce300f5023bddda59ee055e4dccdca8bf459fae5d4e91c44262d2830c406b798d697d1bf3c6326ff41b969a8439f94a3c83570f1d0151a7f0223eb0d8f324f7b
 DIST cfe-3.8.0.src.tar.xz 9627228 SHA256 04149236de03cf05232d68eb7cb9c50f03062e339b68f4f8a03b650a11536cf9 SHA512 fef431d63f95a394d53e3857fb6a6bde7a7b27f40ef5111b4353bcb63ac26febec8a9eb84780187c49699ab099834f13f996f085d02c365676b3fa5bbcc03dcd WHIRLPOOL 10fd94f75f645318ed3436454ccffd570a88cafe35e870563b5f4d89c37b9bdbe282d8793301ca53db6774cc223b2ff7ab0af99293413cac3deefcf5150fcca3
-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.2.src.tar.xz 215804 SHA256 f21a374d74b194d8c984546266491b518859b5f12ed9abd49337b8060d3fc004 SHA512 6a8e662d2704147296c13626fbc5885911c646c67404f12eacc67ee2995221445bf4f6122b271b9cb3a56b716f550a651024822f72358d400b9052bf50423669 WHIRLPOOL 088d2725a88a439a1a2c4048e0eaf540587078078bd1c9823a4804200265cab4d32606abf5e72be76da45ea4aa6e7a7201a2bdbddc78d5f9e0024b0d7b59e222
 DIST clang-tools-extra-3.6.2.src.tar.xz 248624 SHA256 6a0ec627d398f501ddf347060f7a2ccea4802b2494f1d4fd7bda3e0442d04feb SHA512 1b7710a7deee30cefb6a3b4edb026a96d8935a0c6f3056ccdb7a45564d10baf01a4f6722ae853ad9a3bad17e8de32a3c0ec99c5cf6144647a5e182809d403f7a WHIRLPOOL 3dc8888c302bac84f53b673784dec092a2c59ea2985d9983e87f057b9aa7b5d3e34cf13d2b0f1f60ea44f342b8167377204a510036872a087037cf02335c19cd
 DIST clang-tools-extra-3.7.1.src.tar.xz 277476 SHA256 4a91edaccad1ce984c7c49a4a87db186b7f7b21267b2b03bcf4bd7820715bc6b SHA512 06e2db8af75f1e6ee82da6ee723b5256b9e3f6ba196428f18944ec02d07df26d04329ca8824a083c5f25274ce7e3469aa75e3a29ccfbdb6375524841d65e3ad7 WHIRLPOOL 2c1a459d6aff6bc24d5c8d38120ab665adbef61394050781a9707d50e83dae1b4997ed19459086e9bd7f6dd38a09c295d135e33515c947d64a7f1ab714ad8beb
 DIST clang-tools-extra-3.8.0.src.tar.xz 334072 SHA256 afbda810106a6e64444bc164b921be928af46829117c95b996f2678ce4cb1ec4 SHA512 f0e593a76df5485f403079bd2fbb4e51c3d1c3fc4e63e2c2910894e8f2a7c14b47265435f3c52f035fb3fe2f595812d0f9869235296157a39c071a23e6a8b178 WHIRLPOOL 4928669a3c019eebe0a98ee72e25ef70ddf3c1d29e6a4aa18e408276b2a870069460c39e0e8fbe960d8d56127bb6951433d1fd89015d192951004e527b065ec9
-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.2.src.tar.xz 1093000 SHA256 542d7aadd21e7fe35bea0a7912bc965f08a1a566746cebcca76f96dcfeb74dc3 SHA512 319a8a1dbe07eb4f1fcccfe79a1fa445f348fb854a441500e89fa0a128e45716b65d06347f19a63de32e9294cd2331e914ae0d5fe8224f0b2452c39b79ac96ff WHIRLPOOL 6e9286c56a60a515006c8232ca01622ae844185a5f31fb49bce632868862c5e560619f1c45da66878b5322a764f91a284cd296e9f13105d6f74e055a17321d93
 DIST compiler-rt-3.6.2.src.tar.xz 1128080 SHA256 0f2ff37d80a64575fecd8cf0d5c50f7ac1f837ddf700d1855412bb7547431d87 SHA512 7dafcc5bd4822475de649d8a84ae51af3c4ed4d0958f76b1b55ba79219638f3e78eb94a1986c6e9ba0e7f1ccf3ec834d546b5ca60e8b08083fea5880ecdf17a3 WHIRLPOOL dd77e7df43c9028a6873ed903da67560fdb04968013016a7f0ad2d2e9a81b3a3d890b95e4f49a6bdef349806d6507defcd80a0a9fb50c1c9f778e7eff42dbc5d
@@ -18,8 +15,6 @@ DIST compiler-rt-3.7.1.src.tar.xz 1181772 SHA256 9d4769e4a927d3824bcb7a9c82b01e3
 DIST compiler-rt-3.8.0.src.tar.xz 1270128 SHA256 c8d3387e55f229543dac1941769120f24dc50183150bf19d1b070d53d29d56b0 SHA512 21ba548b6b35a79aa291adba7f83db14c33855fa3cf376f2ad75bd22bb454501b74f0ea4f71bc03a864135862c800b101d3cd790e54e687c2a3459c64218b9c3 WHIRLPOOL 63ceb498fbc4083afda4f4aa12e44b8a6d2b58408edacd7d578d3cd6a63f0c1074e453b950fae4fee51690b3f79700e7752b6ceb3e6980c88541314993ce71a5
 DIST lldb-3.7.1.src.tar.xz 10650524 SHA256 9a0bc315ef55f44c98cdf92d064df0847f453ed156dd0ef6a87e04f5fd6a0e01 SHA512 d2d3e1052026edd6ef9113ff5362acb4a32cef598098b4031c35e389301130ef2e1bda594f30de4d65c9fdc0beaecdd35afcf36676eb540baad34015aca294d1 WHIRLPOOL bba9c700788f0cf86ac1de51383a223e1c92f724719cdd327d83189cb77714c1e10fb78569aeed3b3c639062a3410bb114f646a271fd0d9e8c9a8e45d090330a
 DIST lldb-3.8.0.src.tar.xz 10929768 SHA256 e3f68f44147df0433e7989bf6ed1c58ff28d7c68b9c47553cb9915f744785a35 SHA512 a491209ae12b0c7d938ebd94362396a50922326ed24ed11f71b1f19b61274a34a92d2bd46857b44081e7fa3e6d0a641d148bd4022f8edf71f80ff2aa7a55ebef WHIRLPOOL c498c22acab867419143745ce0212c70bdfc141dbae19ab53221908eba7961aae6a029cbad01b8409e6fbc187550141ed87f32366dd847ac57754891fbbc4049
-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.2.src.tar.xz 11876128 SHA256 44196156d5749eb4b4224fe471a29cc3984df92570a4a89fa859f7394fc0c575 SHA512 0f6a83cc61a385387e7baf8fb8f0d9f18e3fd00d2d389a3c7e2c3792be7d82ed095506cac52c24e65ae3c1f94456a441d39440feef6125e25ef18447ec9dd406 WHIRLPOOL b41de51907d6d2c2d04a4c498b44f0ed560cc710e6e2d8678f5ef93a9009d140bc7c2406f4b25d5b901fd026689d48edce77a2e435687b489b835156a512e256

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
deleted file mode 100644
index 49f1085..0000000
--- a/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-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.4-darwin_build_fix.patch b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch
deleted file mode 100644
index 113b04b..0000000
--- a/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-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-gentoo-install.patch b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch
deleted file mode 100644
index 0a1d9eb..0000000
--- a/sys-devel/llvm/files/clang-3.4-gentoo-install.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-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/llvm-3.3-cmake-modulepath.patch b/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch
deleted file mode 100644
index 754ae46..0000000
--- a/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- 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.4-cmake-configparser.patch b/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch
deleted file mode 100644
index cda8bdc..0000000
--- a/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-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-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch
deleted file mode 100644
index a2ba7de..0000000
--- a/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-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/llvm-3.4.2.ebuild b/sys-devel/llvm/llvm-3.4.2.ebuild
deleted file mode 100644
index c2ef13a..0000000
--- a/sys-devel/llvm/llvm-3.4.2.ebuild
+++ /dev/null
@@ -1,571 +0,0 @@
-# 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
-
-	# 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/metadata.xml b/sys-devel/llvm/metadata.xml
index 3a671d6..7371a1f 100644
--- a/sys-devel/llvm/metadata.xml
+++ b/sys-devel/llvm/metadata.xml
@@ -20,13 +20,11 @@
    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] 11+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/
@ 2016-08-02 17:24 Matthias Maier
  0 siblings, 0 replies; 11+ messages in thread
From: Matthias Maier @ 2016-08-02 17:24 UTC (permalink / raw
  To: gentoo-commits

commit:     6ccd97198cc1d33b13c6aa69e73ea06b69bf59d5
Author:     Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  2 15:19:35 2016 +0000
Commit:     Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Tue Aug  2 17:24:23 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ccd9719

sys-devel/llvm: Backport abi-tag support, bug #571600

This applies the abi-tag support patches to 3.8.1-r1.

Unfortunately, gcc-5* and gcc-6* have slightly ABI incompatible
implementations of the abi-tag feature (basically a bugfix in gcc-6*) [1].
The patchset for clang implements the gcc-6* version and is thus not fully
compatible with gcc-5*.

[1] https://llvm.org/bugs/show_bug.cgi?id=28511

Package-Manager: portage-2.2.28

 .../files/clang-3.8-abi-tag-support-mangler.patch  | 1230 ++++++++++++++++++++
 .../files/clang-3.8-abi-tag-support-sema.patch     |  419 +++++++
 sys-devel/llvm/llvm-3.8.1-r1.ebuild                |    4 +
 3 files changed, 1653 insertions(+)

diff --git a/sys-devel/llvm/files/clang-3.8-abi-tag-support-mangler.patch b/sys-devel/llvm/files/clang-3.8-abi-tag-support-mangler.patch
new file mode 100644
index 0000000..d259757
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.8-abi-tag-support-mangler.patch
@@ -0,0 +1,1230 @@
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/lib/AST/ItaniumMangle.cpp llvm-3.8.0.src/tools/clang/lib/AST/ItaniumMangle.cpp
+--- llvm-3.8.0.src.orig/tools/clang/lib/AST/ItaniumMangle.cpp	2016-01-09 13:53:17.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/lib/AST/ItaniumMangle.cpp	2016-07-10 23:59:08.412719561 +0200
+@@ -212,6 +212,12 @@
+ class CXXNameMangler {
+   ItaniumMangleContextImpl &Context;
+   raw_ostream &Out;
++  bool NullOut = false;
++  /// In the "DisableDerivedAbiTags" mode derived ABI tags are not calculated.
++  /// This mode is used when mangler creates another mangler recursively to
++  /// calculate ABI tags for the function return value or the variable type.
++  /// Also it is required to avoid infinite recursion in some cases.
++  bool DisableDerivedAbiTags = false;
+ 
+   /// The "structor" is the top-level declaration being mangled, if
+   /// that's not a template specialization; otherwise it's the pattern
+@@ -261,15 +267,131 @@
+ 
+   } FunctionTypeDepth;
+ 
++  // abi_tag is a gcc attribute, taking one or more strings called "tags".
++  // The goal is to annotate against which version of a library an object was
++  // built and to be able to provide backwards compatibility ("dual abi").
++  // For more information see docs/ItaniumMangleAbiTags.rst.
++  typedef SmallVector<StringRef, 4> AbiTagList;
++  typedef llvm::SmallSetVector<StringRef, 4> AbiTagSet;
++
++  // State to gather all implicit and explicit tags used in a mangled name.
++  // Must always have an instance of this while emitting any name to keep
++  // track.
++  class AbiTagState final {
++    //! All abi tags used implicitly or explicitly
++    AbiTagSet UsedAbiTags;
++    //! All explicit abi tags (i.e. not from namespace)
++    AbiTagSet EmittedAbiTags;
++
++    AbiTagState *&LinkHead;
++    AbiTagState *Parent = nullptr;
++
++    bool LinkActive = false;
++
++  public:
++    explicit AbiTagState(AbiTagState *&Head) : LinkHead(Head) {
++      Parent = LinkHead;
++      LinkHead = this;
++      LinkActive = true;
++    }
++
++    // no copy, no move
++    AbiTagState(const AbiTagState &) = delete;
++    AbiTagState &operator=(const AbiTagState &) = delete;
++
++    ~AbiTagState() { pop(); }
++
++    void pop() {
++      if (!LinkActive)
++        return;
++
++      assert(LinkHead == this &&
++             "abi tag link head must point to us on destruction");
++      LinkActive = false;
++      if (Parent) {
++        Parent->UsedAbiTags.insert(UsedAbiTags.begin(), UsedAbiTags.end());
++        Parent->EmittedAbiTags.insert(EmittedAbiTags.begin(),
++                                      EmittedAbiTags.end());
++      }
++      LinkHead = Parent;
++    }
++
++    void write(raw_ostream &Out, const NamedDecl *ND,
++               const AbiTagList *AdditionalAbiTags) {
++      ND = cast<NamedDecl>(ND->getCanonicalDecl());
++
++      if (!isa<FunctionDecl>(ND) && !isa<VarDecl>(ND)) {
++        assert(
++            !AdditionalAbiTags &&
++            "only function and variables need a list of additional abi tags");
++        if (const auto *NS = dyn_cast<NamespaceDecl>(ND)) {
++          if (const auto *AbiTag = NS->getAttr<AbiTagAttr>()) {
++            for (const auto &Tag : AbiTag->tags()) {
++              UsedAbiTags.insert(Tag);
++            }
++          }
++          // Don't emit abi tags for namespaces.
++          return;
++        }
++      }
++
++      AbiTagList TagList;
++      if (const auto *AbiTag = ND->getAttr<AbiTagAttr>()) {
++        for (const auto &Tag : AbiTag->tags()) {
++          UsedAbiTags.insert(Tag);
++          // AbiTag->tags() is sorted and has no duplicates
++          TagList.push_back(Tag);
++        }
++      }
++
++      if (AdditionalAbiTags) {
++        for (const auto &Tag : *AdditionalAbiTags) {
++          UsedAbiTags.insert(Tag);
++          if (std::find(TagList.begin(), TagList.end(), Tag) == TagList.end()) {
++            // don't insert duplicates
++            TagList.push_back(Tag);
++          }
++        }
++        // AbiTag->tags() are already sorted; only add if we had additional tags
++        std::sort(TagList.begin(), TagList.end());
++      }
++
++      writeSortedUniqueAbiTags(Out, TagList);
++    }
++
++    const AbiTagSet &getUsedAbiTags() const { return UsedAbiTags; }
++    void setUsedAbiTags(const AbiTagSet &AbiTags) {
++      UsedAbiTags = AbiTags;
++    }
++
++    const AbiTagSet &getEmittedAbiTags() const {
++      return EmittedAbiTags;
++    }
++
++  private:
++    template <typename TagList>
++    void writeSortedUniqueAbiTags(raw_ostream &Out, TagList const &AbiTags) {
++      for (const auto &Tag : AbiTags) {
++        EmittedAbiTags.insert(Tag);
++        Out << "B";
++        Out << Tag.size();
++        Out << Tag;
++      }
++    }
++  };
++
++  AbiTagState *AbiTags = nullptr;
++  AbiTagState AbiTagsRoot;
++
+   llvm::DenseMap<uintptr_t, unsigned> Substitutions;
+ 
+   ASTContext &getASTContext() const { return Context.getASTContext(); }
+ 
+ public:
+   CXXNameMangler(ItaniumMangleContextImpl &C, raw_ostream &Out_,
+-                 const NamedDecl *D = nullptr)
+-    : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(0),
+-      SeqID(0) {
++                 const NamedDecl *D = nullptr, bool NullOut_ = false)
++    : Context(C), Out(Out_), NullOut(NullOut_),  Structor(getStructor(D)),
++      StructorType(0), SeqID(0), AbiTagsRoot(AbiTags) {
+     // These can't be mangled without a ctor type or dtor type.
+     assert(!D || (!isa<CXXDestructorDecl>(D) &&
+                   !isa<CXXConstructorDecl>(D)));
+@@ -277,11 +399,16 @@
+   CXXNameMangler(ItaniumMangleContextImpl &C, raw_ostream &Out_,
+                  const CXXConstructorDecl *D, CXXCtorType Type)
+     : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(Type),
+-      SeqID(0) { }
++      SeqID(0), AbiTagsRoot(AbiTags) { }
+   CXXNameMangler(ItaniumMangleContextImpl &C, raw_ostream &Out_,
+                  const CXXDestructorDecl *D, CXXDtorType Type)
+     : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(Type),
+-      SeqID(0) { }
++      SeqID(0), AbiTagsRoot(AbiTags) { }
++
++  CXXNameMangler(CXXNameMangler &Outer, llvm::raw_null_ostream &Out_)
++      : Context(Outer.Context), Out(Out_), NullOut(true),
++        Structor(Outer.Structor), StructorType(Outer.StructorType),
++        SeqID(Outer.SeqID), AbiTagsRoot(AbiTags) {}
+ 
+ #if MANGLE_CHECKER
+   ~CXXNameMangler() {
+@@ -296,14 +423,18 @@
+ #endif
+   raw_ostream &getStream() { return Out; }
+ 
++  void disableDerivedAbiTags() { DisableDerivedAbiTags = true; }
++  static bool shouldHaveAbiTags(ItaniumMangleContextImpl &C, const VarDecl *VD);
++
+   void mangle(const NamedDecl *D);
+   void mangleCallOffset(int64_t NonVirtual, int64_t Virtual);
+   void mangleNumber(const llvm::APSInt &I);
+   void mangleNumber(int64_t Number);
+   void mangleFloat(const llvm::APFloat &F);
+-  void mangleFunctionEncoding(const FunctionDecl *FD);
++  void mangleFunctionEncoding(const FunctionDecl *FD,
++                              bool ExcludeUnqualifiedName = false);
+   void mangleSeqID(unsigned SeqID);
+-  void mangleName(const NamedDecl *ND);
++  void mangleName(const NamedDecl *ND, bool ExcludeUnqualifiedName = false);
+   void mangleType(QualType T);
+   void mangleNameOrStandardSubstitution(const NamedDecl *ND);
+   
+@@ -334,31 +465,53 @@
+                             DeclarationName name,
+                             unsigned KnownArity = UnknownArity);
+ 
+-  void mangleName(const TemplateDecl *TD,
+-                  const TemplateArgument *TemplateArgs,
+-                  unsigned NumTemplateArgs);
+-  void mangleUnqualifiedName(const NamedDecl *ND) {
+-    mangleUnqualifiedName(ND, ND->getDeclName(), UnknownArity);
++  void mangleFunctionEncodingBareType(const FunctionDecl *FD);
++
++  void mangleNameWithAbiTags(const NamedDecl *ND,
++                             const AbiTagList *AdditionalAbiTags,
++                             bool ExcludeUnqualifiedName);
++  void mangleTemplateName(const TemplateDecl *TD,
++                          const AbiTagList *AdditionalAbiTags,
++                          bool ExcludeUnqualifiedName,
++                          const TemplateArgument *TemplateArgs,
++                          unsigned NumTemplateArgs);
++  void mangleUnqualifiedName(const NamedDecl *ND,
++                             const AbiTagList *AdditionalAbiTags) {
++    mangleUnqualifiedName(ND, ND->getDeclName(), UnknownArity,
++                          AdditionalAbiTags);
+   }
+   void mangleUnqualifiedName(const NamedDecl *ND, DeclarationName Name,
+-                             unsigned KnownArity);
+-  void mangleUnscopedName(const NamedDecl *ND);
+-  void mangleUnscopedTemplateName(const TemplateDecl *ND);
+-  void mangleUnscopedTemplateName(TemplateName);
++                             unsigned KnownArity,
++                             const AbiTagList *AdditionalAbiTags);
++  void mangleUnscopedName(const NamedDecl *ND,
++                          const AbiTagList *AdditionalAbiTags);
++  void mangleUnscopedTemplateName(const TemplateDecl *ND,
++                                  const AbiTagList *AdditionalAbiTags);
++  void mangleUnscopedTemplateName(TemplateName,
++                                  const AbiTagList *AdditionalAbiTags);
+   void mangleSourceName(const IdentifierInfo *II);
+-  void mangleLocalName(const Decl *D);
++  void mangleLocalName(const Decl *D,
++                       const AbiTagList *AdditionalAbiTags,
++                       bool ExcludeUnqualifiedName);
+   void mangleBlockForPrefix(const BlockDecl *Block);
+   void mangleUnqualifiedBlock(const BlockDecl *Block);
+   void mangleLambda(const CXXRecordDecl *Lambda);
+   void mangleNestedName(const NamedDecl *ND, const DeclContext *DC,
+-                        bool NoFunction=false);
++                        const AbiTagList *AdditionalAbiTags,
++                        bool NoFunction,
++                        bool ExcludeUnqualifiedName);
+   void mangleNestedName(const TemplateDecl *TD,
++                        const AbiTagList *AdditionalAbiTags,
++                        bool ExcludeUnqualifiedName,
+                         const TemplateArgument *TemplateArgs,
+                         unsigned NumTemplateArgs);
+   void manglePrefix(NestedNameSpecifier *qualifier);
+   void manglePrefix(const DeclContext *DC, bool NoFunction=false);
+   void manglePrefix(QualType type);
+-  void mangleTemplatePrefix(const TemplateDecl *ND, bool NoFunction=false);
++  void mangleTemplatePrefix(const TemplateDecl *ND,
++                            const AbiTagList *AdditionalAbiTags,
++                            bool NoFunction = false,
++                            bool ExcludeUnqualifiedName = false);
+   void mangleTemplatePrefix(TemplateName Template);
+   bool mangleUnresolvedTypeOrSimpleId(QualType DestroyedType,
+                                       StringRef Prefix = "");
+@@ -405,6 +558,13 @@
+   void mangleTemplateParameter(unsigned Index);
+ 
+   void mangleFunctionParam(const ParmVarDecl *parm);
++
++  void writeAbiTags(const NamedDecl *ND,
++                    const AbiTagList *AdditionalAbiTags = nullptr);
++
++  AbiTagSet getTagsFromPrefixAndTemplateArguments(const NamedDecl *ND);
++  AbiTagList makeAdditionalTagsForFunction(const FunctionDecl *FD);
++  AbiTagList makeAdditionalTagsForVariable(const VarDecl *VD);
+ };
+ 
+ }
+@@ -448,6 +608,7 @@
+       while (!DC->isNamespace() && !DC->isTranslationUnit())
+         DC = getEffectiveParentContext(DC);
+     if (DC->isTranslationUnit() && D->getFormalLinkage() != InternalLinkage &&
++        !CXXNameMangler::shouldHaveAbiTags(*this, VD) &&
+         !isa<VarTemplateSpecializationDecl>(D))
+       return false;
+   }
+@@ -455,6 +616,12 @@
+   return true;
+ }
+ 
++void CXXNameMangler::writeAbiTags(const NamedDecl *ND,
++                                  const AbiTagList *AdditionalAbiTags) {
++  assert(AbiTags && "require AbiTagState");
++  AbiTags->write(Out, ND, DisableDerivedAbiTags ? nullptr : AdditionalAbiTags);
++}
++
+ void CXXNameMangler::mangle(const NamedDecl *D) {
+   // <mangled-name> ::= _Z <encoding>
+   //            ::= <data name>
+@@ -470,14 +637,31 @@
+     mangleName(cast<FieldDecl>(D));
+ }
+ 
+-void CXXNameMangler::mangleFunctionEncoding(const FunctionDecl *FD) {
+-  // <encoding> ::= <function name> <bare-function-type>
+-  mangleName(FD);
+-
++void CXXNameMangler::mangleFunctionEncoding(const FunctionDecl *FD,
++                                            bool ExcludeUnqualifiedName) {
+   // Don't mangle in the type if this isn't a decl we should typically mangle.
+-  if (!Context.shouldMangleDeclName(FD))
++  if (!Context.shouldMangleDeclName(FD)) {
++    mangleNameWithAbiTags(FD, /* AdditionalAbiTags */ nullptr,
++                          ExcludeUnqualifiedName);
+     return;
++  }
++
++  // <encoding> ::= <function name> <bare-function-type>
++
++  if (ExcludeUnqualifiedName) {
++    // running makeAdditionalTagsForFunction would loop, don't need it here
++    // anyway
++    mangleNameWithAbiTags(FD, /* AdditionalAbiTags */ nullptr,
++                          ExcludeUnqualifiedName);
++  } else {
++    AbiTagList AdditionalAbiTags = makeAdditionalTagsForFunction(FD);
++    mangleNameWithAbiTags(FD, &AdditionalAbiTags, ExcludeUnqualifiedName);
++  }
+ 
++  mangleFunctionEncodingBareType(FD);
++}
++
++void CXXNameMangler::mangleFunctionEncodingBareType(const FunctionDecl *FD) {
+   if (FD->hasAttr<EnableIfAttr>()) {
+     FunctionTypeDepthState Saved = FunctionTypeDepth.push();
+     Out << "Ua9enable_ifI";
+@@ -581,7 +765,24 @@
+   return nullptr;
+ }
+ 
+-void CXXNameMangler::mangleName(const NamedDecl *ND) {
++// Must not be run from mangleLocalName for the <entity name> as it would loop
++// otherwise.
++void CXXNameMangler::mangleName(const NamedDecl *ND,
++                                bool ExcludeUnqualifiedName) {
++  if (!ExcludeUnqualifiedName) {
++    if (const auto *VD = dyn_cast<VarDecl>(ND)) {
++      AbiTagList VariableAdditionalAbiTags = makeAdditionalTagsForVariable(VD);
++      mangleNameWithAbiTags(VD, &VariableAdditionalAbiTags,
++                            ExcludeUnqualifiedName);
++      return;
++    }
++  }
++  mangleNameWithAbiTags(ND, nullptr, ExcludeUnqualifiedName);
++}
++
++void CXXNameMangler::mangleNameWithAbiTags(const NamedDecl *ND,
++                                           const AbiTagList *AdditionalAbiTags,
++                                           bool ExcludeUnqualifiedName) {
+   //  <name> ::= <nested-name>
+   //         ::= <unscoped-name>
+   //         ::= <unscoped-template-name> <template-args>
+@@ -597,7 +798,7 @@
+     while (!DC->isNamespace() && !DC->isTranslationUnit())
+       DC = getEffectiveParentContext(DC);
+   else if (GetLocalClassDecl(ND)) {
+-    mangleLocalName(ND);
++    mangleLocalName(ND, AdditionalAbiTags, ExcludeUnqualifiedName);
+     return;
+   }
+ 
+@@ -607,76 +808,93 @@
+     // Check if we have a template.
+     const TemplateArgumentList *TemplateArgs = nullptr;
+     if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
+-      mangleUnscopedTemplateName(TD);
++      if (!ExcludeUnqualifiedName)
++        mangleUnscopedTemplateName(TD, AdditionalAbiTags);
+       mangleTemplateArgs(*TemplateArgs);
+       return;
+     }
+ 
+-    mangleUnscopedName(ND);
++    if (!ExcludeUnqualifiedName)
++      mangleUnscopedName(ND, AdditionalAbiTags);
+     return;
+   }
+ 
+   if (isLocalContainerContext(DC)) {
+-    mangleLocalName(ND);
++    mangleLocalName(ND, AdditionalAbiTags, ExcludeUnqualifiedName);
+     return;
+   }
+ 
+-  mangleNestedName(ND, DC);
++  mangleNestedName(ND, DC, AdditionalAbiTags, /* NoFunction */ false,
++                   ExcludeUnqualifiedName);
+ }
+-void CXXNameMangler::mangleName(const TemplateDecl *TD,
+-                                const TemplateArgument *TemplateArgs,
+-                                unsigned NumTemplateArgs) {
++
++void CXXNameMangler::mangleTemplateName(const TemplateDecl *TD,
++                                        const AbiTagList *AdditionalAbiTags,
++                                        bool ExcludeUnqualifiedName,
++                                        const TemplateArgument *TemplateArgs,
++                                        unsigned NumTemplateArgs) {
+   const DeclContext *DC = IgnoreLinkageSpecDecls(getEffectiveDeclContext(TD));
+ 
+   if (DC->isTranslationUnit() || isStdNamespace(DC)) {
+-    mangleUnscopedTemplateName(TD);
++    if (!ExcludeUnqualifiedName)
++      mangleUnscopedTemplateName(TD, AdditionalAbiTags);
+     mangleTemplateArgs(TemplateArgs, NumTemplateArgs);
+   } else {
+-    mangleNestedName(TD, TemplateArgs, NumTemplateArgs);
++    mangleNestedName(TD, AdditionalAbiTags, ExcludeUnqualifiedName,
++                     TemplateArgs, NumTemplateArgs);
+   }
+ }
+ 
+-void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND) {
++void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND,
++                                        const AbiTagList *AdditionalAbiTags) {
+   //  <unscoped-name> ::= <unqualified-name>
+   //                  ::= St <unqualified-name>   # ::std::
+ 
+   if (isStdNamespace(IgnoreLinkageSpecDecls(getEffectiveDeclContext(ND))))
+     Out << "St";
+ 
+-  mangleUnqualifiedName(ND);
++  mangleUnqualifiedName(ND, AdditionalAbiTags);
+ }
+ 
+-void CXXNameMangler::mangleUnscopedTemplateName(const TemplateDecl *ND) {
++void CXXNameMangler::mangleUnscopedTemplateName(
++    const TemplateDecl *ND, const AbiTagList *AdditionalAbiTags) {
+   //     <unscoped-template-name> ::= <unscoped-name>
+   //                              ::= <substitution>
+   if (mangleSubstitution(ND))
+     return;
+ 
+   // <template-template-param> ::= <template-param>
+-  if (const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(ND))
++  if (const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(ND)) {
++    assert(!AdditionalAbiTags &&
++           "template template param cannot have abi tags");
+     mangleTemplateParameter(TTP->getIndex());
+-  else
+-    mangleUnscopedName(ND->getTemplatedDecl());
++  } else {
++    mangleUnscopedName(ND->getTemplatedDecl(), AdditionalAbiTags);
++  }
+ 
+   addSubstitution(ND);
+ }
+ 
+-void CXXNameMangler::mangleUnscopedTemplateName(TemplateName Template) {
++void CXXNameMangler::mangleUnscopedTemplateName(
++    TemplateName Template, const AbiTagList *AdditionalAbiTags) {
+   //     <unscoped-template-name> ::= <unscoped-name>
+   //                              ::= <substitution>
+   if (TemplateDecl *TD = Template.getAsTemplateDecl())
+-    return mangleUnscopedTemplateName(TD);
++    return mangleUnscopedTemplateName(TD, AdditionalAbiTags);
+   
+   if (mangleSubstitution(Template))
+     return;
+ 
++  assert(!AdditionalAbiTags &&
++         "dependent template name cannot have abi tags");
++
+   DependentTemplateName *Dependent = Template.getAsDependentTemplateName();
+   assert(Dependent && "Not a dependent template name?");
+   if (const IdentifierInfo *Id = Dependent->getIdentifier())
+     mangleSourceName(Id);
+   else
+     mangleOperatorName(Dependent->getOperator(), UnknownArity);
+-  
++
+   addSubstitution(Template);
+ }
+ 
+@@ -835,6 +1053,7 @@
+     else
+       Out << "sr";
+     mangleSourceName(qualifier->getAsNamespace()->getIdentifier());
++    writeAbiTags(qualifier->getAsNamespace());
+     break;
+   case NestedNameSpecifier::NamespaceAlias:
+     if (qualifier->getPrefix())
+@@ -843,6 +1062,7 @@
+     else
+       Out << "sr";
+     mangleSourceName(qualifier->getAsNamespaceAlias()->getIdentifier());
++    writeAbiTags(qualifier->getAsNamespaceAlias());
+     break;
+ 
+   case NestedNameSpecifier::TypeSpec:
+@@ -877,6 +1097,7 @@
+       Out << "sr";
+ 
+     mangleSourceName(qualifier->getAsIdentifier());
++    // an Identifier has no type information, so we can't emit abi tags for it
+     break;
+   }
+ 
+@@ -922,7 +1143,8 @@
+ 
+ void CXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
+                                            DeclarationName Name,
+-                                           unsigned KnownArity) {
++                                           unsigned KnownArity,
++                                           const AbiTagList *AdditionalAbiTags) {
+   unsigned Arity = KnownArity;
+   //  <unqualified-name> ::= <operator-name>
+   //                     ::= <ctor-dtor-name>
+@@ -941,6 +1163,7 @@
+         Out << 'L';
+ 
+       mangleSourceName(II);
++      writeAbiTags(ND, AdditionalAbiTags);
+       break;
+     }
+ 
+@@ -980,6 +1203,7 @@
+       assert(FD->getIdentifier() && "Data member name isn't an identifier!");
+ 
+       mangleSourceName(FD->getIdentifier());
++      // Not emitting abi tags: internal name anyway
+       break;
+     }
+ 
+@@ -1000,6 +1224,10 @@
+       assert(D->getDeclName().getAsIdentifierInfo() &&
+              "Typedef was not named!");
+       mangleSourceName(D->getDeclName().getAsIdentifierInfo());
++      assert(!AdditionalAbiTags && "Type cannot have additional abi tags");
++      // explicit abi tags are still possible; take from underlying type, not
++      // from typedef.
++      writeAbiTags(TD, nullptr);
+       break;
+     }
+ 
+@@ -1009,6 +1237,8 @@
+     // <lambda-sig> ::= <parameter-type>+   # Parameter types or 'v' for 'void'.
+     if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(TD)) {
+       if (Record->isLambda() && Record->getLambdaManglingNumber()) {
++        assert(!AdditionalAbiTags &&
++               "Lambda type cannot have additional abi tags");
+         mangleLambda(Record);
+         break;
+       }
+@@ -1020,11 +1250,13 @@
+       if (UnnamedMangle > 1)
+         Out << UnnamedMangle - 2;
+       Out << '_';
++      writeAbiTags(TD, AdditionalAbiTags);
+       break;
+     }
+ 
+-    // Get a unique id for the anonymous struct.
+-    unsigned AnonStructId = Context.getAnonymousStructId(TD);
++    // Get a unique id for the anonymous struct. If it is not a real output
++    // ID doesn't matter so use fake one.
++    unsigned AnonStructId = NullOut ? 0 : Context.getAnonymousStructId(TD);
+ 
+     // Mangle it as a source name in the form
+     // [n] $_<id>
+@@ -1052,6 +1284,7 @@
+       // Otherwise, use the complete constructor name. This is relevant if a
+       // class with a constructor is declared within a constructor.
+       mangleCXXCtorType(Ctor_Complete);
++    writeAbiTags(ND, AdditionalAbiTags);
+     break;
+ 
+   case DeclarationName::CXXDestructorName:
+@@ -1063,6 +1296,7 @@
+       // Otherwise, use the complete destructor name. This is relevant if a
+       // class with a destructor is declared within a destructor.
+       mangleCXXDtorType(Dtor_Complete);
++    writeAbiTags(ND, AdditionalAbiTags);
+     break;
+ 
+   case DeclarationName::CXXOperatorName:
+@@ -1078,6 +1312,7 @@
+   case DeclarationName::CXXConversionFunctionName:
+   case DeclarationName::CXXLiteralOperatorName:
+     mangleOperatorName(Name, Arity);
++    writeAbiTags(ND, AdditionalAbiTags);
+     break;
+ 
+   case DeclarationName::CXXUsingDirective:
+@@ -1094,7 +1329,9 @@
+ 
+ void CXXNameMangler::mangleNestedName(const NamedDecl *ND,
+                                       const DeclContext *DC,
+-                                      bool NoFunction) {
++                                      const AbiTagList *AdditionalAbiTags,
++                                      bool NoFunction,
++                                      bool ExcludeUnqualifiedName) {
+   // <nested-name> 
+   //   ::= N [<CV-qualifiers>] [<ref-qualifier>] <prefix> <unqualified-name> E
+   //   ::= N [<CV-qualifiers>] [<ref-qualifier>] <template-prefix> 
+@@ -1114,30 +1351,36 @@
+   // Check if we have a template.
+   const TemplateArgumentList *TemplateArgs = nullptr;
+   if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
+-    mangleTemplatePrefix(TD, NoFunction);
++    mangleTemplatePrefix(TD, AdditionalAbiTags, NoFunction,
++                         ExcludeUnqualifiedName);
+     mangleTemplateArgs(*TemplateArgs);
+   }
+   else {
+     manglePrefix(DC, NoFunction);
+-    mangleUnqualifiedName(ND);
++    if (!ExcludeUnqualifiedName)
++      mangleUnqualifiedName(ND, AdditionalAbiTags);
+   }
+ 
+   Out << 'E';
+ }
+ void CXXNameMangler::mangleNestedName(const TemplateDecl *TD,
++                                      const AbiTagList *AdditionalAbiTags,
++                                      bool ExcludeUnqualifiedName,
+                                       const TemplateArgument *TemplateArgs,
+                                       unsigned NumTemplateArgs) {
+   // <nested-name> ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
+ 
+   Out << 'N';
+ 
+-  mangleTemplatePrefix(TD);
++  mangleTemplatePrefix(TD, AdditionalAbiTags, ExcludeUnqualifiedName);
+   mangleTemplateArgs(TemplateArgs, NumTemplateArgs);
+ 
+   Out << 'E';
+ }
+ 
+-void CXXNameMangler::mangleLocalName(const Decl *D) {
++void CXXNameMangler::mangleLocalName(const Decl *D,
++                                     const AbiTagList *AdditionalAbiTags,
++                                     bool ExcludeUnqualifiedName) {
+   // <local-name> := Z <function encoding> E <entity name> [<discriminator>]
+   //              := Z <function encoding> E s [<discriminator>]
+   // <local-name> := Z <function encoding> E d [ <parameter number> ] 
+@@ -1149,15 +1392,26 @@
+ 
+   Out << 'Z';
+ 
+-  if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(DC))
+-    mangleObjCMethodName(MD);
+-  else if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC))
+-    mangleBlockForPrefix(BD);
+-  else
+-    mangleFunctionEncoding(cast<FunctionDecl>(DC));
++  {
++    AbiTagState LocalAbiTags(AbiTags);
++
++    if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(DC))
++      mangleObjCMethodName(MD);
++    else if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC))
++      mangleBlockForPrefix(BD);
++    else
++      mangleFunctionEncoding(cast<FunctionDecl>(DC));
++
++    // Implicit ABI tags (from namespace) are not available in the following
++    // entity; reset to actually emitted tags, which are available.
++    LocalAbiTags.setUsedAbiTags(LocalAbiTags.getEmittedAbiTags());
++  }
+ 
+   Out << 'E';
+ 
++  // GCC 5.3.0 doesn't emit derived ABI tags for local names but that seems to
++  // be a bug that is fixed in trunk.
++
+   if (RD) {
+     // The parameter number is omitted for the last parameter, 0 for the 
+     // second-to-last parameter, 1 for the third-to-last parameter, etc. The 
+@@ -1182,13 +1436,17 @@
+     // Mangle the name relative to the closest enclosing function.
+     // equality ok because RD derived from ND above
+     if (D == RD)  {
+-      mangleUnqualifiedName(RD);
++      if (!ExcludeUnqualifiedName)
++        mangleUnqualifiedName(RD, AdditionalAbiTags);
+     } else if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
+       manglePrefix(getEffectiveDeclContext(BD), true /*NoFunction*/);
+-      mangleUnqualifiedBlock(BD);
++      assert(!AdditionalAbiTags && "Block cannot have additional abi tags");
++      if (!ExcludeUnqualifiedName)
++        mangleUnqualifiedBlock(BD);
+     } else {
+       const NamedDecl *ND = cast<NamedDecl>(D);
+-      mangleNestedName(ND, getEffectiveDeclContext(ND), true /*NoFunction*/);
++      mangleNestedName(ND, getEffectiveDeclContext(ND), AdditionalAbiTags,
++                       true /*NoFunction*/, ExcludeUnqualifiedName);
+     }
+   } else if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
+     // Mangle a block in a default parameter; see above explanation for
+@@ -1205,30 +1463,37 @@
+       }
+     }
+ 
+-    mangleUnqualifiedBlock(BD);
++    assert(!AdditionalAbiTags && "Block cannot have additional abi tags");
++    if (!ExcludeUnqualifiedName)
++      mangleUnqualifiedBlock(BD);
+   } else {
+-    mangleUnqualifiedName(cast<NamedDecl>(D));
++    if (!ExcludeUnqualifiedName)
++      mangleUnqualifiedName(cast<NamedDecl>(D), AdditionalAbiTags);
+   }
+ 
+-  if (const NamedDecl *ND = dyn_cast<NamedDecl>(RD ? RD : D)) {
+-    unsigned disc;
+-    if (Context.getNextDiscriminator(ND, disc)) {
+-      if (disc < 10)
+-        Out << '_' << disc;
+-      else
+-        Out << "__" << disc << '_';
++  if (!ExcludeUnqualifiedName) {
++    if (const NamedDecl *ND = dyn_cast<NamedDecl>(RD ? RD : D)) {
++      unsigned disc;
++      if (Context.getNextDiscriminator(ND, disc)) {
++        if (disc < 10)
++          Out << '_' << disc;
++        else
++          Out << "__" << disc << '_';
++      }
+     }
+   }
+ }
+ 
+ void CXXNameMangler::mangleBlockForPrefix(const BlockDecl *Block) {
+   if (GetLocalClassDecl(Block)) {
+-    mangleLocalName(Block);
++    mangleLocalName(Block, /* AdditionalAbiTags */ nullptr,
++                    /* ExcludeUnqualifiedName */ false);
+     return;
+   }
+   const DeclContext *DC = getEffectiveDeclContext(Block);
+   if (isLocalContainerContext(DC)) {
+-    mangleLocalName(Block);
++    mangleLocalName(Block, /* AdditionalAbiTags */ nullptr,
++                    /* ExcludeUnqualifiedName */ false);
+     return;
+   }
+   manglePrefix(getEffectiveDeclContext(Block));
+@@ -1239,10 +1504,11 @@
+   if (Decl *Context = Block->getBlockManglingContextDecl()) {
+     if ((isa<VarDecl>(Context) || isa<FieldDecl>(Context)) &&
+         Context->getDeclContext()->isRecord()) {
+-      if (const IdentifierInfo *Name
+-            = cast<NamedDecl>(Context)->getIdentifier()) {
++      const auto *ND = cast<NamedDecl>(Context);
++      if (const IdentifierInfo *Name = ND->getIdentifier()) {
+         mangleSourceName(Name);
+-        Out << 'M';            
++        writeAbiTags(ND, /* AdditionalAbiTags */ nullptr);
++        Out << 'M';
+       }
+     }
+   }
+@@ -1275,7 +1541,7 @@
+       if (const IdentifierInfo *Name
+             = cast<NamedDecl>(Context)->getIdentifier()) {
+         mangleSourceName(Name);
+-        Out << 'M';            
++        Out << 'M';
+       }
+     }
+   }
+@@ -1358,11 +1624,11 @@
+   // Check if we have a template.
+   const TemplateArgumentList *TemplateArgs = nullptr;
+   if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
+-    mangleTemplatePrefix(TD);
++    mangleTemplatePrefix(TD, /* AdditionalAbiTags */ nullptr);
+     mangleTemplateArgs(*TemplateArgs);
+   } else {
+     manglePrefix(getEffectiveDeclContext(ND), NoFunction);
+-    mangleUnqualifiedName(ND);
++    mangleUnqualifiedName(ND, /* AdditionalAbiTags */ nullptr);
+   }
+ 
+   addSubstitution(ND);
+@@ -1373,27 +1639,30 @@
+   //                   ::= <template-param>
+   //                   ::= <substitution>
+   if (TemplateDecl *TD = Template.getAsTemplateDecl())
+-    return mangleTemplatePrefix(TD);
++    return mangleTemplatePrefix(TD, /* AdditionalAbiTags */ nullptr);
+ 
+   if (QualifiedTemplateName *Qualified = Template.getAsQualifiedTemplateName())
+     manglePrefix(Qualified->getQualifier());
+-  
++
+   if (OverloadedTemplateStorage *Overloaded
+                                       = Template.getAsOverloadedTemplate()) {
+     mangleUnqualifiedName(nullptr, (*Overloaded->begin())->getDeclName(),
+-                          UnknownArity);
++                          UnknownArity,
++                          /* AdditionalAbiTags */ nullptr);
+     return;
+   }
+-   
++
+   DependentTemplateName *Dependent = Template.getAsDependentTemplateName();
+   assert(Dependent && "Unknown template name kind?");
+   if (NestedNameSpecifier *Qualifier = Dependent->getQualifier())
+     manglePrefix(Qualifier);
+-  mangleUnscopedTemplateName(Template);
++  mangleUnscopedTemplateName(Template, /* AdditionalAbiTags */ nullptr);
+ }
+ 
+ void CXXNameMangler::mangleTemplatePrefix(const TemplateDecl *ND,
+-                                          bool NoFunction) {
++                                          const AbiTagList *AdditionalAbiTags,
++                                          bool NoFunction,
++                                          bool ExcludeUnqualifiedName) {
+   // <template-prefix> ::= <prefix> <template unqualified-name>
+   //                   ::= <template-param>
+   //                   ::= <substitution>
+@@ -1408,7 +1677,8 @@
+     mangleTemplateParameter(TTP->getIndex());
+   } else {
+     manglePrefix(getEffectiveDeclContext(ND), NoFunction);
+-    mangleUnqualifiedName(ND->getTemplatedDecl());
++    if (!ExcludeUnqualifiedName)
++      mangleUnqualifiedName(ND->getTemplatedDecl(), AdditionalAbiTags);
+   }
+ 
+   addSubstitution(ND);
+@@ -1452,6 +1722,7 @@
+     // <name> ::= <nested-name>
+     mangleUnresolvedPrefix(Dependent->getQualifier());
+     mangleSourceName(Dependent->getIdentifier());
++     // writeAbiTags(Dependent);
+     break;
+   }
+ 
+@@ -1544,16 +1815,19 @@
+ 
+   case Type::Typedef:
+     mangleSourceName(cast<TypedefType>(Ty)->getDecl()->getIdentifier());
++    writeAbiTags(cast<TypedefType>(Ty)->getDecl());
+     break;
+ 
+   case Type::UnresolvedUsing:
+     mangleSourceName(
+         cast<UnresolvedUsingType>(Ty)->getDecl()->getIdentifier());
++    writeAbiTags(cast<UnresolvedUsingType>(Ty)->getDecl());
+     break;
+ 
+   case Type::Enum:
+   case Type::Record:
+     mangleSourceName(cast<TagType>(Ty)->getDecl()->getIdentifier());
++    writeAbiTags(cast<TagType>(Ty)->getDecl());
+     break;
+ 
+   case Type::TemplateSpecialization: {
+@@ -1572,6 +1846,7 @@
+         goto unresolvedType;
+ 
+       mangleSourceName(TD->getIdentifier());
++      writeAbiTags(TD);
+       break;
+     }
+ 
+@@ -1603,16 +1878,19 @@
+   case Type::InjectedClassName:
+     mangleSourceName(
+         cast<InjectedClassNameType>(Ty)->getDecl()->getIdentifier());
++    writeAbiTags(cast<InjectedClassNameType>(Ty)->getDecl());
+     break;
+ 
+   case Type::DependentName:
+     mangleSourceName(cast<DependentNameType>(Ty)->getIdentifier());
++    // writeAbiTags(cast<DependentNameType>(Ty));
+     break;
+ 
+   case Type::DependentTemplateSpecialization: {
+     const DependentTemplateSpecializationType *DTST =
+         cast<DependentTemplateSpecializationType>(Ty);
+     mangleSourceName(DTST->getIdentifier());
++    // writeAbiTags(DTST);
+     mangleTemplateArgs(DTST->getArgs(), DTST->getNumArgs());
+     break;
+   }
+@@ -2070,7 +2348,9 @@
+   case BuiltinType::Id:
+ #include "clang/AST/BuiltinTypes.def"
+   case BuiltinType::Dependent:
+-    llvm_unreachable("mangling a placeholder type");
++    if (!NullOut)
++      llvm_unreachable("mangling a placeholder type");
++    break;
+   case BuiltinType::ObjCId:
+     Out << "11objc_object";
+     break;
+@@ -2546,7 +2826,11 @@
+ 
+ void CXXNameMangler::mangleType(const TemplateSpecializationType *T) {
+   if (TemplateDecl *TD = T->getTemplateName().getAsTemplateDecl()) {
+-    mangleName(TD, T->getArgs(), T->getNumArgs());
++    // types only have explicit abi tags, no addition tags
++    mangleTemplateName(TD,
++                       /* AdditionalAbiTags */ nullptr,
++                       /* ExcludeUnqualifiedName */ false,
++                       T->getArgs(), T->getNumArgs());
+   } else {
+     if (mangleSubstitution(QualType(T, 0)))
+       return;
+@@ -2872,12 +3156,14 @@
+   case Expr::PseudoObjectExprClass:
+   case Expr::AtomicExprClass:
+   {
+-    // As bad as this diagnostic is, it's better than crashing.
+-    DiagnosticsEngine &Diags = Context.getDiags();
+-    unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
+-                                     "cannot yet mangle expression type %0");
+-    Diags.Report(E->getExprLoc(), DiagID)
+-      << E->getStmtClassName() << E->getSourceRange();
++    if (!NullOut) {
++      // As bad as this diagnostic is, it's better than crashing.
++      DiagnosticsEngine &Diags = Context.getDiags();
++      unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
++                                       "cannot yet mangle expression type %0");
++      Diags.Report(E->getExprLoc(), DiagID)
++        << E->getStmtClassName() << E->getSourceRange();
++    }
+     break;
+   }
+ 
+@@ -4020,6 +4306,97 @@
+   Substitutions[Ptr] = SeqID++;
+ }
+ 
++CXXNameMangler::AbiTagSet
++CXXNameMangler::getTagsFromPrefixAndTemplateArguments(const NamedDecl *ND) {
++  llvm::raw_null_ostream NullOutStream;
++  CXXNameMangler TrackPrefixAndTemplateArguments(*this, NullOutStream);
++
++  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
++    TrackPrefixAndTemplateArguments.mangleFunctionEncoding(
++        FD, /* ExcludeUnqualifiedName */ true);
++  } else {
++    TrackPrefixAndTemplateArguments.mangleName(
++        ND, /* ExcludeUnqualifiedName */ true);
++  }
++
++  return std::move(
++      TrackPrefixAndTemplateArguments.AbiTagsRoot.getUsedAbiTags());
++}
++
++CXXNameMangler::AbiTagList
++CXXNameMangler::makeAdditionalTagsForFunction(const FunctionDecl *FD) {
++  // when derived abi tags are disabled there is no need to make any list
++  if (DisableDerivedAbiTags)
++    return AbiTagList();
++
++  AbiTagSet ImplicitlyAvailableTags =
++      getTagsFromPrefixAndTemplateArguments(FD);
++  AbiTagSet ReturnTypeTags;
++
++  {
++    llvm::raw_null_ostream NullOutStream;
++    CXXNameMangler TrackReturnTypeTags(*this, NullOutStream);
++    TrackReturnTypeTags.disableDerivedAbiTags();
++
++    const FunctionProtoType *Proto =
++        cast<FunctionProtoType>(FD->getType()->getAs<FunctionType>());
++    TrackReturnTypeTags.FunctionTypeDepth.enterResultType();
++    TrackReturnTypeTags.mangleType(Proto->getReturnType());
++    TrackReturnTypeTags.FunctionTypeDepth.leaveResultType();
++
++    ReturnTypeTags =
++        std::move(TrackReturnTypeTags.AbiTagsRoot.getUsedAbiTags());
++  }
++
++  AbiTagList AdditionalAbiTags;
++
++  for (const auto &Tag : ReturnTypeTags) {
++    if (ImplicitlyAvailableTags.count(Tag) == 0)
++      AdditionalAbiTags.push_back(Tag);
++  }
++
++  return AdditionalAbiTags;
++}
++
++CXXNameMangler::AbiTagList
++CXXNameMangler::makeAdditionalTagsForVariable(const VarDecl *VD) {
++  // when derived abi tags are disabled there is no need to make any list
++  if (DisableDerivedAbiTags)
++    return AbiTagList();
++
++  AbiTagSet ImplicitlyAvailableTags =
++      getTagsFromPrefixAndTemplateArguments(VD);
++  AbiTagSet VariableTypeTags;
++
++  {
++    llvm::raw_null_ostream NullOutStream;
++    CXXNameMangler TrackVariableType(*this, NullOutStream);
++    TrackVariableType.disableDerivedAbiTags();
++
++    TrackVariableType.mangleType(VD->getType());
++
++    VariableTypeTags =
++        std::move(TrackVariableType.AbiTagsRoot.getUsedAbiTags());
++  }
++
++  AbiTagList AdditionalAbiTags;
++
++  for (const auto &Tag : VariableTypeTags) {
++    if (ImplicitlyAvailableTags.count(Tag) == 0)
++      AdditionalAbiTags.push_back(Tag);
++  }
++
++  return AdditionalAbiTags;
++}
++
++bool CXXNameMangler::shouldHaveAbiTags(ItaniumMangleContextImpl &C,
++                                       const VarDecl *VD) {
++  llvm::raw_null_ostream NullOutStream;
++  CXXNameMangler TrackAbiTags(C, NullOutStream, nullptr, true);
++  TrackAbiTags.mangle(VD);
++  return TrackAbiTags.AbiTagsRoot.getUsedAbiTags().size();
++}
++
+ //
+ 
+ /// Mangles the name of the declaration D and emits that name to the given
+@@ -4121,6 +4498,8 @@
+   //  <special-name> ::= GV <object name>       # Guard variable for one-time
+   //                                            # initialization
+   CXXNameMangler Mangler(*this, Out);
++  // GCC 5.3.0 doesn't emit derived ABI tags for local names but that seems to
++  // be a bug that is fixed in trunk.
+   Mangler.getStream() << "_ZGV";
+   Mangler.mangleName(D);
+ }
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDeclAttr.cpp llvm-3.8.0.src/tools/clang/lib/Sema/SemaDeclAttr.cpp
+--- llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDeclAttr.cpp	2016-07-10 23:56:02.412319038 +0200
++++ llvm-3.8.0.src/tools/clang/lib/Sema/SemaDeclAttr.cpp	2016-07-10 23:59:08.413719568 +0200
+@@ -4476,10 +4476,6 @@
+   D->addAttr(::new (S.Context)
+              AbiTagAttr(Attr.getRange(), S.Context, Tags.data(), Tags.size(),
+                         Attr.getAttributeSpellingListIndex()));
+-
+-  // FIXME: remove this warning as soon as mangled part is ready.
+-  S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
+-        << Attr.getName();
+ }
+ 
+ static void handleARMInterruptAttr(Sema &S, Decl *D,
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/test/CodeGenCXX/mangle-abi-tag.cpp llvm-3.8.0.src/tools/clang/test/CodeGenCXX/mangle-abi-tag.cpp
+--- llvm-3.8.0.src.orig/tools/clang/test/CodeGenCXX/mangle-abi-tag.cpp	1970-01-01 01:00:00.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/test/CodeGenCXX/mangle-abi-tag.cpp	2016-07-10 23:59:08.413719568 +0200
+@@ -0,0 +1,146 @@
++// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - | FileCheck %s
++// RUN: %clang_cc1 %s -emit-llvm -triple i686-linux-gnu -std=c++11 -o - | FileCheck %s
++// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-linux-gnu -std=c++11 -o - | FileCheck %s
++
++struct __attribute__((abi_tag("A", "B"))) A { };
++
++struct B: A { };
++
++template<class T>
++
++struct C {
++};
++
++struct D { A* p; };
++
++template<class T>
++struct __attribute__((abi_tag("C", "D"))) E {
++};
++
++struct __attribute__((abi_tag("A", "B"))) F { };
++
++A a1;
++// CHECK: @_Z2a1B1AB1B =
++
++__attribute__((abi_tag("C", "D")))
++A a2;
++// CHECK: @_Z2a2B1AB1BB1CB1D =
++
++B a3;
++// CHECK: @a3 =
++
++C<A> a4;
++// CHECK: @_Z2a4B1AB1B =
++
++D a5;
++// CHECK: @a5 =
++
++E<int> a6;
++// CHECK: @_Z2a6B1CB1D =
++
++E<A> a7;
++// CHECK: @_Z2a7B1AB1BB1CB1D =
++
++template<>
++struct E<float> {
++  static float a8;
++};
++float E<float>::a8;
++// CHECK: @_ZN1EB1CB1DIfE2a8E =
++
++template<>
++struct E<F> {
++  static bool a9;
++};
++bool E<F>::a9;
++// CHECK: @_ZN1EB1CB1DI1FB1AB1BE2a9E =
++
++struct __attribute__((abi_tag("A", "B"))) A10 {
++  virtual ~A10() {}
++} a10;
++// vtable
++// CHECK: @_ZTV3A10B1AB1B =
++// typeinfo
++// CHECK: @_ZTI3A10B1AB1B =
++
++// Local variables from f13.
++// f13()::L::foo[abi:C][abi:D]()::a[abi:A][abi:B]
++// CHECK-DAG: @_ZZZ3f13vEN1L3fooB1CB1DEvE1aB1AB1B =
++// guard variable for f13()::L::foo[abi:C][abi:D]()::a[abi:A][abi:B]
++// CHECK-DAG: @_ZGVZZ3f13vEN1L3fooB1CB1DEvE1aB1AB1B =
++
++__attribute__ ((abi_tag("C", "D")))
++void* f1() {
++  return 0;
++}
++// CHECK: define {{.*}} @_Z2f1B1CB1Dv(
++
++__attribute__ ((abi_tag("C", "D")))
++A* f2() {
++  return 0;
++}
++// CHECK: define {{.*}} @_Z2f2B1AB1BB1CB1Dv(
++
++B* f3() {
++  return 0;
++}
++// CHECK: define {{.*}} @_Z2f3v(
++
++C<A>* f4() {
++  return 0;
++}
++// CHECK: define {{.*}} @_Z2f4B1AB1Bv(
++
++D* f5() {
++  return 0;
++}
++// CHECK: define {{.*}} @_Z2f5v(
++
++E<char>* f6() {
++  return 0;
++}
++// CHECK: define {{.*}} @_Z2f6B1CB1Dv(
++
++E<A>* f7() {
++  return 0;
++}
++// CHECK: define {{.*}} @_Z2f7B1AB1BB1CB1Dv(
++
++void f8(E<A>*) {
++}
++// CHECK: define {{.*}} @_Z2f8P1EB1CB1DI1AB1AB1BE(
++
++inline namespace Names1 __attribute__((__abi_tag__)) {
++    class C1 {};
++}
++C1 f9() { return C1(); }
++// CHECK: @_Z2f9B6Names1v(
++
++inline namespace Names2 __attribute__((__abi_tag__("Tag1", "Tag2"))) {
++    class C2 {};
++}
++C2 f10() { return C2(); }
++// CHECK: @_Z3f10B4Tag1B4Tag2v(
++
++void __attribute__((abi_tag("A"))) f11(A) {}
++// f11[abi:A](A[abi:A][abi:B])
++// CHECK: define {{.*}} @_Z3f11B1A1AB1AB1B(
++
++A f12(A) { return A(); }
++// f12(A[abi:A][abi:B])
++// CHECK: define {{.*}} @_Z3f121AB1AB1B(
++
++inline void f13() {
++  struct L {
++    static E<int>* foo() {
++      static A10 a;
++      return 0;
++    }
++  };
++  L::foo();
++}
++void f11_test() {
++  f13();
++}
++// f13()::L::foo[abi:C][abi:D]()
++// CHECK: define linkonce_odr %struct.E* @_ZZ3f13vEN1L3fooB1CB1DEv(
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp llvm-3.8.0.src/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp
+--- llvm-3.8.0.src.orig/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp	2016-07-10 23:56:02.415319061 +0200
++++ llvm-3.8.0.src/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp	2016-07-10 23:59:08.413719568 +0200
+@@ -16,28 +16,18 @@
+ // expected-warning@-1 {{'abi_tag' attribute on anonymous namespace ignored}}
+ 
+ inline namespace N __attribute__((__abi_tag__)) {}
+-// FIXME: remove this warning as soon as attribute fully supported.
+-// expected-warning@-2 {{'__abi_tag__' attribute ignored}}
+ 
+ } // namespcace N2
+ 
+ __attribute__((abi_tag("B", "A"))) extern int a1;
+-// FIXME: remove this warning as soon as attribute fully supported.
+-// expected-warning@-2 {{'abi_tag' attribute ignored}}
+ 
+ __attribute__((abi_tag("A", "B"))) extern int a1;
+ // expected-note@-1 {{previous declaration is here}}
+-// FIXME: remove this warning as soon as attribute fully supported.
+-// expected-warning@-3 {{'abi_tag' attribute ignored}}
+ 
+ __attribute__((abi_tag("A", "C"))) extern int a1;
+ // expected-error@-1 {{'abi_tag' C missing in original declaration}}
+-// FIXME: remove this warning as soon as attribute fully supported.
+-// expected-warning@-3 {{'abi_tag' attribute ignored}}
+ 
+ extern int a2;
+ // expected-note@-1 {{previous declaration is here}}
+ __attribute__((abi_tag("A")))extern int a2;
+ // expected-error@-1 {{cannot add 'abi_tag' attribute in a redeclaration}}
+-// FIXME: remove this warning as soon as attribute fully supported.
+-// expected-warning@-3 {{'abi_tag' attribute ignored}}

diff --git a/sys-devel/llvm/files/clang-3.8-abi-tag-support-sema.patch b/sys-devel/llvm/files/clang-3.8-abi-tag-support-sema.patch
new file mode 100644
index 0000000..079f685
--- /dev/null
+++ b/sys-devel/llvm/files/clang-3.8-abi-tag-support-sema.patch
@@ -0,0 +1,419 @@
+diff -Nuar llvm-3.8.0.src.orig/clang/docs/ItaniumMangleAbiTags.rst llvm-3.8.0.src/clang/docs/ItaniumMangleAbiTags.rst
+--- llvm-3.8.0.src.orig/clang/docs/ItaniumMangleAbiTags.rst	1970-01-01 01:00:00.000000000 +0100
++++ llvm-3.8.0.src/clang/docs/ItaniumMangleAbiTags.rst	2016-07-10 23:54:47.768756996 +0200
+@@ -0,0 +1,101 @@
++========
++ABI tags
++========
++
++Introduction
++============
++
++This text tries to describe gcc semantic for mangling "abi_tag" attributes
++described in https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html
++
++There is no guarantee the following rules are correct, complete or make sense
++in any way as they were determined empirically by experiments with gcc5.
++
++Declaration
++===========
++
++ABI tags are declared in an abi_tag attribute and can be applied to a
++function, variable, class or inline namespace declaration. The attribute takes
++one or more strings (called tags); the order does not matter.
++
++See https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html for
++details.
++
++Tags on an inline namespace are called "implicit tags", all other tags are
++"explicit tags".
++
++Mangling
++========
++
++All tags that are "active" on an <unqualified-name> are emitted after the
++<unqualified-name>, before <template-args> or <discriminator>, and are part of
++the same <substitution> the <unqualified-name> is.
++
++They are mangled as:
++
++    <abi-tags> ::= <abi-tag>*   # sort by name
++    <abi-tag> ::= B <tag source-name>
++
++Example:
++
++    __attribute__((abi_tag("test")))
++    void Func();
++
++    gets mangled as: _Z4FuncB4testv (prettified as `Func[abi:test]()`)
++
++Active tags
++===========
++
++A namespace does not have any active tags. For types (class / struct / union /
++enum), the explicit tags are the active tags.
++
++For variables and functions, the active tags are the explicit tags plus any
++"required tags" which are not in the "available tags" set:
++
++    derived-tags := (required-tags - available-tags)
++    active-tags := explicit-tags + derived-tags
++
++Required tags for a function
++============================
++
++If a function is used as a local scope for another name, and is part of
++another function as local scope, it doesn't have any required tags.
++
++If a function is used as a local scope for a guard variable name, it doesn't
++have any required tags.
++
++Otherwise the function requires any implicit or explicit tag used in the name
++for the return type.
++
++Example:
++    namespace A {
++      inline namespace B __attribute__((abi_tag)) {
++        struct C { int x; };
++      }
++    }
++
++    A::C foo();
++
++    gets mangled as: _Z3fooB1Bv (prettified as `foo[abi:B]()`)
++
++Required tags for a variable
++============================
++
++A variable requires any implicit or explicit tag used in its type.
++
++Available tags
++==============
++
++All tags used in the prefix and in the template arguments for a name are
++available. Also, for functions, all tags from the <bare-function-type>
++(which might include the return type for template functions) are available.
++
++For <local-name>s all active tags used in the local part (<function-
++encoding>) are available, but not implicit tags which were not active.
++
++Implicit and explicit tags used in the <unqualified-name> for a function (as
++in the type of a cast operator) are NOT available.
++
++Example: a cast operator to std::string (which is
++std::__cxx11::basic_string<...>) will use 'cxx11' as an active tag, as it is
++required from the return type `std::string` but not available.
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/docs/ItaniumMangleAbiTags.rst llvm-3.8.0.src/tools/clang/docs/ItaniumMangleAbiTags.rst
+--- llvm-3.8.0.src.orig/tools/clang/docs/ItaniumMangleAbiTags.rst	1970-01-01 01:00:00.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/docs/ItaniumMangleAbiTags.rst	2016-07-10 23:55:02.544868256 +0200
+@@ -0,0 +1,101 @@
++========
++ABI tags
++========
++
++Introduction
++============
++
++This text tries to describe gcc semantic for mangling "abi_tag" attributes
++described in https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html
++
++There is no guarantee the following rules are correct, complete or make sense
++in any way as they were determined empirically by experiments with gcc5.
++
++Declaration
++===========
++
++ABI tags are declared in an abi_tag attribute and can be applied to a
++function, variable, class or inline namespace declaration. The attribute takes
++one or more strings (called tags); the order does not matter.
++
++See https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html for
++details.
++
++Tags on an inline namespace are called "implicit tags", all other tags are
++"explicit tags".
++
++Mangling
++========
++
++All tags that are "active" on an <unqualified-name> are emitted after the
++<unqualified-name>, before <template-args> or <discriminator>, and are part of
++the same <substitution> the <unqualified-name> is.
++
++They are mangled as:
++
++    <abi-tags> ::= <abi-tag>*   # sort by name
++    <abi-tag> ::= B <tag source-name>
++
++Example:
++
++    __attribute__((abi_tag("test")))
++    void Func();
++
++    gets mangled as: _Z4FuncB4testv (prettified as `Func[abi:test]()`)
++
++Active tags
++===========
++
++A namespace does not have any active tags. For types (class / struct / union /
++enum), the explicit tags are the active tags.
++
++For variables and functions, the active tags are the explicit tags plus any
++"required tags" which are not in the "available tags" set:
++
++    derived-tags := (required-tags - available-tags)
++    active-tags := explicit-tags + derived-tags
++
++Required tags for a function
++============================
++
++If a function is used as a local scope for another name, and is part of
++another function as local scope, it doesn't have any required tags.
++
++If a function is used as a local scope for a guard variable name, it doesn't
++have any required tags.
++
++Otherwise the function requires any implicit or explicit tag used in the name
++for the return type.
++
++Example:
++    namespace A {
++      inline namespace B __attribute__((abi_tag)) {
++        struct C { int x; };
++      }
++    }
++
++    A::C foo();
++
++    gets mangled as: _Z3fooB1Bv (prettified as `foo[abi:B]()`)
++
++Required tags for a variable
++============================
++
++A variable requires any implicit or explicit tag used in its type.
++
++Available tags
++==============
++
++All tags used in the prefix and in the template arguments for a name are
++available. Also, for functions, all tags from the <bare-function-type>
++(which might include the return type for template functions) are available.
++
++For <local-name>s all active tags used in the local part (<function-
++encoding>) are available, but not implicit tags which were not active.
++
++Implicit and explicit tags used in the <unqualified-name> for a function (as
++in the type of a cast operator) are NOT available.
++
++Example: a cast operator to std::string (which is
++std::__cxx11::basic_string<...>) will use 'cxx11' as an active tag, as it is
++required from the return type `std::string` but not available.
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/AttrDocs.td llvm-3.8.0.src/tools/clang/include/clang/Basic/AttrDocs.td
+--- llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/AttrDocs.td	2015-12-02 22:58:08.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/include/clang/Basic/AttrDocs.td	2016-07-10 23:55:02.545868263 +0200
+@@ -1859,3 +1859,16 @@
+ 
+   }];
+ }
++
++def AbiTagsDocs : Documentation {
++  let Content = [{
++The ``abi_tag`` attribute can be applied to a function, variable, class or
++inline namespace declaration to modify the mangled name of the entity. It gives
++the ability to distinguish between different versions of the same entity but
++with different ABI versions supported. For example, a newer version of a class
++could have a different set of data members and thus have a different size. Using
++the ``abi_tag`` attribute, it is possible to have different mangled names for
++a global variable of the class type. Therefor, the old code could keep using
++the old manged name and the new code will use the new mangled name with tags.
++  }];
++}
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/Attr.td llvm-3.8.0.src/tools/clang/include/clang/Basic/Attr.td
+--- llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/Attr.td	2015-12-02 22:58:08.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/include/clang/Basic/Attr.td	2016-07-10 23:55:02.544868256 +0200
+@@ -349,6 +349,14 @@
+ // Attributes begin here
+ //
+ 
++def AbiTag : Attr {
++  let Spellings = [GCC<"abi_tag">];
++  let Args = [VariadicStringArgument<"Tags">];
++  let Subjects = SubjectList<[Struct, Var, Function, Namespace], ErrorDiag,
++      "ExpectedStructClassVariableFunctionOrInlineNamespace">;
++  let Documentation = [AbiTagsDocs];
++}
++
+ def AddressSpace : TypeAttr {
+   let Spellings = [GNU<"address_space">];
+   let Args = [IntArgument<"AddressSpace">];
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td llvm-3.8.0.src/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
+--- llvm-3.8.0.src.orig/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td	2016-01-09 13:53:17.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td	2016-07-10 23:55:02.547868278 +0200
+@@ -2434,7 +2434,8 @@
+   "Objective-C instance methods|init methods of interface or class extension declarations|"
+   "variables, functions and classes|Objective-C protocols|"
+   "functions and global variables|structs, unions, and typedefs|structs and typedefs|"
+-  "interface or protocol declarations|kernel functions|non-K&R-style functions}1">,
++  "interface or protocol declarations|kernel functions|non-K&R-style functions|"
++  "structs, classes, variables, functions, and inline namespaces}1">,
+   InGroup<IgnoredAttributes>;
+ def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
+ def warn_type_attribute_wrong_type : Warning<
+@@ -4144,6 +4145,13 @@
+ def err_redefinition_extern_inline : Error<
+   "redefinition of a 'extern inline' function %0 is not supported in "
+   "%select{C99 mode|C++}1">;
++def warn_attr_abi_tag_namespace : Warning<
++  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
++  InGroup<IgnoredAttributes>;
++def err_abi_tag_on_redeclaration : Error<
++  "cannot add 'abi_tag' attribute in a redeclaration">;
++def err_new_abi_tag_on_redeclaration : Error<
++  "'abi_tag' %0 missing in original declaration">;
+ 
+ def note_deleted_dtor_no_operator_delete : Note<
+   "virtual destructor requires an unambiguous, accessible 'operator delete'">;
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/include/clang/Sema/AttributeList.h llvm-3.8.0.src/tools/clang/include/clang/Sema/AttributeList.h
+--- llvm-3.8.0.src.orig/tools/clang/include/clang/Sema/AttributeList.h	2015-12-02 18:07:30.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/include/clang/Sema/AttributeList.h	2016-07-10 23:55:02.548868286 +0200
+@@ -855,7 +855,8 @@
+   ExpectedStructOrTypedef,
+   ExpectedObjectiveCInterfaceOrProtocol,
+   ExpectedKernelFunction,
+-  ExpectedFunctionWithProtoType
++  ExpectedFunctionWithProtoType,
++  ExpectedStructClassVariableFunctionOrInlineNamespace
+ };
+ 
+ }  // end namespace clang
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDeclAttr.cpp llvm-3.8.0.src/tools/clang/lib/Sema/SemaDeclAttr.cpp
+--- llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDeclAttr.cpp	2016-01-13 02:07:35.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/lib/Sema/SemaDeclAttr.cpp	2016-07-10 23:55:02.552868316 +0200
+@@ -4446,6 +4446,42 @@
+       Attr.getRange(), S.Context, Attr.getAttributeSpellingListIndex()));
+ }
+ 
++static void handleAbiTagAttr(Sema &S, Decl *D, const AttributeList &Attr) {
++  SmallVector<std::string, 4> Tags;
++  for (unsigned I = 0, E = Attr.getNumArgs(); I != E; ++I) {
++    StringRef Tag;
++    if (!S.checkStringLiteralArgumentAttr(Attr, I, Tag))
++      return;
++    Tags.push_back(Tag);
++  }
++
++  if (const auto *NS = dyn_cast<NamespaceDecl>(D)) {
++    if (!NS->isInline()) {
++      S.Diag(Attr.getLoc(), diag::warn_attr_abi_tag_namespace) << 0;
++      return;
++    }
++    if (NS->isAnonymousNamespace()) {
++      S.Diag(Attr.getLoc(), diag::warn_attr_abi_tag_namespace) << 1;
++      return;
++    }
++    if (Attr.getNumArgs() == 0)
++      Tags.push_back(NS->getName());
++  } else if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
++    return;
++
++  // Store tags sorted and without duplicates.
++  std::sort(Tags.begin(), Tags.end());
++  Tags.erase(std::unique(Tags.begin(), Tags.end()), Tags.end());
++
++  D->addAttr(::new (S.Context)
++             AbiTagAttr(Attr.getRange(), S.Context, Tags.data(), Tags.size(),
++                        Attr.getAttributeSpellingListIndex()));
++
++  // FIXME: remove this warning as soon as mangled part is ready.
++  S.Diag(Attr.getRange().getBegin(), diag::warn_attribute_ignored)
++        << Attr.getName();
++}
++
+ static void handleARMInterruptAttr(Sema &S, Decl *D,
+                                    const AttributeList &Attr) {
+   // Check the attribute arguments.
+@@ -5360,6 +5396,9 @@
+   case AttributeList::AT_Thread:
+     handleDeclspecThreadAttr(S, D, Attr);
+     break;
++  case AttributeList::AT_AbiTag:
++    handleAbiTagAttr(S, D, Attr);
++    break;
+ 
+   // Thread safety attributes:
+   case AttributeList::AT_AssertExclusiveLock:
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDecl.cpp llvm-3.8.0.src/tools/clang/lib/Sema/SemaDecl.cpp
+--- llvm-3.8.0.src.orig/tools/clang/lib/Sema/SemaDecl.cpp	2016-01-11 23:41:53.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/lib/Sema/SemaDecl.cpp	2016-07-10 23:55:02.551868308 +0200
+@@ -2396,6 +2396,24 @@
+     }
+   }
+ 
++  // Re-declaration cannot add abi_tag's.
++  if (const auto *NewAbiTagAttr = New->getAttr<AbiTagAttr>()) {
++    if (const auto *OldAbiTagAttr = Old->getAttr<AbiTagAttr>()) {
++      for (const auto &NewTag : NewAbiTagAttr->tags()) {
++        if (std::find(OldAbiTagAttr->tags_begin(), OldAbiTagAttr->tags_end(),
++                      NewTag) == OldAbiTagAttr->tags_end()) {
++          Diag(NewAbiTagAttr->getLocation(),
++               diag::err_new_abi_tag_on_redeclaration)
++              << NewTag;
++          Diag(OldAbiTagAttr->getLocation(), diag::note_previous_declaration);
++        }
++      }
++    } else {
++      Diag(NewAbiTagAttr->getLocation(), diag::err_abi_tag_on_redeclaration);
++      Diag(Old->getLocation(), diag::note_previous_declaration);
++    }
++  }
++
+   if (!Old->hasAttrs())
+     return;
+ 
+diff -Nuar llvm-3.8.0.src.orig/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp llvm-3.8.0.src/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp
+--- llvm-3.8.0.src.orig/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp	1970-01-01 01:00:00.000000000 +0100
++++ llvm-3.8.0.src/tools/clang/test/SemaCXX/attr-abi-tag-syntax.cpp	2016-07-10 23:55:02.552868316 +0200
+@@ -0,0 +1,43 @@
++// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
++
++namespace N1 {
++
++namespace __attribute__((__abi_tag__)) {}
++// expected-warning@-1 {{'abi_tag' attribute on non-inline namespace ignored}}
++
++namespace N __attribute__((__abi_tag__)) {}
++// expected-warning@-1 {{'abi_tag' attribute on non-inline namespace ignored}}
++
++} // namespace N1
++
++namespace N2 {
++
++inline namespace __attribute__((__abi_tag__)) {}
++// expected-warning@-1 {{'abi_tag' attribute on anonymous namespace ignored}}
++
++inline namespace N __attribute__((__abi_tag__)) {}
++// FIXME: remove this warning as soon as attribute fully supported.
++// expected-warning@-2 {{'__abi_tag__' attribute ignored}}
++
++} // namespcace N2
++
++__attribute__((abi_tag("B", "A"))) extern int a1;
++// FIXME: remove this warning as soon as attribute fully supported.
++// expected-warning@-2 {{'abi_tag' attribute ignored}}
++
++__attribute__((abi_tag("A", "B"))) extern int a1;
++// expected-note@-1 {{previous declaration is here}}
++// FIXME: remove this warning as soon as attribute fully supported.
++// expected-warning@-3 {{'abi_tag' attribute ignored}}
++
++__attribute__((abi_tag("A", "C"))) extern int a1;
++// expected-error@-1 {{'abi_tag' C missing in original declaration}}
++// FIXME: remove this warning as soon as attribute fully supported.
++// expected-warning@-3 {{'abi_tag' attribute ignored}}
++
++extern int a2;
++// expected-note@-1 {{previous declaration is here}}
++__attribute__((abi_tag("A")))extern int a2;
++// expected-error@-1 {{cannot add 'abi_tag' attribute in a redeclaration}}
++// FIXME: remove this warning as soon as attribute fully supported.
++// expected-warning@-3 {{'abi_tag' attribute ignored}}

diff --git a/sys-devel/llvm/llvm-3.8.1-r1.ebuild b/sys-devel/llvm/llvm-3.8.1-r1.ebuild
index 60e6d5e..802911c 100644
--- a/sys-devel/llvm/llvm-3.8.1-r1.ebuild
+++ b/sys-devel/llvm/llvm-3.8.1-r1.ebuild
@@ -225,6 +225,10 @@ src_prepare() {
 		# https://llvm.org/bugs/show_bug.cgi?id=26651
 		eapply "${FILESDIR}"/clang-3.8-compiler-rt-fbsd.patch
 
+		# Backport abi-tag support, bug #571600
+		eapply "${FILESDIR}"/clang-3.8-abi-tag-support-sema.patch
+		eapply "${FILESDIR}"/clang-3.8-abi-tag-support-mangler.patch
+
 		pushd projects/compiler-rt >/dev/null || die
 
 		# Fix WX sections, bug #421527


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

end of thread, other threads:[~2016-08-02 17:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 15:28 [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/ Bernard Cafarelli
  -- strict thread matches above, loose matches on Subject: below --
2016-08-02 17:24 Matthias Maier
2016-07-05 19:04 Michał Górny
2016-07-03  7:17 Michał Górny
2016-03-28 21:31 Michał Górny
2016-03-28 15:57 Michał Górny
2016-01-07 22:10 Michał Górny
2016-01-07 22:10 Michał Górny
2016-01-07 22:10 Michał Górny
2015-12-02 19:55 Michał Górny
2015-08-24 15:03 Bernard Cafarelli

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