commit:     7719c819d4a83c94c98b46917fb1647d6db6d619
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon May 16 15:44:16 2016 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon May 16 15:44:39 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7719c819

sys-devel/binutils-apple: add ppc support and updates for testing, bug #582782

Package-Manager: portage-2.2.28

 sys-devel/binutils-apple/Manifest                  |  14 ++
 ...ple-6.3.ebuild => binutils-apple-4.3-r2.ebuild} | 158 +++++++++---------
 ...ple-6.3.ebuild => binutils-apple-5.1-r1.ebuild} | 141 +++++++++++------
 ...ple-6.3.ebuild => binutils-apple-6.1-r1.ebuild} | 138 ++++++++++------
 ...ple-6.3.ebuild => binutils-apple-6.3-r1.ebuild} | 123 ++++++++------
 sys-devel/binutils-apple/binutils-apple-6.3.ebuild |   2 +-
 ...-apple-6.3.ebuild => binutils-apple-7.0.ebuild} | 175 +++++++++++---------
 ...-apple-6.3.ebuild => binutils-apple-7.1.ebuild} | 176 ++++++++++++---------
 ...-apple-6.3.ebuild => binutils-apple-7.2.ebuild} | 175 +++++++++++---------
 sys-devel/binutils-apple/metadata.xml              |   3 +
 10 files changed, 652 insertions(+), 453 deletions(-)

diff --git a/sys-devel/binutils-apple/Manifest 
b/sys-devel/binutils-apple/Manifest
index 6133d20..2a8ea37 100644
--- a/sys-devel/binutils-apple/Manifest
+++ b/sys-devel/binutils-apple/Manifest
@@ -1,5 +1,10 @@
 DIST binutils-apple-3.2-unwind-patches-5.tar.xz 26924 SHA256 
65a3b979df5c2033ac34e830d8a77b92b436b6d5707483c619c90a1c2ea46428 SHA512 
9f3ec399274060b67c51193029da5af2199c45bf923a2fa513143111cf3f1c899256c993f4927f4da85a21570d0bc9ff0872e663f90284b2cdbb3f609ea8484e
 WHIRLPOOL 
877410e6e0b442df9e9b7cdef51cc28bd636856949ea42ac53e97ebfc41c2f50309a054729d4fc3498d6eccac96170ffb59dd5700237e59684773832218793cc
 DIST binutils-apple-LP64-patches-1.tar.bz2 10235 SHA256 
a107459f3914d57524e51ec4cb5e800f6715d40003514c79add0b5b4521cf809 SHA512 
5632d4033c39e47de3ec275d02100ed53408a63122fe722c26dda1b02275c397524b113e51e1334d3235fc7f0a3bb8e53d4ccc1c2e40f24c6129282846da22e1
 WHIRLPOOL 
c46d2021c85cee46e87871687ca7217169d14061848d12b4fa203db5d76a89969313ce55b345f2ad9fdba65fd39bdd34b146393332566fd539b2bdfc3f1e4304
+DIST binutils-apple-patches-4.3-r0.tar.bz2 36764 SHA256 
968753a7de5281d01b01a8d0313bb011e051f0366e9d90e601c77882cb27c606 SHA512 
17c7b51c7dbcc6857ab366ef72bd96bf7376ee4ebfed4086f2bafa39b0ae6f22830f2e765e0ff529e2931221444ca926659eeb81db24d7649a086bc660d6f53a
 WHIRLPOOL 
b8d11f6b47d0f10ecb57aaac5ab4a147bdf52167fb583f4dfda9dad0799e9386c301185abb7ba9cebb461f4856160f8fa9e7465014d9a181e0c8ee0e003a4b64
+DIST binutils-apple-patches-5.1-r0.tar.bz2 50582 SHA256 
41701843d698535797c7e63de97f5f737acd479a1e5eb2d8b80601ac6e3fcf14 SHA512 
9e056085c33594e834f456ce0be07b16672141b0219b54de19102862e95e6ec6c491133cf3cd29952a216fbb42257da4f54f2fc00ab521f21d217b21110ac76d
 WHIRLPOOL 
12f533ce8f8c4d2d738cbe1d9d30aedb461ce224b4bdbdac99271f11102f5767c74b0d8821a660f6029ebdb401c05cfe62a80d78dfd7aae5abf0802118e7367f
+DIST binutils-apple-patches-6.1-r0.tar.bz2 42092 SHA256 
22515ea8b91551010506f34a188b5934fd9d43e4f5d1dca9db17fac7991a4c18 SHA512 
11bdb62729f1bea0fddd3e4c054e714a6f755d36ea83e19af35bfb6c19508056ce214ce7007ee05a4fd52bca94bab81f5e3798225d771e633fd141a0b6b90dad
 WHIRLPOOL 
646d7e9ab2aed76b9c558735e7915b963ed2377eb0f50c6bf7545b7d3a8240fe7502699b518c3252696b073df998fa83dc5b90abfa2ce15f63c0fd1b57d4b1a7
+DIST binutils-apple-patches-6.3-r0.tar.bz2 37915 SHA256 
8c71f3e69b8509a0537d670bb552ac93b90e062e81b98db933c4e6c4dfbdeb0e SHA512 
58a526458bca075cf4374d100d00268e8842412637d1da82114987d52e1d1206ffe97b915a763412de6b1d93770443bee6c1c93c37cc7fa204dc08cea2736bb9
 WHIRLPOOL 
ebfd148390e216d26f95b34acffc0a3ed858f6fdbb6b1a55eb2e52bf45a3665247364d4a8e53ea6fd2497953d8d87ed9280374c2085fa4f143e3835032819e29
+DIST binutils-apple-patches-7.0-r0.tar.bz2 43065 SHA256 
640eaa1fb4cffdbaa986e54f437f67538e54add8b08d10fc3e2efd4a10e95ad6 SHA512 
5936616d518262d036172bc2a40e0654322018ebecbd52272eaf4ee298c65157b5e6e993623b2d8dcd56a97d1fd48fa897dbeb259861bd454e81b0ba536edc83
 WHIRLPOOL 
32527e3f9c640f1620433d880d9726a72da7ad8d63fa8ff91d9004317ab837ff6bbdc68775038e395da8696799d884abd09329c9e6acaf7ab6fb2cf18e24c22e
 DIST cctools-698.1.tar.gz 2318018 SHA256 
383f1c0c78a2b3efdfdf7ce01adb7e2f8ee9985164dba6ab1c0fae800a211cec SHA512 
05e64df9bead958e6035b3cf449a2cb21b19cef10278348ebea8b47816b05a77ebd7f72fd90270400784a231b5d55c8f909653e8177cbe1332d7f7d618453f12
 WHIRLPOOL 
6ae1244ca97b13378e864609aa62efc4bf028b3e55bfb00cdbf9d20ed6cedd917c64ce337b2635dcabce334b8f994e2558fbda36055b951bf769a21950673e12
 DIST cctools-750.tar.gz 1947953 SHA256 
188855640da114e37e4ddd4824ff6cdc1ea89dfb6c90a23905c9ca315342f356 SHA512 
e2e152a9fb7db47c60fe450e1fc92c6866ab89682c7fdc594b97e419ce93ea1353654bd4419bf3df99d119f554aa0f32993dc645dd7c4680840cd01b7dce2f67
 WHIRLPOOL 
98e48fca183ee47d138426c65401138954a86abc3b80bfc4c5d105b97b8eb583ae350657f1a7dc1154259d0bcdfe1d60dc0a63409826e9a24b178674a5afdf21
 DIST cctools-795.tar.gz 1993795 SHA256 
7fab7044b648e92a9fefd493a1bb6daa4246f24c5838d8b5c913a446e6bbd2ef SHA512 
5a34a73dc71d3574a357f6b0f26a48a99dd0995d62695b309cdfe85c4960934b410455b1ba6bdbc9a4e32106bb45b35555604975d2a80ad1be21f5d4eac69254
 WHIRLPOOL 
2bd074ac8ef8542c2c3df5fae91a0bece2e1c31d6c6c771c55e7c7a3d90929f9a7cd420760dcb5ecffb9dd279abed4ba5ebf840c9e9bb983a806707d735cd735
@@ -8,14 +13,23 @@ DIST cctools-822.tar.gz 2024412 SHA256 
dfaa9bdbd023524d47429674f64d2d5ea393123da
 DIST cctools-855.tar.gz 1699635 SHA256 
751748ddf32c8ea84c175f32792721fa44424dad6acbf163f84f41e9617dbc58 SHA512 
50f5d015ce807aa5ca274dd2deea810b8b375110e60b5e334ca4b2170526b738ea5f86a5436caebbdb748badc3b89601d0f450f5b867d8393c89e336a3db4b3f
 WHIRLPOOL 
fa493a29e32583f60c3553794bbb6d01a7b5ef797d8e8ba8161c9cbf237906ebbfaff560366da2d5b852bfcbdd55e874c00edf5b3169b16b357a54fcf3c07c4c
 DIST cctools-862.tar.gz 1702345 SHA256 
1bf29f620b91c901ad3116b47738ab5076c1aed75d13869cd3bc7f067b4aaadb SHA512 
faa401c1dc55bfb9cd2a9a9cc7bc9d473ee63b019607967c8b0da325514d6a1f7b1f52404370bcc018e86d30d75a4b01183f49b793f577110663efe43871360a
 WHIRLPOOL 
371307f3264361f5e2e48d83177aff1a8f435cf2bdc1f4998cc5780c5b3760048a29a7620d2390db8f0c9378cd2f3b2f130b6aca9d402e3d428c4f4d353db097
 DIST cctools-870.tar.gz 1702965 SHA256 
b83f4b4696414b814cc1781ec4b68ff9c7bb97920a68f308351a74e75f41d961 SHA512 
8cd16350bc2eea576e3922f44de3d15cfcf492a5561215a3a9160f2045284a2fd0fa28e030686868bae8619993fc8901649d7576c56d86a423f9955b27f65138
 WHIRLPOOL 
9c99188b0e6e71fc3beef674b977f5f59310410b004c26e85e83b7fe7d48f4499a31b982935c695effaa9130781dc10b9a20633800df361a550cf53fb52ba352
+DIST cctools-877.5.tar.gz 1717664 SHA256 
5e7525c86581d9dead8a8508a9e824101765d05a3e14d612de1aa38def9adde9 SHA512 
cec8520450c3b1ffe77bd841ad6b8f6b0d28657e7c39ae1525bfe7ec1460c0f4bb394da316e6ed5b08cb5df26b757b9d94a9923cc7eaf9b14315d045ea891062
 WHIRLPOOL 
30b8c8fad772804a449318b08b7e3362e9a73345a4fe43758216d41f533189dac6a2bee37f1884fc049702f2705fda250767cf3a776956796c270147197920b7
+DIST cctools-877.7.tar.gz 1720523 SHA256 
c3809b7604a27db0c0b418fcccd5cad49f002e2a750ec611f92f806521f7ed9e SHA512 
5c381fe8b85d1254f660eb3c3510d9e0a49792ae5bb0e69a4dfb5a18e7f1706ee1411589f20583a9d7f12126ef616f66f1ad5c1c4ff405f66b52759c0a4272b5
 WHIRLPOOL 
2c8e85fd33f183bd074abf90237301eff252ca05aa48a59aea713d263b10e0710d261a5ac01185e9a17d1a391fa025fb91d60df0f3b426140defdbd5536e4bbb
+DIST cctools-877.8.tar.gz 1720708 SHA256 
88be2788adf461f1d8278324b0078f6003b2328b6f95a54b16ec6ed1ba651dc2 SHA512 
3f75fbe4eacd89f2e6372a3167ed197e2b8bda9faa10fe6bce0cf9d3d3eca536f0af5fc4ce1e4bc6a24eb68db36f5d0b1d0bc3f9807e285e67cfaa2d336d81ef
 WHIRLPOOL 
eea67bacd8037b19ba3efcc2fecfcc74ec3e785ce92628fdeccbeca6e17dee4d1926719a02ca7f68fc2045f9b37571cb044cc29a3a8fe6a5bd704a3446f44945
 DIST dyld-195.5.tar.gz 411615 SHA256 
2cf0484c87cf79b606b351a7055a247dae84093ae92c747a74e0cde2c8c8f83c SHA512 
f316d32f3e417cf0898a8e231df66572d3424765831375863799d3ff30f8e28342ca692426d0ece7a8d069b341a3b9ca79c625edc322d90e3f26f528ea555324
 WHIRLPOOL 
e0e231653ad37ad8fdb7d5fbd372fe1dc34b80e41f7dafa8bb46f4c8fa4f5acb4574f4cd346304dfaca1f074667f381931ca5ff7a7efddaea770fb35d30539dc
 DIST dyld-195.6.tar.gz 412518 SHA256 
69296e9b4192bdac778ea899fffc18b02be62b51b5e8474b4cf85ae5f2b08aa4 SHA512 
58a9ea27efc02e66f9d99bfa250af1d90326385385431e5279386bbd9ab53366bf7e8236543296908b7214c33523c8f60098a6298a7393b3180e2a6bce18e7c5
 WHIRLPOOL 
e37b11d3996559f8a1843577a5fa42f96e4d42419f205276600f0ed79fcd2490da1f8a77eecf29f111b3db62a65e8e9cd77a154e3b389d633a7ac1525273b9b5
 DIST dyld-353.2.1.tar.gz 510036 SHA256 
051089e284c5a4d671b21b73866abd01d54e5ea1912cadf3a9b916890fb31540 SHA512 
a9488620499f682e245b55b7e0e4ec02fc0bcf03bd8a70d4a4ee0ba762067ade2f41c188990c101727476d41c19368b4cc89cccf2df40231da1c777742c7391f
 WHIRLPOOL 
3164746ed8c866df993f08e405e7e329db427af8eeded681d5fb88031ef2c025363d5bfb647e9315738024adf9f48efacf49226f86f27def584ec7f538da292e
+DIST dyld-360.14.tar.gz 518873 SHA256 
c4e011241d75e3fac4dbdfc0049ccf26fb939fea6c0256b6f16036b2e4690c6e SHA512 
cfe536ea1f0ad8fbc2846417289e3e36704bf69388e083e0ece0ffa6eeee501e7e9b2ba47eed7be0e5120b5cc72f33b2fc0d2d39ba7a16beaf98db94dfb4ae40
 WHIRLPOOL 
6ed42fa38f60a84deab0bc9b128f5de232df487613726978be29783ede7eee9b5899472a984d50f44a20c87c1772aeede9b81706000fa66713df34d6e956c88e
+DIST dyld-360.17.tar.gz 518876 SHA256 
e137f54d5f7af7512e2e2337248caa0580743db212471de71fd45d3e3e92c68d SHA512 
aae2a0ea1f4130de51aa920ce1affa579993b3b58a7d398ec998c0d7ac4919907ba4e508b9bfc15080b1f4f4cf15e4615bc416b6ec32b52a4b5d8fbbad1dc9ab
 WHIRLPOOL 
2c3cc5fe0063b0a6ad1cc77e5ae1204e8bcd23ba732ad775910fe6340a5d908b77d2623fb7fa4eccff20e0e2176405d8d6734b7d60dbba61ccfc58f37009aca7
+DIST dyld-360.18.tar.gz 518957 SHA256 
a5bec8c2e3bded111aec7e447b35c110038e822f95e11e55b9a4d331fbaeff08 SHA512 
1299bd2dd5cd663917ec4a03ed0f875e0bf07d6680d3d095af12f4b11960c02a52e361bde27ff88843f80832fc6d36654e2556ee0a3ca2259fcded5b568ab2f9
 WHIRLPOOL 
5b42ea6de3f08b7e0fbad7ea9df512c74fd4bceecf859683297d0cb8998d642ea3a0597ef488dcbf42a75064a07a528baf63c957d36174fddff34d6e6c7502d8
 DIST ld64-127.2.tar.gz 496975 SHA256 
97b75547b2bd761306ab3e15ae297f01e7ab9760b922bc657f4ef72e4e052142 SHA512 
a87181eca9307518aa21fc52a4d665c11ad51106c318c229d7f08650228f771484fd0b8c01c63639d577503aa9bc86d0792a3524643dc18cff19c3754aed9fc8
 WHIRLPOOL 
94f58da977da3d2d0c5a907a7d2c02e4a0d8323d04b8429d133e377b8495b0d344eec93dd1baaf369aa0a1517c7666cbef1d98d3cc6e8fd5d51c9622a2edcdf1
 DIST ld64-128.2.tar.gz 494361 SHA256 
96a912464e2d4d3d7cdaab0744003b0fa93d139f203c82867f659ee94b4ae9f7 SHA512 
f50a3c396e6f4fddc685bb3f59f9a260bd2f47060535d24259b2b411e4f759e48daa35819da682ad9bceaa1b9a1981eb34716387d988cdc4b7eec9ab2169726e
 WHIRLPOOL 
78dec40124ae11c80483b362860b01c833fcaff67bae6b6cb3b72371daffdf3be809186f5daca4bb6ace77441cb43168939eb60eedf9f8c05ae3ec644c2a0502
 DIST ld64-236.3.tar.gz 624400 SHA256 
8ef36729b643201081ab45ebd8586ede8f9968bc17614b679a940faa82875ca6 SHA512 
e103fc5efd4d4161c7dc55b1ad53aebd455cfcd72de7873ebfdf5ba896b7b0da9c9aeb12e1e1a76425768ac1dc85d864a4ce33b5b841ba115eeab96a2e2965aa
 WHIRLPOOL 
d122e325518860c810b9efde7016ebecb6b59c56bb40ae1f041a840be764a5d9b90c7db1922fd9037c18f4caae7ace0d395591ffb3db704c87b92837ef997a17
 DIST ld64-241.9.tar.gz 639944 SHA256 
3594e87c626c3b5abab6470cac6f27b367f1efcee60eb3d0f6b6d4ecf9b24230 SHA512 
6958e7064f4fd8b47501225fc4cbc6292e5da63d7f4103ad79add177ef7382c8de3c732f14d19a9c11356b8070f578392383caccc3795e2ab8ef7b7ddbde88da
 WHIRLPOOL 
5b07a336efde52b00b2601866907513517593a113583f05a9c45b98b4d6f394d87add887a7e44a95f462b6c2b5617ce497376b94a523e5cdf0f69d4d10ef3407
 DIST ld64-242.tar.gz 641597 SHA256 
bec1a5e20b599d108be0017736833c1f6212ea26c67f20d8437abc5d23433c36 SHA512 
bde2eee69ada7f81d5e97762c371661f304372d5461da4bd843c76d0abcab518193fa71b917850af2022e586a756a3624a0ad28debfa8de6777e3c255d83dd34
 WHIRLPOOL 
d4c54f2a145386fd90a8a12f08010e31a84912c5f11e4a48e08497f282449cc9eb053855f302cf0353035bb2a6513aaed92737ab60c8b3a6bb3a1af626adf475
+DIST ld64-253.3.tar.gz 671087 SHA256 
76c02f6f297c251b66504e1115946bda6e1618640bc6cf03d0ad99b17bd8a5d6 SHA512 
ce2c86f2f37ee37bd417315ba51815707b0ca6f24da06819fd1b2d0b4fe0762e45a08c3faf2c0c980e4913c9cbfbf6c8185f9a6810cfa1d9dad231b5bb276081
 WHIRLPOOL 
7e168bb6dc1474d26da77ca6afde1b591781eb5c0a7a50530b334e4ed6dc0206a2d047375d7d924aa05ccc0912ec8ee966874a9324c66820c454ebd173d1520e
+DIST ld64-253.6.tar.gz 671838 SHA256 
7fbae5e88ac1420480de8a495dcd3b876d399278bfce9ffbef7d54334dd80b4a SHA512 
40b29e273ed3d69e4f92593cadea831fd618452d3f05e30c0b836ffc05db61fd345cb2f6d63271563c786ecabd47f19f8369456cbe6422800117a53c654a98c6
 WHIRLPOOL 
b687166038f0ad3dd65a623c91aa7204025ab371b90d5be57fff3bf8f8d89df93aaf8d781fd3a950ced4deab667917a379ad5ac479d25fb00644a02950c118cd
+DIST ld64-253.9.tar.gz 673388 SHA256 
8fa3a1b65f665824ac129c02e2fab8926a06e503ec277ea32cd8bc27c8de11c3 SHA512 
a52b081295c19f28858f8ee47c05249bba3e15cc8bb6f7017d9f6dcf7509cdacef7a4b16b3940cd0b1f72b3b67efb503ab2e3801b31e50cda1d34c6bc8df8dcf
 WHIRLPOOL 
07e850984d2ff24637a64d76860799136e63af56dc2740f8d1e1bd3311ae3f33eac902e7850f94555407002d0d16f44d4a276470f54e60a0633169b884b7dfc1
 DIST ld64-85.2.1.tar.gz 598524 SHA256 
4bcbcbdfd62efdc46c51700b8f5dae2cbd1638e9e50f649d5c7f242d32fca804 SHA512 
b5ffaffc43e74f22688fecd9fb3023a59160cf051f9412f34e6b0acf1c4f9d43ba641e199d8d6b1c6cf3bbbbf117645988fd879ded1fec8be056b6941fe79999
 WHIRLPOOL 
7c50f462eb41808b57ea06b82bdf576460bddb4150abe7a678af541aa0b179105d994a2b6fd10152481aa28acc903265160945b4aae9dcfce0a1a1cfe4b9460a
 DIST ld64-97.17.tar.gz 421947 SHA256 
02bd46af0809eaa415d096d7d41c3e8e7d80f7d8d181840866fb87f036b4e089 SHA512 
841774a1a7c0e2f661ac7e66703f7578d8f11274897ffa15f8c49daf290a23465763f264a4dae99f15754891f44c425c0d327652112007b499bc8f755a7fc9d6
 WHIRLPOOL 
7225b44d845b13c6b6d1a685170f2b6e15b81c48320fa3b570771938ed457a59452e80873996a4b2712a8f6813486063afd73acf979a97d823afb3d510d74678
 DIST libunwind-30.tar.gz 82811 SHA256 
6ac97d18cc2b05e6de1269bf5af03b81948bd2200dae827527f3dc618b82bd41 SHA512 
57106eafa1516791b4e0db2de6c6336bc0c1cbd8bf098a6d3a809fafa457802c95a7aeae9137f4ca5922a3018dfd8f597907ea4187b0afbbf267500eae00041f
 WHIRLPOOL 
c3caf5ba593cffa2f0a9cdb256f518524e9500eaf0a013c4973dc9881b16efa0c388e70407bbed1fd331f100af2da01ddeee12d33b3afc1213d69c32ab5e1d0b

diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild 
b/sys-devel/binutils-apple/binutils-apple-4.3-r2.ebuild
similarity index 70%
copy from sys-devel/binutils-apple/binutils-apple-6.3.ebuild
copy to sys-devel/binutils-apple/binutils-apple-4.3-r2.ebuild
index 663c668..00c71a8 100644
--- a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
+++ b/sys-devel/binutils-apple/binutils-apple-4.3-r2.ebuild
@@ -1,35 +1,36 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI="5"
+EAPI="3"
 
 inherit eutils flag-o-matic toolchain-funcs
 
-LD64=ld64-242
-CCTOOLS_VERSION=870
+LD64=ld64-128.2
+CCTOOLS_VERSION=822
 CCTOOLS=cctools-${CCTOOLS_VERSION}
-LIBUNWIND=libunwind-35.3
-DYLD=dyld-353.2.1
+CCTOOLS_HEADERS=cctools-855
+LIBUNWIND=libunwind-30
+DYLD=dyld-195.6
 
 DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
 HOMEPAGE="http://www.opensource.apple.com/darwinsource/";
 SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
        http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
+       
http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS_HEADERS}.tar.gz
+       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
        http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
-       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz";
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r0.tar.bz2";
 
 LICENSE="APSL-2"
-KEYWORDS="~x64-macos ~x86-macos"
-IUSE="lto test libcxx"
+#KEYWORDS="~x64-macos ~x86-macos" # needs more work, bug 582782
+IUSE="lto test multitarget"
 
 RDEPEND="sys-devel/binutils-config
-       lto? ( sys-devel/llvm )
-       libcxx? ( sys-libs/libcxx )"
+       lto? ( sys-devel/llvm )"
 DEPEND="${RDEPEND}
        test? ( >=dev-lang/perl-5.8.8 )
-       || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )
-       libcxx? ( sys-devel/llvm )"
+       || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )"
 
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
@@ -40,9 +41,9 @@ fi
 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
 
 if is_cross ; then
-       SLOT="${CTARGET}-6"
+       SLOT="${CTARGET}-4"
 else
-       SLOT="6"
+       SLOT="4"
 fi
 
 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
@@ -57,21 +58,34 @@ fi
 S=${WORKDIR}
 
 src_prepare() {
+       if use multitarget ; then
+               ewarn "You have enabled support for non-standard target 
architectures"
+               ewarn "using USE=multitarget. This includes experimental 
support for"
+               ewarn "ppc and ppc64 which is a community forward-port from the 
last"
+               ewarn "version of ld64 to officially support PPC."
+
+               if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+                       ewarn "HERE BE DRAGONS! Your system seems to be PPC 
which means that"
+                       ewarn "the actual usability of your Gentoo programs 
will depend on the"
+                       ewarn "above-mentioned experimental PPC support in the 
linker. Be"
+                       ewarn "sure to keep a known-to-work version like 
${PN}-3.2.6 around!"
+               fi
+       fi
+
        cd "${S}"/${LD64}/src
-       cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
-       cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
-
-       epatch "${FILESDIR}"/ld64-236.3-nolto.patch
-       epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
-       epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
-       epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
-       epatch "${FILESDIR}"/ld64-242-gcc.patch
-       epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
-       epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
-       epatch "${FILESDIR}"/ld64-242-noarm.patch
-       epatch "${FILESDIR}"/ld64-241.9-register-names.patch
-       epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
-       epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+       cp "${S}"/ld64-128.2-Makefile-3 Makefile
+       epatch "${S}"/ld64-127.2-lto.patch
+       epatch "${S}"/ld64-128.2-stdlib.patch
+       epatch "${S}"/ld64-241.9-register-names.patch
+       epatch "${S}"/ld64-241.9-get-comm-align.patch
+       epatch "${S}"/ld64-241.9-cc_md5.patch
+       epatch "${S}"/ld64-128.2-1010.patch
+       epatch "${S}"/ld64-128.2-ppc.patch
+
+       # We used to use our own copy of lto.h, which doesn't require llvm
+       # build-env. Current versions of llvm provide
+       # $EPREFIX/usr/include/llvm-c/lto.h as well as
+       # $EPREFIX/usr/lib/libLTO.{so,dylib}, so we just use these.
 
        # provide missing headers from libunwind and dyld
        mkdir -p include/{mach,mach-o/arm} || die
@@ -89,7 +103,7 @@ src_prepare() {
        cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
        # add alias for newer identifiers, because ld64 uses both but cctools
        # header only defines the older
-       epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+       epatch "${S}"/ld64-236.3-missing-cputypes.patch
 
        # mimic OS X Leopard-style Availability.h macros for libunwind.h on
        # older systems
@@ -99,21 +113,28 @@ src_prepare() {
        local VER_STR="\"@(#)PROGRAM:ld  PROJECT:${LD64} (Gentoo 
${PN}-${PVR})\\n\""
        echo "char ldVersionString[] = ${VER_STR};" > version.cpp
 
-       epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+       epatch "${S}"/ld64-123.2-debug-backtrace.patch
+       if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+               epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+               epatch "${S}"/ld64-127.2-thread_state.patch
+       fi
 
        cd "${S}"/${CCTOOLS}
-       epatch "${FILESDIR}"/${PN}-4.5-as.patch
-       epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
-       epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
-       epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
-       epatch "${FILESDIR}"/cctools-839-intel-retf.patch
-       epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
-       epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
-       epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
-       epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-4.0-as.patch
+       epatch "${S}"/${PN}-4.2-as-dir.patch
+       epatch "${S}"/${PN}-3.2.3-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-nmedit.patch
+       epatch "${S}"/${PN}-3.1.1-no-headers.patch
+       epatch "${S}"/${PN}-4.0-no-oss-dir.patch
+       epatch "${S}"/${PN}-4.2-lto.patch
+       epatch "${S}"/${PN}-5.1-extraneous-includes.patch
+       epatch "${S}"/${PN}-5.1-thread-state-redefined.patch
+       epatch "${S}"/${PN}-4.3-makefile-target-warning.patch
+       epatch "${S}"/${PN}-4.3-lto-prefix.patch
        cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
+       # __darwin_i386_float_state missing on <= 10.4
+       cp -a ../${CCTOOLS_HEADERS}/include/mach/i386 include/mach
 
        # do not build profileable libstuff to save compile time
        sed -i -e "/^all:/s, profile , ," libstuff/Makefile
@@ -165,35 +186,13 @@ src_prepare() {
 }
 
 src_configure() {
-       CCTOOLS_LTO=
-       LD64_LTO=0
-       if use lto ; then
-               CCTOOLS_LTO="-DLTO_SUPPORT"
-               LD64_LTO=1
-       fi
-
-       if [[ ${CXX} == *clang* ]] ; then
-               if use libcxx ; then
-                       append-cxxflags -stdlib=libc++
-                       CXXLIB=-stdlib=libc++
-               else
-                       # force libstdc++ for systems where libc++ is default 
(OS X 10.9+?)
-                       append-cxxflags -stdlib=libstdc++
-                       CXXLIB=-stdlib=libstdc++
-               fi
-       else
-               use libcxx && \
-                       ewarn "libcxx only available with clang and your C++ 
compiler ($CXX) does not seem to be clang"
-       fi
+       ENABLE_LTO=0
+       use lto && ENABLE_LTO=1
 
        # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
        # what we want)
        append-cppflags -DNDEBUG
 
-       # Block API and thus snapshots supported on >= 10.6
-       [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \
-               append-cppflags -DSUPPORT_SNAPSHOTS
-
        CCTOOLS_OFLAG=
        if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then
                # cctools expect to use UNIX03 struct member names.
@@ -202,20 +201,22 @@ src_configure() {
                CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
        fi
 
-       # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
-       # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
-       # override architectures (there are more arms to add) but we configure
-       # with the default to be in line with Xcode's ld.
-       DERIVED_FILE_DIR=${LD64}/src \
-               RC_SUPPORTED_ARCHS="" \
-               ${LD64}/src/create_configure
+       cat <<EOF > ${LD64}/src/configure.h
+#define DEFAULT_MACOSX_MIN_VERSION "${MACOSX_DEPLOYMENT_TARGET}"
+#define SUPPORT_ARCH_arm_any 1
+EOF
+
+       use multitarget && cat <<EOF >> ${LD64}/src/configure.h
+#define SUPPORT_ARCH_ppc 1
+EOF
+#define SUPPORT_ARCH_ppc64 1
 }
 
 compile_ld64() {
        einfo "building ${LD64}"
        cd "${S}"/${LD64}/src
        emake \
-               LTO=${LD64_LTO} \
+               LTO=${ENABLE_LTO} \
                || die "emake failed for ld64"
        use test && emake build_test
 }
@@ -224,22 +225,16 @@ compile_cctools() {
        einfo "building ${CCTOOLS}"
        cd "${S}"/${CCTOOLS}
        # -j1 because it fails too often with weird errors
-       # Suppress running dsymutil because it will warn about missing debug
-       # info which is expected when compiling without -g as we normally do.
-       # This might need some more thought if anyone ever wanted to build us
-       # for debugging with Apple's tools.
        emake \
                LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
                EFITOOLS= \
-               LTO="${CCTOOLS_LTO}" \
+               ENABLE_LTO="${ENABLE_LTO}" \
                COMMON_SUBDIRS='libstuff ar misc otool' \
                SUBDIRS_32= \
                LEGACY= \
                RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
                RC_CFLAGS="${CFLAGS}" \
                OFLAG="${CCTOOLS_OFLAG}" \
-               CXXLIB="${CXXLIB}" \
-               DSYMUTIL=": disabled: dsymutil" \
                -j1 \
                || die "emake failed for the cctools"
        cd "${S}"/${CCTOOLS}/as
@@ -248,7 +243,6 @@ compile_cctools() {
                RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
                RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" 
${CFLAGS}" \
                OFLAG="${CCTOOLS_OFLAG}" \
-               DSYMUTIL=": disabled: dsymutil" \
                || die "emake failed for as"
 }
 

diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild 
b/sys-devel/binutils-apple/binutils-apple-5.1-r1.ebuild
similarity index 69%
copy from sys-devel/binutils-apple/binutils-apple-6.3.ebuild
copy to sys-devel/binutils-apple/binutils-apple-5.1-r1.ebuild
index 663c668..fd83590 100644
--- a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
+++ b/sys-devel/binutils-apple/binutils-apple-5.1-r1.ebuild
@@ -1,13 +1,13 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI="5"
+EAPI="3"
 
 inherit eutils flag-o-matic toolchain-funcs
 
-LD64=ld64-242
-CCTOOLS_VERSION=870
+LD64=ld64-236.3
+CCTOOLS_VERSION=855
 CCTOOLS=cctools-${CCTOOLS_VERSION}
 LIBUNWIND=libunwind-35.3
 DYLD=dyld-353.2.1
@@ -17,11 +17,13 @@ HOMEPAGE="http://www.opensource.apple.com/darwinsource/";
 SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
        http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
        http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
-       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz";
+       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r0.tar.bz2";
 
 LICENSE="APSL-2"
-KEYWORDS="~x64-macos ~x86-macos"
-IUSE="lto test libcxx"
+#KEYWORDS="~x64-macos ~x86-macos"  # in progress 582782
+IUSE="lto test libcxx multitarget"
 
 RDEPEND="sys-devel/binutils-config
        lto? ( sys-devel/llvm )
@@ -40,9 +42,9 @@ fi
 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
 
 if is_cross ; then
-       SLOT="${CTARGET}-6"
+       SLOT="${CTARGET}-5"
 else
-       SLOT="6"
+       SLOT="5"
 fi
 
 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
@@ -57,21 +59,43 @@ fi
 S=${WORKDIR}
 
 src_prepare() {
+       if use multitarget ; then
+               ewarn "You have enabled support for non-standard target 
architectures"
+               ewarn "using USE=multitarget. This includes experimental 
support for"
+               ewarn "ppc and ppc64 which is a community forward-port from the 
last"
+               ewarn "version of ld64 to officially support PPC."
+
+               if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+                       ewarn "HERE BE DRAGONS! Your system seems to be PPC 
which means that"
+                       ewarn "the actual usability of your Gentoo programs 
will depend on the"
+                       ewarn "above-mentioned experimental PPC support in the 
linker. Be"
+                       ewarn "sure to keep a known-to-work version like 
${PN}-3.2.6 around!"
+               fi
+       fi
+
        cd "${S}"/${LD64}/src
-       cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
-       cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
-
-       epatch "${FILESDIR}"/ld64-236.3-nolto.patch
-       epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
-       epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
-       epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
-       epatch "${FILESDIR}"/ld64-242-gcc.patch
-       epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
-       epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
-       epatch "${FILESDIR}"/ld64-242-noarm.patch
-       epatch "${FILESDIR}"/ld64-241.9-register-names.patch
-       epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
-       epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+       cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+       cp "${S}"/ld64-236.3-Makefile-2 Makefile
+
+       epatch "${S}"/ld64-236.3-nolto.patch
+       epatch "${S}"/ld64-241.9-extraneous-includes.patch
+       epatch "${S}"/ld64-241.9-osatomic.patch
+       epatch "${S}"/ld64-236.3-arm64-fixup.patch
+       epatch "${S}"/ld64-241.9-arm64-cputype.patch
+       epatch "${S}"/ld64-236.3-crashreporter.patch
+       epatch "${S}"/ld64-236.3-nosnapshots.patch
+       epatch "${S}"/ld64-236.3-ppc.patch
+       epatch "${S}"/ld64-236.3-constant-types-2.patch
+       epatch "${S}"/ld64-236.3-gcc-2.patch
+       epatch "${S}"/ld64-241.9-register-names.patch
+       epatch "${S}"/ld64-241.9-get-comm-align.patch
+       epatch "${S}"/ld64-241.9-cc_md5.patch
+       epatch "${S}"/ld64-253.3-delete-warning.patch
+
+       # We used to use our own copy of lto.h, which doesn't require llvm
+       # build-env. Current versions of llvm provide
+       # $EPREFIX/usr/include/llvm-c/lto.h as well as
+       # $EPREFIX/usr/lib/libLTO.{so,dylib}, so we just use these.
 
        # provide missing headers from libunwind and dyld
        mkdir -p include/{mach,mach-o/arm} || die
@@ -89,7 +113,7 @@ src_prepare() {
        cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
        # add alias for newer identifiers, because ld64 uses both but cctools
        # header only defines the older
-       epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+       epatch "${S}"/ld64-236.3-missing-cputypes.patch
 
        # mimic OS X Leopard-style Availability.h macros for libunwind.h on
        # older systems
@@ -99,20 +123,29 @@ src_prepare() {
        local VER_STR="\"@(#)PROGRAM:ld  PROJECT:${LD64} (Gentoo 
${PN}-${PVR})\\n\""
        echo "char ldVersionString[] = ${VER_STR};" > version.cpp
 
-       epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+       epatch "${S}"/ld64-123.2-debug-backtrace.patch
+       if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+               epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+               epatch "${S}"/ld64-127.2-thread_state.patch
+       fi
 
        cd "${S}"/${CCTOOLS}
-       epatch "${FILESDIR}"/${PN}-4.5-as.patch
-       epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
-       epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
-       epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
-       epatch "${FILESDIR}"/cctools-839-intel-retf.patch
-       epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
-       epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
-       epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
-       epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-4.5-as.patch
+       epatch "${S}"/${PN}-5.1-as-dir.patch
+       epatch "${S}"/${PN}-5.1-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-no-headers.patch
+       epatch "${S}"/${PN}-4.0-no-oss-dir.patch
+       epatch "${S}"/${PN}-5.1-nolto.patch
+       epatch "${S}"/cctools-839-intel-retf.patch
+       epatch "${S}"/${PN}-5.1-extraneous-includes.patch
+       epatch "${S}"/${PN}-5.1-otool-stdc.patch
+       epatch "${S}"/${PN}-5.1-constant-types.patch
+       epatch "${S}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-5.1-ppc.patch
+       epatch "${S}"/${PN}-5.1-thread-state-redefined.patch
+       epatch "${S}"/${PN}-5.1-makefile-target-warning.patch
+       epatch "${S}"/${PN}-6.3-lto-prefix.patch
        cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
 
        # do not build profileable libstuff to save compile time
@@ -165,14 +198,10 @@ src_prepare() {
 }
 
 src_configure() {
-       CCTOOLS_LTO=
-       LD64_LTO=0
-       if use lto ; then
-               CCTOOLS_LTO="-DLTO_SUPPORT"
-               LD64_LTO=1
-       fi
+       ENABLE_LTO=0
+       use lto && ENABLE_LTO=1
 
-       if [[ ${CXX} == *clang* ]] ; then
+       if [ "${CXX/*clang*/yes}" = "yes" ] ; then
                if use libcxx ; then
                        append-cxxflags -stdlib=libc++
                        CXXLIB=-stdlib=libc++
@@ -202,20 +231,32 @@ src_configure() {
                CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
        fi
 
+       # if compiling with USE multitarget, extract all the known arches from
+       # create_configure and pass them back to it
+       creco=${LD64}/src/create_configure
+       ARCHS_TO_SUPPORT=""
+       if use multitarget ; then
+               ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \
+                       cut -d\" -f2 | tr ',' ' ')"
+       fi
+
        # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
-       # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
-       # override architectures (there are more arms to add) but we configure
-       # with the default to be in line with Xcode's ld.
        DERIVED_FILE_DIR=${LD64}/src \
-               RC_SUPPORTED_ARCHS="" \
-               ${LD64}/src/create_configure
+               RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \
+               $creco
+
+       # do not depend on MachOFileAbstraction.hpp to define
+       # SUPPORT_ARCH_arm_any because that's not included by every file where
+       # our ppc/arm-optional patch uses it, ld.hpp in particular
+       grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \
+               echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h
 }
 
 compile_ld64() {
        einfo "building ${LD64}"
        cd "${S}"/${LD64}/src
        emake \
-               LTO=${LD64_LTO} \
+               LTO=${ENABLE_LTO} \
                || die "emake failed for ld64"
        use test && emake build_test
 }
@@ -231,7 +272,7 @@ compile_cctools() {
        emake \
                LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
                EFITOOLS= \
-               LTO="${CCTOOLS_LTO}" \
+               ENABLE_LTO=${ENABLE_LTO} \
                COMMON_SUBDIRS='libstuff ar misc otool' \
                SUBDIRS_32= \
                LEGACY= \

diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild 
b/sys-devel/binutils-apple/binutils-apple-6.1-r1.ebuild
similarity index 69%
copy from sys-devel/binutils-apple/binutils-apple-6.3.ebuild
copy to sys-devel/binutils-apple/binutils-apple-6.1-r1.ebuild
index 663c668..24cb641 100644
--- a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
+++ b/sys-devel/binutils-apple/binutils-apple-6.1-r1.ebuild
@@ -1,13 +1,13 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI="5"
+EAPI="3"
 
 inherit eutils flag-o-matic toolchain-funcs
 
-LD64=ld64-242
-CCTOOLS_VERSION=870
+LD64=ld64-241.9
+CCTOOLS_VERSION=862
 CCTOOLS=cctools-${CCTOOLS_VERSION}
 LIBUNWIND=libunwind-35.3
 DYLD=dyld-353.2.1
@@ -17,11 +17,14 @@ HOMEPAGE="http://www.opensource.apple.com/darwinsource/";
 SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
        http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
        http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
-       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz";
+       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r0.tar.bz2";
 
 LICENSE="APSL-2"
-KEYWORDS="~x64-macos ~x86-macos"
-IUSE="lto test libcxx"
+#KEYWORDS="~x64-macos ~x86-macos"  # in progress 582782
+IUSE="lto test libcxx multitarget"
 
 RDEPEND="sys-devel/binutils-config
        lto? ( sys-devel/llvm )
@@ -57,21 +60,43 @@ fi
 S=${WORKDIR}
 
 src_prepare() {
+       if use multitarget ; then
+               ewarn "You have enabled support for non-standard target 
architectures"
+               ewarn "using USE=multitarget. This includes experimental 
support for"
+               ewarn "ppc and ppc64 which is a community forward-port from the 
last"
+               ewarn "version of ld64 to officially support PPC."
+
+               if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+                       ewarn "HERE BE DRAGONS! Your system seems to be PPC 
which means that"
+                       ewarn "the actual usability of your Gentoo programs 
will depend on the"
+                       ewarn "above-mentioned experimental PPC support in the 
linker. Be"
+                       ewarn "sure to keep a known-to-work version like 
${PN}-3.2.6 around!"
+               fi
+       fi
+
        cd "${S}"/${LD64}/src
-       cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
-       cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
-
-       epatch "${FILESDIR}"/ld64-236.3-nolto.patch
-       epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
-       epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
-       epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
-       epatch "${FILESDIR}"/ld64-242-gcc.patch
-       epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
-       epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
-       epatch "${FILESDIR}"/ld64-242-noarm.patch
-       epatch "${FILESDIR}"/ld64-241.9-register-names.patch
-       epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
-       epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+       cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+       cp "${S}"/ld64-236.3-Makefile-2 Makefile
+
+       epatch "${S}"/ld64-236.3-nolto.patch
+       epatch "${S}"/ld64-241.9-extraneous-includes.patch
+       epatch "${S}"/ld64-241.9-osatomic.patch
+       epatch "${S}"/ld64-241.9-arm64-cputype.patch
+       epatch "${S}"/ld64-236.3-crashreporter.patch
+       epatch "${S}"/ld64-241.9-nosnapshots.patch
+       epatch "${S}"/ld64-241.9-ppc.patch
+       epatch "${S}"/ld64-236.3-constant-types-2.patch
+       epatch "${S}"/ld64-241.9-gcc-2.patch
+       epatch "${S}"/ld64-241.9-register-names.patch
+       epatch "${S}"/ld64-241.9-get-comm-align.patch
+       epatch "${S}"/ld64-241.9-cc_md5.patch
+       epatch "${S}"/ld64-241.9-lto-noremarks.patch
+       epatch "${S}"/ld64-253.3-delete-warning.patch
+
+       # We used to use our own copy of lto.h, which doesn't require llvm
+       # build-env. Current versions of llvm provide
+       # $EPREFIX/usr/include/llvm-c/lto.h as well as
+       # $EPREFIX/usr/lib/libLTO.{so,dylib}, so we just use these.
 
        # provide missing headers from libunwind and dyld
        mkdir -p include/{mach,mach-o/arm} || die
@@ -89,7 +114,7 @@ src_prepare() {
        cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
        # add alias for newer identifiers, because ld64 uses both but cctools
        # header only defines the older
-       epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+       epatch "${S}"/ld64-236.3-missing-cputypes.patch
 
        # mimic OS X Leopard-style Availability.h macros for libunwind.h on
        # older systems
@@ -99,20 +124,29 @@ src_prepare() {
        local VER_STR="\"@(#)PROGRAM:ld  PROJECT:${LD64} (Gentoo 
${PN}-${PVR})\\n\""
        echo "char ldVersionString[] = ${VER_STR};" > version.cpp
 
-       epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+       epatch "${S}"/ld64-123.2-debug-backtrace.patch
+       if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+               epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+               epatch "${S}"/ld64-127.2-thread_state.patch
+       fi
 
        cd "${S}"/${CCTOOLS}
-       epatch "${FILESDIR}"/${PN}-4.5-as.patch
-       epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
-       epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
-       epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
-       epatch "${FILESDIR}"/cctools-839-intel-retf.patch
-       epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
-       epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
-       epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
-       epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-4.5-as.patch
+       epatch "${S}"/${PN}-5.1-as-dir.patch
+       epatch "${S}"/${PN}-5.1-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-no-headers.patch
+       epatch "${S}"/${PN}-4.0-no-oss-dir.patch
+       epatch "${S}"/${PN}-5.1-nolto.patch
+       epatch "${S}"/cctools-839-intel-retf.patch
+       epatch "${S}"/${PN}-5.1-extraneous-includes.patch
+       epatch "${S}"/${PN}-5.1-otool-stdc.patch
+       epatch "${S}"/${PN}-5.1-constant-types.patch
+       epatch "${S}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-5.1-ppc.patch
+       epatch "${S}"/${PN}-5.1-thread-state-redefined.patch
+       epatch "${S}"/${PN}-5.1-makefile-target-warning.patch
+       epatch "${S}"/${PN}-6.3-lto-prefix.patch
        cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
 
        # do not build profileable libstuff to save compile time
@@ -165,14 +199,10 @@ src_prepare() {
 }
 
 src_configure() {
-       CCTOOLS_LTO=
-       LD64_LTO=0
-       if use lto ; then
-               CCTOOLS_LTO="-DLTO_SUPPORT"
-               LD64_LTO=1
-       fi
+       ENABLE_LTO=0
+       use lto && ENABLE_LTO=1
 
-       if [[ ${CXX} == *clang* ]] ; then
+       if [ "${CXX/*clang*/yes}" = "yes" ] ; then
                if use libcxx ; then
                        append-cxxflags -stdlib=libc++
                        CXXLIB=-stdlib=libc++
@@ -202,20 +232,32 @@ src_configure() {
                CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
        fi
 
+       # if compiling with USE multitarget, extract all the known arches from
+       # create_configure and pass them back to it
+       creco=${LD64}/src/create_configure
+       ARCHS_TO_SUPPORT=""
+       if use multitarget ; then
+               ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \
+                       cut -d\" -f2 | tr ',' ' ')"
+       fi
+
        # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
-       # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
-       # override architectures (there are more arms to add) but we configure
-       # with the default to be in line with Xcode's ld.
        DERIVED_FILE_DIR=${LD64}/src \
-               RC_SUPPORTED_ARCHS="" \
-               ${LD64}/src/create_configure
+               RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \
+               $creco
+
+       # do not depend on MachOFileAbstraction.hpp to define
+       # SUPPORT_ARCH_arm_any because that's not included by every file where
+       # our ppc/arm-optional patch uses it, ld.hpp in particular
+       grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \
+               echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h
 }
 
 compile_ld64() {
        einfo "building ${LD64}"
        cd "${S}"/${LD64}/src
        emake \
-               LTO=${LD64_LTO} \
+               LTO=${ENABLE_LTO} \
                || die "emake failed for ld64"
        use test && emake build_test
 }
@@ -231,7 +273,7 @@ compile_cctools() {
        emake \
                LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
                EFITOOLS= \
-               LTO="${CCTOOLS_LTO}" \
+               ENABLE_LTO=${ENABLE_LTO} \
                COMMON_SUBDIRS='libstuff ar misc otool' \
                SUBDIRS_32= \
                LEGACY= \

diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild 
b/sys-devel/binutils-apple/binutils-apple-6.3-r1.ebuild
similarity index 72%
copy from sys-devel/binutils-apple/binutils-apple-6.3.ebuild
copy to sys-devel/binutils-apple/binutils-apple-6.3-r1.ebuild
index 663c668..1b61176 100644
--- a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
+++ b/sys-devel/binutils-apple/binutils-apple-6.3-r1.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$
 
@@ -17,11 +17,15 @@ HOMEPAGE="http://www.opensource.apple.com/darwinsource/";
 SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
        http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
        http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
-       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz";
+       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r0.tar.bz2";
 
 LICENSE="APSL-2"
-KEYWORDS="~x64-macos ~x86-macos"
-IUSE="lto test libcxx"
+#KEYWORDS="~x64-macos ~x86-macos"  # in progress 582782
+IUSE="lto test libcxx multitarget"
 
 RDEPEND="sys-devel/binutils-config
        lto? ( sys-devel/llvm )
@@ -57,21 +61,36 @@ fi
 S=${WORKDIR}
 
 src_prepare() {
+       if use multitarget ; then
+               ewarn "You have enabled support for non-standard target 
architectures"
+               ewarn "using USE=multitarget. This includes experimental 
support for"
+               ewarn "ppc and ppc64 which is a community forward-port from the 
last"
+               ewarn "version of ld64 to officially support PPC."
+
+               if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+                       ewarn "HERE BE DRAGONS! Your system seems to be PPC 
which means that"
+                       ewarn "the actual usability of your Gentoo programs 
will depend on the"
+                       ewarn "above-mentioned experimental PPC support in the 
linker. Be"
+                       ewarn "sure to keep a known-to-work version like 
${PN}-3.2.6 around!"
+               fi
+       fi
+
        cd "${S}"/${LD64}/src
-       cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
-       cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
-
-       epatch "${FILESDIR}"/ld64-236.3-nolto.patch
-       epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
-       epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
-       epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
-       epatch "${FILESDIR}"/ld64-242-gcc.patch
-       epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
-       epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
-       epatch "${FILESDIR}"/ld64-242-noarm.patch
-       epatch "${FILESDIR}"/ld64-241.9-register-names.patch
-       epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
-       epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+       cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+       cp "${S}"/ld64-236.3-Makefile-2 Makefile
+
+       epatch "${S}"/ld64-236.3-nolto.patch
+       epatch "${S}"/ld64-241.9-extraneous-includes.patch
+       epatch "${S}"/ld64-241.9-osatomic.patch
+       epatch "${S}"/ld64-236.3-crashreporter.patch
+       epatch "${S}"/ld64-241.9-nosnapshots.patch
+       epatch "${S}"/ld64-242-ppc.patch
+       epatch "${S}"/ld64-236.3-constant-types-2.patch
+       epatch "${S}"/ld64-242-gcc-2.patch
+       epatch "${S}"/ld64-241.9-register-names.patch
+       epatch "${S}"/ld64-241.9-get-comm-align.patch
+       epatch "${S}"/ld64-241.9-cc_md5.patch
+       epatch "${S}"/ld64-253.3-delete-warning.patch
 
        # provide missing headers from libunwind and dyld
        mkdir -p include/{mach,mach-o/arm} || die
@@ -89,7 +108,7 @@ src_prepare() {
        cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
        # add alias for newer identifiers, because ld64 uses both but cctools
        # header only defines the older
-       epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+       epatch "${S}"/ld64-236.3-missing-cputypes.patch
 
        # mimic OS X Leopard-style Availability.h macros for libunwind.h on
        # older systems
@@ -99,20 +118,28 @@ src_prepare() {
        local VER_STR="\"@(#)PROGRAM:ld  PROJECT:${LD64} (Gentoo 
${PN}-${PVR})\\n\""
        echo "char ldVersionString[] = ${VER_STR};" > version.cpp
 
-       epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+       epatch "${S}"/ld64-123.2-debug-backtrace.patch
+       if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+               epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+               epatch "${S}"/ld64-127.2-thread_state.patch
+       fi
 
        cd "${S}"/${CCTOOLS}
-       epatch "${FILESDIR}"/${PN}-4.5-as.patch
-       epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
-       epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
-       epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
-       epatch "${FILESDIR}"/cctools-839-intel-retf.patch
-       epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
-       epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
-       epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
-       epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-4.5-as.patch
+       epatch "${S}"/${PN}-5.1-as-dir.patch
+       epatch "${S}"/${PN}-5.1-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-no-headers.patch
+       epatch "${S}"/${PN}-4.0-no-oss-dir.patch
+       epatch "${S}"/cctools-839-intel-retf.patch
+       epatch "${S}"/${PN}-5.1-extraneous-includes.patch
+       epatch "${S}"/${PN}-5.1-otool-stdc.patch
+       epatch "${S}"/${PN}-5.1-constant-types.patch
+       epatch "${S}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-5.1-ppc.patch
+       epatch "${S}"/${PN}-5.1-thread-state-redefined.patch
+       epatch "${S}"/${PN}-5.1-makefile-target-warning.patch
+       epatch "${S}"/${PN}-6.3-lto-prefix.patch
        cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
 
        # do not build profileable libstuff to save compile time
@@ -165,12 +192,8 @@ src_prepare() {
 }
 
 src_configure() {
-       CCTOOLS_LTO=
-       LD64_LTO=0
-       if use lto ; then
-               CCTOOLS_LTO="-DLTO_SUPPORT"
-               LD64_LTO=1
-       fi
+       ENABLE_LTO=0
+       use lto && ENABLE_LTO=1
 
        if [[ ${CXX} == *clang* ]] ; then
                if use libcxx ; then
@@ -202,20 +225,32 @@ src_configure() {
                CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
        fi
 
+       # if compiling with USE multitarget, extract all the known arches from
+       # create_configure and pass them back to it
+       creco=${LD64}/src/create_configure
+       ARCHS_TO_SUPPORT=""
+       if use multitarget ; then
+               ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \
+                       cut -d\" -f2 | tr ',' ' ')"
+       fi
+
        # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
-       # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
-       # override architectures (there are more arms to add) but we configure
-       # with the default to be in line with Xcode's ld.
        DERIVED_FILE_DIR=${LD64}/src \
-               RC_SUPPORTED_ARCHS="" \
-               ${LD64}/src/create_configure
+               RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \
+               $creco
+
+       # do not depend on MachOFileAbstraction.hpp to define
+       # SUPPORT_ARCH_arm_any because that's not included by every file where
+       # our ppc/arm-optional patch uses it, ld.hpp in particular
+       grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \
+               echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h
 }
 
 compile_ld64() {
        einfo "building ${LD64}"
        cd "${S}"/${LD64}/src
        emake \
-               LTO=${LD64_LTO} \
+               LTO=${ENABLE_LTO} \
                || die "emake failed for ld64"
        use test && emake build_test
 }
@@ -231,7 +266,7 @@ compile_cctools() {
        emake \
                LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
                EFITOOLS= \
-               LTO="${CCTOOLS_LTO}" \
+               ENABLE_LTO="${ENABLE_LTO}" \
                COMMON_SUBDIRS='libstuff ar misc otool' \
                SUBDIRS_32= \
                LEGACY= \

diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild 
b/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
index 663c668..99999f6 100644
--- a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
+++ b/sys-devel/binutils-apple/binutils-apple-6.3.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$
 

diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild 
b/sys-devel/binutils-apple/binutils-apple-7.0.ebuild
similarity index 64%
copy from sys-devel/binutils-apple/binutils-apple-6.3.ebuild
copy to sys-devel/binutils-apple/binutils-apple-7.0.ebuild
index 663c668..f44a4bc 100644
--- a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
+++ b/sys-devel/binutils-apple/binutils-apple-7.0.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$
 
@@ -6,30 +6,43 @@ EAPI="5"
 
 inherit eutils flag-o-matic toolchain-funcs
 
-LD64=ld64-242
-CCTOOLS_VERSION=870
+LD64=ld64-253.3
+CCTOOLS_VERSION=877.5
 CCTOOLS=cctools-${CCTOOLS_VERSION}
 LIBUNWIND=libunwind-35.3
-DYLD=dyld-353.2.1
+DYLD=dyld-360.14
 
 DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
 HOMEPAGE="http://www.opensource.apple.com/darwinsource/";
 SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
        http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
        http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
-       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz";
+       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.0-r0.tar.bz2";
 
 LICENSE="APSL-2"
-KEYWORDS="~x64-macos ~x86-macos"
-IUSE="lto test libcxx"
-
+#KEYWORDS="~x64-macos ~x86-macos" # in progress 582782
+IUSE="test multitarget"
+
+# ld64 can now only be compiled using llvm and libc++ since it massivley uses
+# C++11 language fatures. *But additionally* the as driver now defaults to
+# calling clang as the assembler on many platforms. This can be disabled using
+# -Wa,-Q but since it's default we make llvm a static runtime dependency.
+
+# Also, llvm lto and disassembler interfaces are now widely used in cctools.
+# Since we cannot compile with gcc any more and every llvm since 3.4 has
+# provided those interfaces, we no longer support disabling them. That
+# indirectly makes xar a static runtime dependency.
 RDEPEND="sys-devel/binutils-config
-       lto? ( sys-devel/llvm )
-       libcxx? ( sys-libs/libcxx )"
+       app-arch/xar
+       sys-devel/llvm
+       sys-libs/libcxx"
 DEPEND="${RDEPEND}
-       test? ( >=dev-lang/perl-5.8.8 )
-       || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )
-       libcxx? ( sys-devel/llvm )"
+       test? ( >=dev-lang/perl-5.8.8 )"
 
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
@@ -40,9 +53,9 @@ fi
 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
 
 if is_cross ; then
-       SLOT="${CTARGET}-6"
+       SLOT="${CTARGET}-7"
 else
-       SLOT="6"
+       SLOT="7"
 fi
 
 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
@@ -57,21 +70,35 @@ fi
 S=${WORKDIR}
 
 src_prepare() {
+       if use multitarget ; then
+               ewarn "You have enabled support for non-standard target 
architectures"
+               ewarn "using USE=multitarget. This includes experimental 
support for"
+               ewarn "ppc and ppc64 which is a community forward-port from the 
last"
+               ewarn "version of ld64 to officially support PPC."
+
+               if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+                       ewarn "HERE BE DRAGONS! Your system seems to be PPC 
which means that"
+                       ewarn "the actual usability of your Gentoo programs 
will depend on the"
+                       ewarn "above-mentioned experimental PPC support in the 
linker. Be"
+                       ewarn "sure to keep a known-to-work version like 
${PN}-3.2.6 around!"
+               fi
+       fi
+
        cd "${S}"/${LD64}/src
-       cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
-       cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
-
-       epatch "${FILESDIR}"/ld64-236.3-nolto.patch
-       epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
-       epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
-       epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
-       epatch "${FILESDIR}"/ld64-242-gcc.patch
-       epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
-       epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
-       epatch "${FILESDIR}"/ld64-242-noarm.patch
-       epatch "${FILESDIR}"/ld64-241.9-register-names.patch
-       epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
-       epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+       cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+       cp "${S}"/ld64-253.3-Makefile-2 Makefile
+
+       epatch "${S}"/ld64-241.9-extraneous-includes.patch
+       epatch "${S}"/ld64-241.9-osatomic.patch
+       epatch "${S}"/ld64-236.3-crashreporter.patch
+       epatch "${S}"/ld64-253.3-nosnapshots.patch
+       epatch "${S}"/ld64-253.3-ppc.patch
+       epatch "${S}"/ld64-236.3-constant-types-2.patch
+       epatch "${S}"/ld64-241.9-register-names.patch
+       epatch "${S}"/ld64-241.9-get-comm-align.patch
+       epatch "${S}"/ld64-241.9-cc_md5.patch
+       epatch "${S}"/ld64-253.3-make_pair.patch
+       epatch "${S}"/ld64-253.3-delete-warning.patch
 
        # provide missing headers from libunwind and dyld
        mkdir -p include/{mach,mach-o/arm} || die
@@ -89,7 +116,7 @@ src_prepare() {
        cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
        # add alias for newer identifiers, because ld64 uses both but cctools
        # header only defines the older
-       epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+       epatch "${S}"/ld64-236.3-missing-cputypes.patch
 
        # mimic OS X Leopard-style Availability.h macros for libunwind.h on
        # older systems
@@ -99,20 +126,29 @@ src_prepare() {
        local VER_STR="\"@(#)PROGRAM:ld  PROJECT:${LD64} (Gentoo 
${PN}-${PVR})\\n\""
        echo "char ldVersionString[] = ${VER_STR};" > version.cpp
 
-       epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+       epatch "${S}"/ld64-123.2-debug-backtrace.patch
+       if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+               epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+               epatch "${S}"/ld64-127.2-thread_state.patch
+       fi
 
        cd "${S}"/${CCTOOLS}
-       epatch "${FILESDIR}"/${PN}-4.5-as.patch
-       epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
-       epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
-       epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
-       epatch "${FILESDIR}"/cctools-839-intel-retf.patch
-       epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
-       epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
-       epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
-       epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-4.5-as.patch
+       epatch "${S}"/${PN}-5.1-as-dir.patch
+       epatch "${S}"/${PN}-5.1-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-no-headers.patch
+       epatch "${S}"/${PN}-4.0-no-oss-dir.patch
+       epatch "${S}"/cctools-839-intel-retf.patch
+       epatch "${S}"/${PN}-5.1-extraneous-includes.patch
+       #epatch "${S}"/${PN}-5.1-otool-stdc.patch
+       epatch "${S}"/${PN}-5.1-constant-types.patch
+       epatch "${S}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-5.1-ppc.patch
+       epatch "${S}"/${PN}-5.1-thread-state-redefined.patch
+       epatch "${S}"/${PN}-5.1-makefile-target-warning.patch
+       epatch "${S}"/${PN}-7.0-lto-prefix.patch
+       epatch "${S}"/${PN}-7.0-clang-as.patch
        cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
 
        # do not build profileable libstuff to save compile time
@@ -165,27 +201,6 @@ src_prepare() {
 }
 
 src_configure() {
-       CCTOOLS_LTO=
-       LD64_LTO=0
-       if use lto ; then
-               CCTOOLS_LTO="-DLTO_SUPPORT"
-               LD64_LTO=1
-       fi
-
-       if [[ ${CXX} == *clang* ]] ; then
-               if use libcxx ; then
-                       append-cxxflags -stdlib=libc++
-                       CXXLIB=-stdlib=libc++
-               else
-                       # force libstdc++ for systems where libc++ is default 
(OS X 10.9+?)
-                       append-cxxflags -stdlib=libstdc++
-                       CXXLIB=-stdlib=libstdc++
-               fi
-       else
-               use libcxx && \
-                       ewarn "libcxx only available with clang and your C++ 
compiler ($CXX) does not seem to be clang"
-       fi
-
        # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
        # what we want)
        append-cppflags -DNDEBUG
@@ -202,21 +217,31 @@ src_configure() {
                CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
        fi
 
+       # if compiling with USE multitarget, extract all the known arches from
+       # create_configure and pass them back to it
+       creco=${LD64}/src/create_configure
+       ARCHS_TO_SUPPORT=""
+       if use multitarget ; then
+               ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \
+                       cut -d\" -f2 | tr ',' ' ')"
+       fi
+
        # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
-       # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
-       # override architectures (there are more arms to add) but we configure
-       # with the default to be in line with Xcode's ld.
        DERIVED_FILE_DIR=${LD64}/src \
-               RC_SUPPORTED_ARCHS="" \
-               ${LD64}/src/create_configure
+               RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \
+               $creco
+
+       # do not depend on MachOFileAbstraction.hpp to define
+       # SUPPORT_ARCH_arm_any because that's not included by every file where
+       # our ppc/arm-optional patch uses it, ld.hpp in particular
+       grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \
+               echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h
 }
 
 compile_ld64() {
        einfo "building ${LD64}"
        cd "${S}"/${LD64}/src
-       emake \
-               LTO=${LD64_LTO} \
-               || die "emake failed for ld64"
+       emake || die "emake failed for ld64"
        use test && emake build_test
 }
 
@@ -231,14 +256,12 @@ compile_cctools() {
        emake \
                LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
                EFITOOLS= \
-               LTO="${CCTOOLS_LTO}" \
                COMMON_SUBDIRS='libstuff ar misc otool' \
                SUBDIRS_32= \
                LEGACY= \
                RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
                RC_CFLAGS="${CFLAGS}" \
                OFLAG="${CCTOOLS_OFLAG}" \
-               CXXLIB="${CXXLIB}" \
                DSYMUTIL=": disabled: dsymutil" \
                -j1 \
                || die "emake failed for the cctools"
@@ -246,7 +269,7 @@ compile_cctools() {
        emake \
                BUILD_OBSOLETE_ARCH= \
                RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
-               RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" 
${CFLAGS}" \
+               RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" 
-DCLANGDIR=\"\\\"${EPREFIX}/usr/bin/\\\"\" ${CFLAGS}" \
                OFLAG="${CCTOOLS_OFLAG}" \
                DSYMUTIL=": disabled: dsymutil" \
                || die "emake failed for as"
@@ -322,8 +345,8 @@ src_test() {
                BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \
                ARCH="$(arch)" \
                LD="${S}"/${LD64}/src/ld64 \
-               CC="clang -ccc-install-dir $PWD" \
-               CXX="clang++ -ccc-install-dir $PWD" \
+               CC="${CC} -ccc-install-dir $PWD" \
+               CXX="${CXX} -ccc-install-dir $PWD" \
                OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \
                | perl ../bin/result-filter.pl
 }

diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild 
b/sys-devel/binutils-apple/binutils-apple-7.1.ebuild
similarity index 64%
copy from sys-devel/binutils-apple/binutils-apple-6.3.ebuild
copy to sys-devel/binutils-apple/binutils-apple-7.1.ebuild
index 663c668..f8e1772 100644
--- a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
+++ b/sys-devel/binutils-apple/binutils-apple-7.1.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$
 
@@ -6,30 +6,44 @@ EAPI="5"
 
 inherit eutils flag-o-matic toolchain-funcs
 
-LD64=ld64-242
-CCTOOLS_VERSION=870
+LD64=ld64-253.6
+CCTOOLS_VERSION=877.7
 CCTOOLS=cctools-${CCTOOLS_VERSION}
 LIBUNWIND=libunwind-35.3
-DYLD=dyld-353.2.1
+DYLD=dyld-360.17
 
 DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
 HOMEPAGE="http://www.opensource.apple.com/darwinsource/";
 SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
        http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
        http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
-       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz";
+       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.0-r0.tar.bz2";
 
-LICENSE="APSL-2"
-KEYWORDS="~x64-macos ~x86-macos"
-IUSE="lto test libcxx"
 
+LICENSE="APSL-2"
+#KEYWORDS="~x64-macos ~x86-macos"  # in progress 582782
+IUSE="test multitarget"
+
+# ld64 can now only be compiled using llvm and libc++ since it massivley uses
+# C++11 language fatures. *But additionally* the as driver now defaults to
+# calling clang as the assembler on many platforms. This can be disabled using
+# -Wa,-Q but since it's default we make llvm a static runtime dependency.
+
+# Also, llvm lto and disassembler interfaces are now widely used in cctools.
+# Since we cannot compile with gcc any more and every llvm since 3.4 has
+# provided those interfaces, we no longer support disabling them. That
+# indirectly makes xar a static runtime dependency.
 RDEPEND="sys-devel/binutils-config
-       lto? ( sys-devel/llvm )
-       libcxx? ( sys-libs/libcxx )"
+       app-arch/xar
+       sys-devel/llvm
+       sys-libs/libcxx"
 DEPEND="${RDEPEND}
-       test? ( >=dev-lang/perl-5.8.8 )
-       || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )
-       libcxx? ( sys-devel/llvm )"
+       test? ( >=dev-lang/perl-5.8.8 )"
 
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
@@ -40,9 +54,9 @@ fi
 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
 
 if is_cross ; then
-       SLOT="${CTARGET}-6"
+       SLOT="${CTARGET}-7"
 else
-       SLOT="6"
+       SLOT="7"
 fi
 
 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
@@ -57,21 +71,35 @@ fi
 S=${WORKDIR}
 
 src_prepare() {
+       if use multitarget ; then
+               ewarn "You have enabled support for non-standard target 
architectures"
+               ewarn "using USE=multitarget. This includes experimental 
support for"
+               ewarn "ppc and ppc64 which is a community forward-port from the 
last"
+               ewarn "version of ld64 to officially support PPC."
+
+               if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+                       ewarn "HERE BE DRAGONS! Your system seems to be PPC 
which means that"
+                       ewarn "the actual usability of your Gentoo programs 
will depend on the"
+                       ewarn "above-mentioned experimental PPC support in the 
linker. Be"
+                       ewarn "sure to keep a known-to-work version like 
${PN}-3.2.6 around!"
+               fi
+       fi
+
        cd "${S}"/${LD64}/src
-       cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
-       cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
-
-       epatch "${FILESDIR}"/ld64-236.3-nolto.patch
-       epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
-       epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
-       epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
-       epatch "${FILESDIR}"/ld64-242-gcc.patch
-       epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
-       epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
-       epatch "${FILESDIR}"/ld64-242-noarm.patch
-       epatch "${FILESDIR}"/ld64-241.9-register-names.patch
-       epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
-       epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+       cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+       cp "${S}"/ld64-253.3-Makefile-2 Makefile
+
+       epatch "${S}"/ld64-241.9-extraneous-includes.patch
+       epatch "${S}"/ld64-241.9-osatomic.patch
+       epatch "${S}"/ld64-236.3-crashreporter.patch
+       epatch "${S}"/ld64-253.3-nosnapshots.patch
+       epatch "${S}"/ld64-253.3-ppc.patch
+       epatch "${S}"/ld64-236.3-constant-types-2.patch
+       epatch "${S}"/ld64-241.9-register-names.patch
+       epatch "${S}"/ld64-241.9-get-comm-align.patch
+       epatch "${S}"/ld64-241.9-cc_md5.patch
+       epatch "${S}"/ld64-253.3-make_pair.patch
+       epatch "${S}"/ld64-253.3-delete-warning.patch
 
        # provide missing headers from libunwind and dyld
        mkdir -p include/{mach,mach-o/arm} || die
@@ -89,7 +117,7 @@ src_prepare() {
        cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
        # add alias for newer identifiers, because ld64 uses both but cctools
        # header only defines the older
-       epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+       epatch "${S}"/ld64-236.3-missing-cputypes.patch
 
        # mimic OS X Leopard-style Availability.h macros for libunwind.h on
        # older systems
@@ -99,20 +127,29 @@ src_prepare() {
        local VER_STR="\"@(#)PROGRAM:ld  PROJECT:${LD64} (Gentoo 
${PN}-${PVR})\\n\""
        echo "char ldVersionString[] = ${VER_STR};" > version.cpp
 
-       epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+       epatch "${S}"/ld64-123.2-debug-backtrace.patch
+       if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+               epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+               epatch "${S}"/ld64-127.2-thread_state.patch
+       fi
 
        cd "${S}"/${CCTOOLS}
-       epatch "${FILESDIR}"/${PN}-4.5-as.patch
-       epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
-       epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
-       epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
-       epatch "${FILESDIR}"/cctools-839-intel-retf.patch
-       epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
-       epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
-       epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
-       epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-4.5-as.patch
+       epatch "${S}"/${PN}-5.1-as-dir.patch
+       epatch "${S}"/${PN}-5.1-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-no-headers.patch
+       epatch "${S}"/${PN}-4.0-no-oss-dir.patch
+       epatch "${S}"/cctools-839-intel-retf.patch
+       epatch "${S}"/${PN}-5.1-extraneous-includes.patch
+       #epatch "${S}"/${PN}-5.1-otool-stdc.patch
+       epatch "${S}"/${PN}-5.1-constant-types.patch
+       epatch "${S}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-5.1-ppc.patch
+       epatch "${S}"/${PN}-5.1-thread-state-redefined.patch
+       epatch "${S}"/${PN}-5.1-makefile-target-warning.patch
+       epatch "${S}"/${PN}-7.0-lto-prefix.patch
+       epatch "${S}"/${PN}-7.0-clang-as.patch
        cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
 
        # do not build profileable libstuff to save compile time
@@ -165,27 +202,6 @@ src_prepare() {
 }
 
 src_configure() {
-       CCTOOLS_LTO=
-       LD64_LTO=0
-       if use lto ; then
-               CCTOOLS_LTO="-DLTO_SUPPORT"
-               LD64_LTO=1
-       fi
-
-       if [[ ${CXX} == *clang* ]] ; then
-               if use libcxx ; then
-                       append-cxxflags -stdlib=libc++
-                       CXXLIB=-stdlib=libc++
-               else
-                       # force libstdc++ for systems where libc++ is default 
(OS X 10.9+?)
-                       append-cxxflags -stdlib=libstdc++
-                       CXXLIB=-stdlib=libstdc++
-               fi
-       else
-               use libcxx && \
-                       ewarn "libcxx only available with clang and your C++ 
compiler ($CXX) does not seem to be clang"
-       fi
-
        # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
        # what we want)
        append-cppflags -DNDEBUG
@@ -202,21 +218,31 @@ src_configure() {
                CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
        fi
 
+       # if compiling with USE multitarget, extract all the known arches from
+       # create_configure and pass them back to it
+       creco=${LD64}/src/create_configure
+       ARCHS_TO_SUPPORT=""
+       if use multitarget ; then
+               ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \
+                       cut -d\" -f2 | tr ',' ' ')"
+       fi
+
        # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
-       # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
-       # override architectures (there are more arms to add) but we configure
-       # with the default to be in line with Xcode's ld.
        DERIVED_FILE_DIR=${LD64}/src \
-               RC_SUPPORTED_ARCHS="" \
-               ${LD64}/src/create_configure
+               RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \
+               $creco
+
+       # do not depend on MachOFileAbstraction.hpp to define
+       # SUPPORT_ARCH_arm_any because that's not included by every file where
+       # our ppc/arm-optional patch uses it, ld.hpp in particular
+       grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \
+               echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h
 }
 
 compile_ld64() {
        einfo "building ${LD64}"
        cd "${S}"/${LD64}/src
-       emake \
-               LTO=${LD64_LTO} \
-               || die "emake failed for ld64"
+       emake || die "emake failed for ld64"
        use test && emake build_test
 }
 
@@ -231,14 +257,12 @@ compile_cctools() {
        emake \
                LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
                EFITOOLS= \
-               LTO="${CCTOOLS_LTO}" \
                COMMON_SUBDIRS='libstuff ar misc otool' \
                SUBDIRS_32= \
                LEGACY= \
                RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
                RC_CFLAGS="${CFLAGS}" \
                OFLAG="${CCTOOLS_OFLAG}" \
-               CXXLIB="${CXXLIB}" \
                DSYMUTIL=": disabled: dsymutil" \
                -j1 \
                || die "emake failed for the cctools"
@@ -246,7 +270,7 @@ compile_cctools() {
        emake \
                BUILD_OBSOLETE_ARCH= \
                RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
-               RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" 
${CFLAGS}" \
+               RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" 
-DCLANGDIR=\"\\\"${EPREFIX}/usr/bin/\\\"\" ${CFLAGS}" \
                OFLAG="${CCTOOLS_OFLAG}" \
                DSYMUTIL=": disabled: dsymutil" \
                || die "emake failed for as"
@@ -322,8 +346,8 @@ src_test() {
                BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \
                ARCH="$(arch)" \
                LD="${S}"/${LD64}/src/ld64 \
-               CC="clang -ccc-install-dir $PWD" \
-               CXX="clang++ -ccc-install-dir $PWD" \
+               CC="${CC} -ccc-install-dir $PWD" \
+               CXX="${CXX} -ccc-install-dir $PWD" \
                OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \
                | perl ../bin/result-filter.pl
 }

diff --git a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild 
b/sys-devel/binutils-apple/binutils-apple-7.2.ebuild
similarity index 64%
copy from sys-devel/binutils-apple/binutils-apple-6.3.ebuild
copy to sys-devel/binutils-apple/binutils-apple-7.2.ebuild
index 663c668..275f184 100644
--- a/sys-devel/binutils-apple/binutils-apple-6.3.ebuild
+++ b/sys-devel/binutils-apple/binutils-apple-7.2.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$
 
@@ -6,30 +6,43 @@ EAPI="5"
 
 inherit eutils flag-o-matic toolchain-funcs
 
-LD64=ld64-242
-CCTOOLS_VERSION=870
+LD64=ld64-253.9
+CCTOOLS_VERSION=877.8
 CCTOOLS=cctools-${CCTOOLS_VERSION}
 LIBUNWIND=libunwind-35.3
-DYLD=dyld-353.2.1
+DYLD=dyld-360.18
 
 DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
 HOMEPAGE="http://www.opensource.apple.com/darwinsource/";
 SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
        http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
        http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
-       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz";
+       http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r0.tar.bz2
+       http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.0-r0.tar.bz2";
 
 LICENSE="APSL-2"
-KEYWORDS="~x64-macos ~x86-macos"
-IUSE="lto test libcxx"
-
+#KEYWORDS="~x64-macos ~x86-macos"  # in progress 582782
+IUSE="test multitarget"
+
+# ld64 can now only be compiled using llvm and libc++ since it massivley uses
+# C++11 language fatures. *But additionally* the as driver now defaults to
+# calling clang as the assembler on many platforms. This can be disabled using
+# -Wa,-Q but since it's default we make llvm a static runtime dependency.
+
+# Also, llvm lto and disassembler interfaces are now widely used in cctools.
+# Since we cannot compile with gcc any more and every llvm since 3.4 has
+# provided those interfaces, we no longer support disabling them. That
+# indirectly makes xar a static runtime dependency.
 RDEPEND="sys-devel/binutils-config
-       lto? ( sys-devel/llvm )
-       libcxx? ( sys-libs/libcxx )"
+       app-arch/xar
+       sys-devel/llvm
+       sys-libs/libcxx"
 DEPEND="${RDEPEND}
-       test? ( >=dev-lang/perl-5.8.8 )
-       || ( >=sys-devel/gcc-apple-4.2.1 sys-devel/llvm )
-       libcxx? ( sys-devel/llvm )"
+       test? ( >=dev-lang/perl-5.8.8 )"
 
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} == ${CHOST} ]] ; then
@@ -40,9 +53,9 @@ fi
 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
 
 if is_cross ; then
-       SLOT="${CTARGET}-6"
+       SLOT="${CTARGET}-7"
 else
-       SLOT="6"
+       SLOT="7"
 fi
 
 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
@@ -57,21 +70,35 @@ fi
 S=${WORKDIR}
 
 src_prepare() {
+       if use multitarget ; then
+               ewarn "You have enabled support for non-standard target 
architectures"
+               ewarn "using USE=multitarget. This includes experimental 
support for"
+               ewarn "ppc and ppc64 which is a community forward-port from the 
last"
+               ewarn "version of ld64 to officially support PPC."
+
+               if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+                       ewarn "HERE BE DRAGONS! Your system seems to be PPC 
which means that"
+                       ewarn "the actual usability of your Gentoo programs 
will depend on the"
+                       ewarn "above-mentioned experimental PPC support in the 
linker. Be"
+                       ewarn "sure to keep a known-to-work version like 
${PN}-3.2.6 around!"
+               fi
+       fi
+
        cd "${S}"/${LD64}/src
-       cp "${FILESDIR}"/ld64-136-compile_stubs.h ld/compile_stubs.h
-       cp "${FILESDIR}"/ld64-236.3-Makefile Makefile
-
-       epatch "${FILESDIR}"/ld64-236.3-nolto.patch
-       epatch "${FILESDIR}"/ld64-241.9-extraneous-includes.patch
-       epatch "${FILESDIR}"/ld64-241.9-atomic-volatile.patch
-       epatch "${FILESDIR}"/ld64-236.3-crashreporter.patch
-       epatch "${FILESDIR}"/ld64-242-gcc.patch
-       epatch "${FILESDIR}"/ld64-236.3-constant-types.patch
-       epatch "${FILESDIR}"/ld64-241.9-nosnapshots.patch
-       epatch "${FILESDIR}"/ld64-242-noarm.patch
-       epatch "${FILESDIR}"/ld64-241.9-register-names.patch
-       epatch "${FILESDIR}"/ld64-241.9-get-comm-align.patch
-       epatch "${FILESDIR}"/ld64-241.9-cc_md5.patch
+       cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h
+       cp "${S}"/ld64-253.3-Makefile-2 Makefile
+
+       epatch "${S}"/ld64-241.9-extraneous-includes.patch
+       epatch "${S}"/ld64-241.9-osatomic.patch
+       epatch "${S}"/ld64-236.3-crashreporter.patch
+       epatch "${S}"/ld64-253.3-nosnapshots.patch
+       epatch "${S}"/ld64-253.3-ppc.patch
+       epatch "${S}"/ld64-236.3-constant-types-2.patch
+       epatch "${S}"/ld64-241.9-register-names.patch
+       epatch "${S}"/ld64-241.9-get-comm-align.patch
+       epatch "${S}"/ld64-241.9-cc_md5.patch
+       epatch "${S}"/ld64-253.3-make_pair.patch
+       epatch "${S}"/ld64-253.3-delete-warning.patch
 
        # provide missing headers from libunwind and dyld
        mkdir -p include/{mach,mach-o/arm} || die
@@ -89,7 +116,7 @@ src_prepare() {
        cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h
        # add alias for newer identifiers, because ld64 uses both but cctools
        # header only defines the older
-       epatch "${FILESDIR}"/ld64-236.3-missing-cputypes.patch
+       epatch "${S}"/ld64-236.3-missing-cputypes.patch
 
        # mimic OS X Leopard-style Availability.h macros for libunwind.h on
        # older systems
@@ -99,20 +126,29 @@ src_prepare() {
        local VER_STR="\"@(#)PROGRAM:ld  PROJECT:${LD64} (Gentoo 
${PN}-${PVR})\\n\""
        echo "char ldVersionString[] = ${VER_STR};" > version.cpp
 
-       epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
+       epatch "${S}"/ld64-123.2-debug-backtrace.patch
+       if [[ ${CHOST} == powerpc*-darwin* ]] ; then
+               epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
+               epatch "${S}"/ld64-127.2-thread_state.patch
+       fi
 
        cd "${S}"/${CCTOOLS}
-       epatch "${FILESDIR}"/${PN}-4.5-as.patch
-       epatch "${FILESDIR}"/${PN}-5.1-as-dir.patch
-       epatch "${FILESDIR}"/${PN}-5.1-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
-       epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
-       epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
-       epatch "${FILESDIR}"/cctools-839-intel-retf.patch
-       epatch "${FILESDIR}"/${PN}-5.1-extraneous-includes.patch
-       epatch "${FILESDIR}"/${PN}-5.1-otool-stdc.patch
-       epatch "${FILESDIR}"/${PN}-5.1-constant-types.patch
-       epatch "${FILESDIR}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-4.5-as.patch
+       epatch "${S}"/${PN}-5.1-as-dir.patch
+       epatch "${S}"/${PN}-5.1-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch
+       epatch "${S}"/${PN}-3.1.1-no-headers.patch
+       epatch "${S}"/${PN}-4.0-no-oss-dir.patch
+       epatch "${S}"/cctools-839-intel-retf.patch
+       epatch "${S}"/${PN}-5.1-extraneous-includes.patch
+       #epatch "${S}"/${PN}-5.1-otool-stdc.patch
+       epatch "${S}"/${PN}-5.1-constant-types.patch
+       epatch "${S}"/${PN}-5.1-strnlen.patch
+       epatch "${S}"/${PN}-5.1-ppc.patch
+       epatch "${S}"/${PN}-5.1-thread-state-redefined.patch
+       epatch "${S}"/${PN}-5.1-makefile-target-warning.patch
+       epatch "${S}"/${PN}-7.0-lto-prefix.patch
+       epatch "${S}"/${PN}-7.0-clang-as.patch
        cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die
 
        # do not build profileable libstuff to save compile time
@@ -165,27 +201,6 @@ src_prepare() {
 }
 
 src_configure() {
-       CCTOOLS_LTO=
-       LD64_LTO=0
-       if use lto ; then
-               CCTOOLS_LTO="-DLTO_SUPPORT"
-               LD64_LTO=1
-       fi
-
-       if [[ ${CXX} == *clang* ]] ; then
-               if use libcxx ; then
-                       append-cxxflags -stdlib=libc++
-                       CXXLIB=-stdlib=libc++
-               else
-                       # force libstdc++ for systems where libc++ is default 
(OS X 10.9+?)
-                       append-cxxflags -stdlib=libstdc++
-                       CXXLIB=-stdlib=libstdc++
-               fi
-       else
-               use libcxx && \
-                       ewarn "libcxx only available with clang and your C++ 
compiler ($CXX) does not seem to be clang"
-       fi
-
        # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is
        # what we want)
        append-cppflags -DNDEBUG
@@ -202,21 +217,31 @@ src_configure() {
                CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1"
        fi
 
+       # if compiling with USE multitarget, extract all the known arches from
+       # create_configure and pass them back to it
+       creco=${LD64}/src/create_configure
+       ARCHS_TO_SUPPORT=""
+       if use multitarget ; then
+               ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \
+                       cut -d\" -f2 | tr ',' ' ')"
+       fi
+
        # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it.
-       # RC_SUPPORTED_ARCHS="i386 x86_64 x86_64h armv6 ..." can be used to
-       # override architectures (there are more arms to add) but we configure
-       # with the default to be in line with Xcode's ld.
        DERIVED_FILE_DIR=${LD64}/src \
-               RC_SUPPORTED_ARCHS="" \
-               ${LD64}/src/create_configure
+               RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \
+               $creco
+
+       # do not depend on MachOFileAbstraction.hpp to define
+       # SUPPORT_ARCH_arm_any because that's not included by every file where
+       # our ppc/arm-optional patch uses it, ld.hpp in particular
+       grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \
+               echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h
 }
 
 compile_ld64() {
        einfo "building ${LD64}"
        cd "${S}"/${LD64}/src
-       emake \
-               LTO=${LD64_LTO} \
-               || die "emake failed for ld64"
+       emake || die "emake failed for ld64"
        use test && emake build_test
 }
 
@@ -231,14 +256,12 @@ compile_cctools() {
        emake \
                LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
                EFITOOLS= \
-               LTO="${CCTOOLS_LTO}" \
                COMMON_SUBDIRS='libstuff ar misc otool' \
                SUBDIRS_32= \
                LEGACY= \
                RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
                RC_CFLAGS="${CFLAGS}" \
                OFLAG="${CCTOOLS_OFLAG}" \
-               CXXLIB="${CXXLIB}" \
                DSYMUTIL=": disabled: dsymutil" \
                -j1 \
                || die "emake failed for the cctools"
@@ -246,7 +269,7 @@ compile_cctools() {
        emake \
                BUILD_OBSOLETE_ARCH= \
                RC_ProjectSourceVersion=${CCTOOLS_VERSION} \
-               RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" 
${CFLAGS}" \
+               RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" 
-DCLANGDIR=\"\\\"${EPREFIX}/usr/bin/\\\"\" ${CFLAGS}" \
                OFLAG="${CCTOOLS_OFLAG}" \
                DSYMUTIL=": disabled: dsymutil" \
                || die "emake failed for as"
@@ -322,8 +345,8 @@ src_test() {
                BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \
                ARCH="$(arch)" \
                LD="${S}"/${LD64}/src/ld64 \
-               CC="clang -ccc-install-dir $PWD" \
-               CXX="clang++ -ccc-install-dir $PWD" \
+               CC="${CC} -ccc-install-dir $PWD" \
+               CXX="${CXX} -ccc-install-dir $PWD" \
                OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \
                | perl ../bin/result-filter.pl
 }

diff --git a/sys-devel/binutils-apple/metadata.xml 
b/sys-devel/binutils-apple/metadata.xml
index de816dd..2b36ce1 100644
--- a/sys-devel/binutils-apple/metadata.xml
+++ b/sys-devel/binutils-apple/metadata.xml
@@ -8,5 +8,8 @@
        <use>
                <flag name="lto">Add support for Link-Time Optimization with 
LLVM</flag>
                <flag name="libcxx">Add support for libcxx</flag>
+               <flag name="multitarget">Compile for non-standard target
+                       architectures (ppc and ppc64) -- experimental, Gentoo
+                       only</flag>
        </use>
 </pkgmetadata>

Reply via email to