commit:     63cf5574539585efa0eb030239547774771cdf44
Author:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
AuthorDate: Mon Dec 26 00:12:37 2016 +0000
Commit:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Mon Dec 26 00:12:37 2016 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=63cf5574

sys-devel/gcc: Add 5.4.0 and 6.3.0

Remove 6.1.0 (Upstream no longer supports it)

Use a backported 6.1.0 patchset in 5.4.0

Sync with upstream.

 sys-devel/gcc/Manifest                         |  26 +-
 sys-devel/gcc/files/4.9.4/boehm_gc.patch       | 104 +++++
 sys-devel/gcc/files/4.9.4/gthread.patch        |  37 ++
 sys-devel/gcc/files/4.9.4/posix_memalign.patch |  29 ++
 sys-devel/gcc/files/5.4.0/cilkrts.patch        |  46 +++
 sys-devel/gcc/files/5.4.0/linker_path.patch    | 213 +++++++++++
 sys-devel/gcc/files/5.4.0/musl.patch           | 502 +++++++++++++++++++++++++
 sys-devel/gcc/files/5.4.0/ppc-secure_plt.patch |  59 +++
 sys-devel/gcc/files/6.3.0/musl.patch           |  63 ++++
 sys-devel/gcc/files/fix_libtool_files.sh       |   9 +-
 sys-devel/gcc/files/gcc-5.4.0-pr68470.patch    |  57 +++
 sys-devel/gcc/files/gcc-6.1.0-musl-cpu.patch   |  32 --
 sys-devel/gcc/files/mkinfodir                  | 233 ------------
 sys-devel/gcc/gcc-5.4.0.ebuild                 |  61 +++
 sys-devel/gcc/gcc-6.1.0.ebuild                 |  44 ---
 sys-devel/gcc/gcc-6.3.0.ebuild                 |  32 ++
 sys-devel/gcc/metadata.xml                     |  11 +-
 17 files changed, 1233 insertions(+), 325 deletions(-)

diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index 8ab3bd7..ef57c6d 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -1,8 +1,16 @@
+AUX 4.9.4/boehm_gc.patch 4398 SHA256 
9aaeb05dacefbca5fedd0a16850c00ad9fbf22ae4d0bd6e74fc8b81de27efe2f SHA512 
8f201e6075e20b432c56ff5b610a79024b67335643a9c36426479f5b876d19d5f0e914ad38f3e68ff80243f560001c5245b2b6716285142d27cc7d8d719834ca
 WHIRLPOOL 
5165c273e075ee74248250337b4d69b903d112370fa3c0c243cc8cfcb3103ea0e7c50e3495170454271fdf06b54d57e54a872abbc10e2e2f604b6307cc7b647d
+AUX 4.9.4/gthread.patch 1751 SHA256 
9616018c2c4eb4a9b4d813ad7640c0017a82071e604ec4c095e84aa073aa58ee SHA512 
cd04309f74b115aaf15c1a1ea53e5ed9549454fca3b4f68bf2f5077fc028c5a6fda90db21037fd7a9a9cedb8d636781d7ca23dc12afb536fcde9df060952ac16
 WHIRLPOOL 
161bff5293a58d376ee66c791626d84e461a1a7df28f08629178a4535cd5506ffd752bbca76d0283c31dc7cc864f245da630a262a6f9ebd6f62a72b797816907
+AUX 4.9.4/posix_memalign.patch 1155 SHA256 
a8a340f44d3ae67832925b854c79d8d57ca3e63d860f84f2e45981fc6861c32e SHA512 
7dec7a092320fcf770e137cfd501237cc76e72606d56d947081ed9c269e0e60756e6fc0b08a0af100987d4c5c021827ff0c157f4fddf1d46fc44fc8604e639a1
 WHIRLPOOL 
c19901b9a5618774c5ba2578f3c3b2b8a214858e73cd474816c21f364a650f14e498b299a4d618ac45877363770771e021f9cb857aef3e83d1a8a7f4e264997e
+AUX 5.4.0/cilkrts.patch 1798 SHA256 
a8d859d2be3b86f1fa14bd85ee10b3ef250ab24acc782b7a572c72204c04ccbe SHA512 
1779793b90e8e8fb4532fc17d488e211a8c7c193d13c5ee99f5295ffa1e3516b07f4341fd6821e502602db470ae3ffd12eb2e9c07f4cbce796879616e39a2c1e
 WHIRLPOOL 
a5ef7b28c71150e8a8c817917aeb5710096c8c3b8b28dccc77a7a13585e6b73cf41d599938ac8c851d1ea179d00580ca828adaa02029eb122935e35b386a28b2
+AUX 5.4.0/linker_path.patch 9241 SHA256 
e1c9479807a186ba1fd5cf4de2fa025fb72ae038b66721e2aa8eee45e9c741c6 SHA512 
f5997d46772517f9538cabbfd01f78225301f6747a8106198c9fe0a591e53ed1c490bf89310848ae89135079928c8325880294c766d4983394b0eec0fcfd8046
 WHIRLPOOL 
4010e23e4cf306e29ba774788192261c74d1fee98dcdc1cc82d9267dd128345773c46db65224b42bcb161d32691e83467a0c8f7453d02123116486ad5f5f5ce6
+AUX 5.4.0/musl.patch 19066 SHA256 
537dd351a7695fb6335cf943e5845578f325fb6fc8fbdf02a312ee7ef79c2a0d SHA512 
56020b6759929053e0256150dbf5ba824fc0c1d4f574e1f4af066d6cdcb8199d8b8986008aaf46727454054091f7e9c4bd33bd2dd4e27c21a60fcbc4312103bc
 WHIRLPOOL 
7ae62962e269e0032d3ed1446e876387d711bec310c2fbbfbec04e62e2f416ebe0486016d2520dd05157dd527af4eda05e886e63cd9b77817f4ed10639b33fa7
+AUX 5.4.0/ppc-secure_plt.patch 2161 SHA256 
40649792d02e98717fb9a361004f332a98bebf77b5ad83b05678f13760337dd3 SHA512 
4ba9780f4cbbe30afe9e40831f2ee57d9979ada093dc15511bef6ec69f97198034a8d07a8efa0884b66d904c7ad5b86a69b52a0ba41c3110680bf01d7b051388
 WHIRLPOOL 
dedc5db47ef2b405a268b417a0323cf3c2f7b5956c1fdb5722f14628f32657f92b381a70c6412b940b0ed740037ee20cbedf8032ef093a62deba847249288975
+AUX 6.3.0/musl.patch 2559 SHA256 
0d53a7b29f8ea6e337444e412cd07e80a620446eca0763edf1674e1544311acc SHA512 
764437a1c86bf97598a93aaa1a41cf9252350bcb6bfa5d70140e56387b230287875c5e4cb361ff8eb8f8e2f7ae6af8f5667c3e090ee7d6331bc4fb5daac9f023
 WHIRLPOOL 
35ecf4c3fd7c81c24775663a578f1befb6866545372313a1d0e961605ff065538b1e5c267d3db9a7853a75ddec880750bd4ede76eb13f078e4a8f29001bf2cf2
 AUX awk/fixlafiles.awk 7700 SHA256 
5289279eb5df3dce696c56ce253980b9a9ae0968703f200970bbc24396a1ae62 SHA512 
5ed208e116769741dda7274f15c5b3bdfd482cd926261038bc696644b73aa0d0e950d7fbfc0eb1a90529dd134fa548c46499a18c77470a05d87ae76bc1b3acd2
 WHIRLPOOL 
06826b65ffdbcc1c624ffed16104301bebc47f4b44358197fd7f0f78d0805a5228e346a8eaf5ee79355e1921878f94d3dd527d39e2975ea3b919140139d884e0
 AUX awk/fixlafiles.awk-no_gcc_la 8480 SHA256 
9697196d45cc47d3846021c0dfd0a24208a75b10d32c74cef53aa253031f2efb SHA512 
7487115a3c4d6cf0edaf4b0ffeb87225d8fbcb7e595e2e99974582e0cce5868d7e292044db2631380c185553866554763eac4c3024347dbdb2cbf68679923294
 WHIRLPOOL 
24ac7f49bff29cc0abc5c4e502112e3dc2f42517244b8c9a4b8fdf73c9a31fcecdcc42989bbda8faa5feb54dde37c1d7374e1360a0c4de8c136b0523107c6ad4
 AUX c89 412 SHA256 
29ad5dd697135c2892067e780447894dc1cd071708157e46d21773ab99c5022c SHA512 
71d33a147339d8d70a62aa22a95d3e70e445d8435d6ac05893f7da19ae851b89bea851f6ce213fbd22470f13572ae13b83cf02f0621333f07d7b0c68a79b7924
 WHIRLPOOL 
d9707a2be8da7a709b54fcb1154cfa05e479f8c3bdd6173822ee1f1bc265b2a0d04741c0685bfb0db68e1e4297fb032d2f8ff94da88014575d947054474d8295
 AUX c99 446 SHA256 
057b348cf5be9b4fb9db99a4549f6433c89d21e5f91dc5e46b0b4dc6b70432f5 SHA512 
bf3b0eb1125d5e89b433954fcbf805cd86dec5a6eeb23df685ebf3ff83a610573f2ffcec65d893244c845936a73918387cba026710c65c854b2c94a78b007989
 WHIRLPOOL 
b888038b96615c7a0363555b407a3de2c1f17e34428fa16dfbf56fcf68875d6bcdecbc61b545d7f71842ff1909a3ffeff17165fa7f56b48f95adae22f5f8bff1
-AUX fix_libtool_files.sh 1570 SHA256 
e6980432f080b596409ded003190aedf3242eb2582800291d0930473fb69825b SHA512 
c661ba178272a080d62e565a92a3ffab4d832fba484435e0acb30a1be82c1db14bcb548f32b5143a6d72b021a70344c12a62d7246c59cd0d2db5de79dbcac82f
 WHIRLPOOL 
90347250c55ea9a387b9f5d1cec28dd657d60cbeeca6fea1b8763e61ab6cabde512f206e087f9b41d5c2531ae5cf420e336b1babdc086ed001de3b41609a72cf
+AUX fix_libtool_files.sh 1528 SHA256 
ed1fd90b31c2865fa78e24166f5523dfd8a79baa932ba9b2e1b34031dd17ac82 SHA512 
c0698e7af969a701d7a2fa68cabb728d6271aeb7cca4d53bbb306906dc1b6a30a756ec01df2eae03712fd21865ff2779a0cd92e44c15774a812f935e7fb308ae
 WHIRLPOOL 
5ffa5cbb84edc4e7ecac0bcb6a1d375a9a5ce0369a609f32d7136dccb08f2a82c9baaef8e360c3ccd5e2d3ae7e2bf62ad24ad258c3d16091aaa7cd0ad29f0fea
 AUX gcc-4.7.3-musl-linker-path.patch 3097 SHA256 
dbc140267f3ccaf7dce4dbb153920d90018c453ffbc531864cc73a2dc5f002a2 SHA512 
2c33899aa8bb8a8b1ad974c3da9039984aa52fe2d2f52d0f6ddf3aa6386419ee32907f40f60db552abcd0e1dee04cae91a029e37fe531938614f9c66e9518cd7
 WHIRLPOOL 
d4f8a1a6abb083566d4ceb5deed31c2c35bd06f4b786ecd365d19606413c5e7f8579fac05a990a12157a139c243286ebcb7c61108ed69ae6477ef20f579cec86
 AUX gcc-4.7.3-powerpc-libc-stack-end.patch 5374 SHA256 
880028136d6a3352e74664d0fccda293fe078a5adb58ddb84cbf4d301aee01c7 SHA512 
c66b561cb8db68f86b9c001625fb5599db268e576ac163eb47226976e81dc97b3d4ad3cd9f9b0ef44cac0ca9d353be3ae4709e75ed319ff08175ff4e1b1aa174
 WHIRLPOOL 
c7ae1a535410ca5c7d5a8e3b2f8f2bcaeaceaf1cc9c20b3426efd09422b3a957cca7527842f720655a94b5bc8c82642eef0d693003071bd7f80a381d58be848b
 AUX gcc-4.7.4-secure-plt.patch 1915 SHA256 
668c57298064abf6d58857126cdbcefab6d3117726198185ca4f24855c3f7180 SHA512 
0e23385b9e654acc296e5b3f333b5859174dea852f38bc5acb182ce15d6ac568dc588c69407b066dc0b91ffb48a1f1c0d8d25720d3ab268da8a56d1c6c40492a
 WHIRLPOOL 
9e061026ea0f87416ea0cd39dc64c074d79001f26d513ec2a6777b42caf47b6bf250bedebcace52c351cf95710318012039da58fdc7d2ef59e51fffc445e3edf
@@ -16,12 +24,11 @@ AUX gcc-4.9.3-musl-res_state.patch 699 SHA256 
822990f5075b65dc2d1c03722daa5a2153
 AUX gcc-4.9.3-pr68470.patch 2053 SHA256 
9ca76f063735fb87ee01aa9321f714a04db2dd394381c5a659f7081eec9b45e3 SHA512 
5950b4782034add9ded16ab4b6d7b2d5e2bbda1a3ae7f465d50c6a95469359d287126c1a57ac9d8c6ea2c61d7b18ff880b2ac2b25eec48f038452f87f0e24393
 WHIRLPOOL 
f216b046bfe55003af384b573ca0be977d310064f31fb9d8cc15badd6e4b4922b761004c02b44fe04460ece1f82d55eb5c35f09c006015b97cb7968347877dcf
 AUX gcc-4.9.3-secure-plt.patch 1478 SHA256 
b9435e19c3193e872bfdce8f635755655cf6e88889c57d21c7afa118d7068e95 SHA512 
95f04716bad41fe3f290d44d21d1dad35548b801b56de331acac8bdf56019583a04681418a805a0b4dbfe19e9b51cecceff984cea257be58d3e7780c6cfc58a5
 WHIRLPOOL 
8af1f0cfaf0e8197754d841d1cd2b25615968cc503344574cd9ec6b644804e029687a4ded18f6e1efd584c8c99277eceb6f1012c6519a2747bddc400d8909c1e
 AUX gcc-4.9.3-tree-vect-data-refs-correctness.patch 315 SHA256 
904ae5ce2ecd5a2f7786c54d148a7562d0bb6f51fe60761038c2f57b8cf70356 SHA512 
88d93c061ef72035522270ab60c8c2ec04e2fa2d69763f45b9eab0c37b19c23920484358d7556ad885775071ac04cf94684a2cd8ed93418d5f0c54ac3a045c9d
 WHIRLPOOL 
2b9c281401abc111d53467c51b6238c6f4c430a73d8833f161766f973138ffe3b4fa1ffe5cc5813b5e2f8a81dee2cdcaaff2b9a8f8e13089f993f3ab3d69ccbd
-AUX gcc-6.1.0-musl-cpu.patch 1277 SHA256 
6c7a28ccc5edc226fc6f3f6b9b0562fb873a9c88dfb25b608b5acd827f239c08 SHA512 
b11c5933c02dda63b40273f6cee394d52c68265931817cfeea3645e971b9c822cc841242a7c74fcd07729171bc0723c2af0db21743bf92dd3dba3430ee6627a1
 WHIRLPOOL 
e0f6068a8028052f88cef840026baa459ae77a43d9144258fe7739a80b5dade852a2aa640feb5bce51dd54d6d35e0c8df99a8c9bdc140f9ae473f16ffb2e9af7
+AUX gcc-5.4.0-pr68470.patch 2012 SHA256 
f8949e1d35bf7bba80aec50bdcd5d6b008f731679b06f3d89e6d8a4eb98e492e SHA512 
dea9ab12a37b88308424af2882b4755366745c204cd74e6892374d4aeb0981487f9fa1d44ab4d4e6184c83547c3ea30ed731719fa074bea62bdf8bfcf1dfbca0
 WHIRLPOOL 
2f66cd0d2dcaf237fd730eefe6f477970db14c237a8309925f799984a010f5470f6fc0f6a735316c7eab4de9dc958d773a4ffa14eea7093158690e9ff8f1847e
 AUX gcc-configure-LANG.patch 2052 SHA256 
63de6d2dcfe14f21d147abeb1390405b9220c03f8e968f482d4b4c1cf279c88b SHA512 
a694c7ac2f45cc657097ff5b0cf1356ac88a9c06035c9ba15167e9d444844d0d8a478eb1b9b62195dd063774f79697b9148b9cdb6c261640b472c291061b2129
 WHIRLPOOL 
3cc1ec912fb192ff1058de5b93e49a994ba30d1501a932290dd5b3df1cd783875621cda56edeb41894cd5fa10c04917e693a40a60be8d742ddd7992bf5d8afeb
 AUX gcc-configure-texinfo.patch 337 SHA256 
74b73a7ecec2d88889876b4db480cd173632f49d5396bb8e5b3c93673f9b5b98 SHA512 
a15fba8bf2ff02bdeca54d6f186bfa08c1079c6a8ba0a3beef154483ce5c1b8c497e7ffeec32371968f0037e0ff8384609eb0c367d0155a4e5a7eef8aad084d5
 WHIRLPOOL 
39d008aad06f7621e4e5db15f5e85a59e583b43f8d247029bd4944466bb60a9795bda157d185c45c329294078e282703a243aad5c468d90c77665dd6336870d4
 AUX gcc-spec-env-r1.patch 3148 SHA256 
da0a6442eb42bce58cbdc7858b110a2e65fc5bd5b4b780b9b491033de6e302fa SHA512 
ecae71577543772cfe1711f1b4a8815c0b5d706ebd01edacd1f07586637d4805e25771f970a6e6d1bb696d4b1b5ef3e0036088a96a9f6beff7ddaee704175d16
 WHIRLPOOL 
3535605998eabccdee71ba396ed5cefbb8b0a8cb073101f6444c7d01233f3b3904c1b29f4daf0a3417c68de8dbd62a0b7dc367cacfcbfa0c4ee1b69b7df8c6fb
 AUX gcc-spec-env.patch 1544 SHA256 
64b01f29fb853fee5ecda998b66eeaa7ec86ff1fc3b21432bfd69eb543c93e6a SHA512 
ce9c1f923e2c6d17347ec2d3d8482351a9644194b2753627389294d43bb4f11b9c2ef41eda1b46ad83d09901a0bedebd5b6b8a57a198646030ab61e8d2d8cb48
 WHIRLPOOL 
b88c9c18e20868b3ff535c3390408ebe8f1304bcec6e70b6472781f684671265860dff4335f2301d3b4d3b73395283b29673f0f5da62414e1094cfcb8130e8d8
-AUX mkinfodir 7324 SHA256 
0565353e767e253207adb8b5c9be9ba215a628447e075a4dc7bb3183ed099d2a SHA512 
a05f9130d98e4cb4d3254b757de06d772d0a965ac4b5a9a15082b1cb694a2fd32c9c8f550745a9423ba3cfdd1c5e87b6d568a809301772a24cc6e1a414d5f98b
 WHIRLPOOL 
4001ae3f7fb666a84e12432a1a41eacf62ebf922181c279e4d06dad32e44d0b499d13e098e794fdd19a9cff5c438a28e5e9e125fb78e72bb913fa5ddd8e44bae
 AUX musl-gcc-patches-4.9.3/aarch64.diff 447 SHA256 
73acdb1aaec6874236ae23a3283c55ed7675f32d5561f583bab9315b3c85dab7 SHA512 
748de2e03e7974b89e0201f1908b3825192ac8d7a2fbe7f5390cb663cee22aa3776162e30e6abd8d7203ad772d2186ff67adf20e9618a1bdda2f25a671cfe4af
 WHIRLPOOL 
50f548b344c33bfbc186fbbd1b385cbbd2651cad07bc531f387b109db736a9f2a293614697aaee6e98a3c21f0a709c9d93b1e4f50c56cca138775514892f354f
 AUX musl-gcc-patches-4.9.3/arm.diff 1682 SHA256 
872312775232ae0e35a94631f67a3163db4e0767206a103ad42edf6b4ca1ed84 SHA512 
743f5118c2bc083214cea40f24e641ec31354cafe792c5244a2a8305eafabb88efe03a55c275d69c93073a4dd9cfff82d81ab68bea6faa2da326dbba0644063c
 WHIRLPOOL 
a94b6249d24a3e15f7bb450f9405ca6e8f2ae9f2135f2df494454168b8cb6d4a3ba644f9d1014aecc0c8c1db418671ef5e48eb2c942307911a975f376167b05c
 AUX musl-gcc-patches-4.9.3/gcc-autoconf-musl.diff 2361 SHA256 
0b49f18b67a91d809d26b2dab187ae196000549d3837382cf6f70ef605360fcd SHA512 
0b7351361a947448e4aa3d022e317523c8cce3f69691e78fae5fb6941d410622d44fb3ade9d8a0ee06fa2212e9fc0abf2b86470592e92dca41d312bf320c07c6
 WHIRLPOOL 
45dcf5bf5c8a40b7fb1e83d54b4731d834c6fde59a7d6613b7af26e6a8c6ff15b302f9f2f786a0de42a30b34f2271c5c99634a0fecc55118e5513bd199d50559
@@ -57,8 +64,12 @@ DIST gcc-4.9.4-patches-1.0.tar.bz2 22266 SHA256 
1a394abb77c75e2212896ad3a62ae1f6
 DIST gcc-4.9.4-piepatches-v0.6.4.tar.bz2 14414 SHA256 
c67b56f04c653e6a19e36abed8391f8b6bed426bfcfc907237cc37f02dbb5015 SHA512 
243fa272ea0e49f700a76508bab3e03bbb353bcb930581b2f87f9a47df5cd3880e29f20b71612b21190adc463849e1e6ac2a38a49c0002b562d93d436f538285
 WHIRLPOOL 
1e5959441210af6f690398efab96444ab11d136238a9428912e8441eaf0509fe6db359a8aca92a446fce0c75777385475af73b20165a8593f9969e3a25fd0b0f
 DIST gcc-4.9.4-uclibc-patches-1.0.tar.bz2 2618 SHA256 
95f290d0b68114d835515afc424d6096476a45665671784aa71a7a506296e465 SHA512 
5a1f44caa9261f4947101379628143869b31dec67fa28605e8e1f3894d4b7120c3f68ba6deb59da7a74fa906e27ab32cd3767761837dc3dfebc37865d349d6db
 WHIRLPOOL 
e46b08737cfdc235bfb80117e0389f3969167adf59bcba2a0a1094a20eab2b62f0c952dac44781e43957cb1507cd4e80f37bd8aecbc55dbda6382d93b3a4cf94
 DIST gcc-4.9.4.tar.bz2 90097606 SHA256 
6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092 SHA512 
93abb78e16277454f41a8e9810f41f66c0fdffdc539a762ff6b67d3037f78db971378683fd2ebf707d1d51c059fad2161fe42d110c330027f40214b7db0f3efe
 WHIRLPOOL 
e20045126c21a3edea1fa4a2185ec2bc5feec77ddf967ab9d1e8c33322ad4eafe013bfcaab1ed4e35971d3b70ef373ea3585ebb089c9bbf91bbfca1f1da71236
-DIST gcc-6.1.0-patches-1.0.tar.bz2 4193 SHA256 
48882d00b3327fe6578e421d4d90d5f03c22fe30ee80542fc828432ba505dc77 SHA512 
ff3fc21bdbc5391058759d7e61e9636665d0cbeb3f3fdb724e1bd09e4d6ae778f7c836e59e8b21540458bde99b503428b190736d3ee7a3764f56ddc1da754d39
 WHIRLPOOL 
4b648a92aadbdb4bf72652ba83cdd8352ef992449b089311c8e20760317dc0fd008dcc2f797880c869dd1b79cf1162943a323681954dea490f09e7682f28b3cb
-DIST gcc-6.1.0.tar.bz2 99267556 SHA256 
09c4c85cabebb971b1de732a0219609f93fc0af5f86f6e437fd8d7f832f1a351 SHA512 
eeed3e2018b8c012aabce419e8d718fde701e5c3c179b4486c61ba46e5736eecc8fccdd18b01fcd973a42c6ad3116dbbe2ee247fe3757d622d373f93ebaf8d2e
 WHIRLPOOL 
fa11fca6c85a31f7c896f0ded40a9208a8588c2b3fddd2cca51f440c712ff83374528b7d1571f8d98dad96e24cb5b14b6af624ef42aff2a85ae99e8621c9b479
+DIST gcc-5.4.0-patches-1.0.tar.bz2 28227 SHA256 
ff600369f150129754108322338c3f4f0064d222843a2d82778537f94a22ecbb SHA512 
70cd83b142abaa3c22d67d5d58185da2cfa178737ec963e230cc03ea8dc6dc757665c711fae91af4cd91062d3136c6f31a5ee3c4c7440ed9485c6f3632731940
 WHIRLPOOL 
84a69d2dde582fd486f6c60f78ce9f8c7cc5b480c2989cc1804617eb6526a4a17d20d2ed010bd9fc78019d69caa665428970234090b21f9d4b97217011d4fcd6
+DIST gcc-5.4.0-piepatches-v0.6.5.tar.bz2 14551 SHA256 
495eb9110244dac17408cd0eb6977a593577eeb0437e72b60339b8ec394f2fb0 SHA512 
4890f0713d261982ab81a20f93c5f65193aa1dfa171e3f9e5867f0b80ec7c1e76c5a997b1a4e6f47f8ce36af54ac91125c5bff8bf6d971b7d77c65a57a40a3c0
 WHIRLPOOL 
13b74b1ca75cc94f9624fe1b52221a953962c918c2cb932302a3078b6deba4f3e501647ad8a2915edef6301e64c820ed612a6fbb9e1178cf1711fe0045686969
+DIST gcc-5.4.0-uclibc-patches-1.0.tar.bz2 3731 SHA256 
a3145faa6c81c0753ba754b735834c38987c356dadaa7c4a625c738e374604b5 SHA512 
009f34197e79c5e8c6497a0db01ac45cc657e92e56a663b4f3281661d108b2a129cd977fab5f0064f225d6812ae91e82bab22a2b10ae02c486881eeed85ec7a3
 WHIRLPOOL 
a3598ce0aad7e9110db156005190739abc5b4ceea3c327cb9c747c4cf1b99589c1a9fac170aea346eae030b09ee563f9f990e031ad7dfa1aa19b895898bf2608
+DIST gcc-5.4.0.tar.bz2 95661481 SHA256 
608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a SHA512 
2941cc950c8f2409a314df497631f9b0266211aa74746c1839c46e04f1c7c299afe2528d1ef16ea39def408a644ba48f97519ec7a7dd37d260c3e9423514265b
 WHIRLPOOL 
ec81c8143e48bc8d9d0bbdc0fa3ca553c805193f53ac46c86127b54565894780dd97281485e396a130567464c753f043458c8e450018c957813f50ff90a40708
+DIST gcc-6.3.0-patches-1.0.tar.bz2 7596 SHA256 
6c880468ffa4ad2b324fd18c762dbdf10646089c8ab865c228e166f99a0e049c SHA512 
8fc96086bd3da3726687ee9d180d3b5d0a7d5814141d44eac8eb01566a783ec780c8fb8f55f75d6e9c9006b2e407e20cdb5835d541b0b66a47dd60642861734c
 WHIRLPOOL 
b1bce94d6134db6c9aff4298c6c7af003e39d0411aa40cd027d2c7d6a256971c81fb557e85b25f1107e9a474cb7d772c3bc62a7a4ab7ff7fca5eeae5b2ca0c94
+DIST gcc-6.3.0.tar.bz2 99903185 SHA256 
f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f SHA512 
234dd9b1bdc9a9c6e352216a7ef4ccadc6c07f156006a59759c5e0e6a69f0abcdc14630eff11e3826dd6ba5933a8faa43043f3d1d62df6bd5ab1e82862f9bf78
 WHIRLPOOL 
e79a2d6ad199396b6efd835c1129d049a367174ea33dd3b6247d72461f117c2dd81e5a66f3dd6427ce500e768d3a4453efd0debcb56966d00c7df79d05d54b7d
 EBUILD gcc-4.7.4-r99.ebuild 2071 SHA256 
67b45e6941cd3d7b4b075884295da5ed7cae18f4a0ab4630ac8e64cda70c3aab SHA512 
383a1986e74a1ef333a666f298200d7ab9423f30c25da9cf460986fe5bf95f6c43ecf829f90313076108508b2f64f06e188dda8fec9f014f861adca27d876e9b
 WHIRLPOOL 
9dbe06a64f35a0d5f12a968274152e95cf332b87c9e8b689d70a99db6a93a097960604c363dc608932c96250cd634ce65dc544368b4e361ed5bfef535243f3c7
 EBUILD gcc-4.8.5-r99.ebuild 2139 SHA256 
0b762e2fb8c2bf92488b598c01977b07a3786afe77ce3fe81d4fa7310699567c SHA512 
7a5efbefe0a518677d5b7c6552621377cb332a1e91ee57ded0c5095c06a7a5dc1c63c29f726c3cab29aaa12d908e90e6bb30b3e03b70c259b76ec0ed1534de1d
 WHIRLPOOL 
d8c2baec3deb6ba4875c9acb3b15ba1ee757744fce41847b7120b76671699ed92204910c7bbb9063f6d6d049b89d54b7e9d34e4e6d210f075994cc00e3c73850
 EBUILD gcc-4.8.5-r999.ebuild 2185 SHA256 
7b8b261c0d3ea2e34a2f099b4f0a23a5bfd61e814dead44aeb4e45071be2c3f1 SHA512 
e8f6e8bba4fd7818c30a555adcf25acbe818919c98204f91e27be04566aa267b9394547045e05e5486437853ceb1b75229d86089f69409a626a9e81e363c12db
 WHIRLPOOL 
872e4f0e40e2b9a0a51002c64e682eca1990c2b968c8917b9a1a7c309075a048ceffd7925bf7f67cb3f304badbf29ee5e94772f5a86503e1e5e42fa7682fb87e
@@ -66,5 +77,6 @@ EBUILD gcc-4.9.3-r99.ebuild 2195 SHA256 
3f5be66ffc6fb064e14a24cb9005d1835685573f
 EBUILD gcc-4.9.3-r999.ebuild 1794 SHA256 
514b9f6cddb5e6a43c53f866aa501812319bfccf7fb7713316563d55cb139aff SHA512 
c7f4aad21658d6acb99f14b3b51707a74387206b9fc3629d962c755a7eb8a963b3df844ba60172305fc2e753fc7178d4723f02a487aeae643c85ff00062b4bd3
 WHIRLPOOL 
c6372f1014c5b8d22023f04b7223db4ae5d898f450f3d5cf286ccd82553f916978fba8d0910dc72fd5cdd1d92ecce9749597b09e252a58ff898d3616221af685
 EBUILD gcc-4.9.4-r100.ebuild 2320 SHA256 
62a7b580317230c294b8103b2acbfb5ca49afdaf1fd6f2fedbb778a02be65d13 SHA512 
fcbc99e45c09a77a4869328df5136c9530297ea810baad10d28faaaab5ec15dcde2b105fe3b30a5190b86740b7bd962a302d9b4c8e65551f226fb2fd00eb4c2e
 WHIRLPOOL 
6b73fa54aa7edc1e44a2b1bbb76f13e8135a21301a7203343e226b2112437749e12f5503a71f3cacc221ebda2d99c8db45b882d1cd014b8731acf3433f5c7c7b
 EBUILD gcc-4.9.4-r99.ebuild 2268 SHA256 
fdb60343669f5a03820920f9ee06d54e42def02475613f3c0221e4234f7cfcc6 SHA512 
3b8df38d0600b5e006293e69265f3e9603dab01e40ba5391fc8e517d185388c3fcbcff571a7babb729e19a86ea37fca5b45f800fbf856c4d2c01d3506c5c32b5
 WHIRLPOOL 
2ae8860e5106d4e4b3680a7a885bdb80e5c5381e9cd608a6f55f6fcb69c9407b675ea2d18a2e8960be4408dea35228c5bc80f14d27a68e1d53f2e4fbfefed0fd
-EBUILD gcc-6.1.0.ebuild 1076 SHA256 
6d5acd2030e949af48922a3da83541c0720037212c71c1867e5de8373e8bc0b0 SHA512 
7f4c657c930a7cb0cfdd34ff8fa811eb2e62834ed0ec094db6bbc5123ea8c86b72df1cf32d6660c0ef2dc3863276081665b95af0a1c47a1ba14802a5559e776d
 WHIRLPOOL 
73f9a4277585013050291df58b6d0c7db7fa65baed51c0a1b9462c212281de9d98d50c63be9d703fd45efb61e596fb74861aa41e17f4ac1917adb4f44961c18a
-MISC metadata.xml 2039 SHA256 
b200834baf1ac8adf966540ee7e50dbf1397248f08eeff35a8bde6bb16dbcc50 SHA512 
b8fe281c88017b4d5d2ac05ea4e074d740b3943bc0d4cd361ec4f161f2549fb6401a2fa7881c06a4eae33ffd9755b6ebc4fa608654ec04838bff49ff22ee74a8
 WHIRLPOOL 
e063f7657a00a1e675a57000fed2fac1c05e986488f3a705c95909ac7a2e74ca8f97c6fb8bfffdb81388a967228a78adbcfa93b166d4095aade5875aaf350fa0
+EBUILD gcc-5.4.0.ebuild 1902 SHA256 
bf257d5a8b62951d0aec2b99e23cd6c06ac592ac051f9ee919ddf0b2a5974d90 SHA512 
3e8fda17cba283674080d20d2310680a0a9732961eff4bd16bcd17432791c843cd237a08945f93ff3c1d0fea23acb92413eab0f278de97520493f8c8342e34f5
 WHIRLPOOL 
328a3e6043fc8ff972a4a15e51161d7c95b2308de1e709720d40ed115f848c6087a298bfa0be73df7465633f0cbbbd0f958548180b8baaaa6024fb03f10c2993
+EBUILD gcc-6.3.0.ebuild 793 SHA256 
9136dfbecb7e14e89c0ff081f567dfadab5a5ffc414720d1757fe31c6f2b829e SHA512 
64be9f178c98322baaf829b93e5721c6392d5350c10137f00fbee243c653e71ae859f24f773ce24fe9daafe0e975aa22c608b352dbe41853b172c5810f8d0dec
 WHIRLPOOL 
65fece4b2e805e0016f7f5acab64cd223e14f11b04eee996b1181d00bb7493d370e44a465a0021224399cf848f922fd05c3e66190f4e124728db7c650f2026a0
+MISC metadata.xml 2442 SHA256 
6937e475cde4e13feee8cbe7ff2913a6a5f865bf0bdb5b01fae7e962b3a0af54 SHA512 
0215827852bdb43aa26d8bf0e9d9adc6453b98da48c7db78fc48bb96e707e207356db9f4c221104964e5ae3100767dc99db324f45f08f0dba020ea9e38b84d4f
 WHIRLPOOL 
4f9efa23af2765ce3a9965f1d2280d06688959aca037c90ccab06913199612d8854fea2f160547f79a793c990699da9c586e13bbc364a2f1084a9c2a7744af79

diff --git a/sys-devel/gcc/files/4.9.4/boehm_gc.patch 
b/sys-devel/gcc/files/4.9.4/boehm_gc.patch
new file mode 100644
index 0000000..75b921a
--- /dev/null
+++ b/sys-devel/gcc/files/4.9.4/boehm_gc.patch
@@ -0,0 +1,104 @@
+diff -Naur gcc-4.9.4.orig/boehm-gc/dyn_load.c gcc-4.9.4/boehm-gc/dyn_load.c
+--- gcc-4.9.4.orig/boehm-gc/dyn_load.c 2012-11-04 14:56:02.000000000 -0800
++++ gcc-4.9.4/boehm-gc/dyn_load.c      2016-12-25 13:22:28.000677992 -0800
+@@ -459,10 +459,7 @@
+ /* For glibc 2.2.4+.  Unfortunately, it doesn't work for older        */
+ /* versions.  Thanks to Jakub Jelinek for most of the code.   */
+ 
+-# if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \
+-     && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+-         || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) 
+-
++#if defined(LINUX)
+ /* We have the header files for a glibc that includes dl_iterate_phdr.        
*/
+ /* It may still not be available in the library on the target system.   */
+ /* Thus we also treat it as a weak symbol.                            */
+diff -Naur gcc-4.9.4.orig/boehm-gc/include/private/gcconfig.h 
gcc-4.9.4/boehm-gc/include/private/gcconfig.h
+--- gcc-4.9.4.orig/boehm-gc/include/private/gcconfig.h 2013-12-21 
12:42:39.000000000 -0800
++++ gcc-4.9.4/boehm-gc/include/private/gcconfig.h      2016-12-25 
13:22:28.001678000 -0800
+@@ -696,9 +696,7 @@
+ #       ifdef __ELF__
+ #            define DYNAMIC_LOADING
+ #          include <features.h>
+-#          if defined(__GLIBC__)&& __GLIBC__>=2
+-#              define SEARCH_FOR_DATA_START
+-#          else /* !GLIBC2 */
++#          if defined(__GLIBC__) && __GLIBC__ < 2
+                extern char **__environ;
+ #              define DATASTART ((ptr_t)(&__environ))
+                              /* hideous kludge: __environ is the first */
+@@ -709,6 +707,8 @@
+                              /* would include .rodata, which may       */
+                              /* contain large read-only data tables    */
+                              /* that we'd rather not scan.             */
++#          else
++#              define SEARCH_FOR_DATA_START
+ #          endif /* !GLIBC2 */
+              extern int _end[];
+ #            define DATAEND (_end)
+@@ -1167,9 +1167,7 @@
+ #              define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & 
~0xfff))
+ #          endif
+ #          include <features.h>
+-#          if defined(__GLIBC__) && __GLIBC__ >= 2
+-#              define SEARCH_FOR_DATA_START
+-#          else
++#          if defined(__GLIBC__) && __GLIBC__ < 2
+                extern char **__environ;
+ #                define DATASTART ((ptr_t)(&__environ))
+                             /* hideous kludge: __environ is the first */
+@@ -1180,6 +1178,8 @@
+                             /* would include .rodata, which may       */
+                             /* contain large read-only data tables    */
+                             /* that we'd rather not scan.             */
++#          else
++#              define SEARCH_FOR_DATA_START
+ #          endif
+            extern int _end[];
+ #          define DATAEND (_end)
+@@ -1387,10 +1387,10 @@
+ #       define HBLKSIZE 4096
+ #     endif
+ #     define USE_GENERIC_PUSH_REGS
+-#     if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
+-#        define LINUX_STACKBOTTOM
+-#     else
++#     if __GLIBC__ == 2 && __GLIBC_MINOR__ < 2 || __GLIBC__ < 2
+ #        define STACKBOTTOM 0x80000000
++#     else
++#        define LINUX_STACKBOTTOM
+ #     endif
+ #   endif /* Linux */
+ #   ifdef EWS4800
+@@ -1904,9 +1904,7 @@
+ #       ifdef __ELF__
+ #            define DYNAMIC_LOADING
+ #          include <features.h>
+-#          if defined(__GLIBC__) && __GLIBC__ >= 2
+-#              define SEARCH_FOR_DATA_START
+-#          else
++#          if defined(__GLIBC__) && __GLIBC__ < 2
+                extern char **__environ;
+ #                define DATASTART ((ptr_t)(&__environ))
+                             /* hideous kludge: __environ is the first */
+@@ -1917,6 +1915,8 @@
+                             /* would include .rodata, which may       */
+                             /* contain large read-only data tables    */
+                             /* that we'd rather not scan.             */
++#          else
++#              define SEARCH_FOR_DATA_START
+ #          endif
+            extern int _end[];
+ #          define DATAEND (_end)
+diff -Naur gcc-4.9.4.orig/boehm-gc/os_dep.c gcc-4.9.4/boehm-gc/os_dep.c
+--- gcc-4.9.4.orig/boehm-gc/os_dep.c   2013-03-06 07:08:58.000000000 -0800
++++ gcc-4.9.4/boehm-gc/os_dep.c        2016-12-25 13:22:28.002678009 -0800
+@@ -26,7 +26,7 @@
+ #     define __KERNEL__
+ #     include <asm/signal.h>
+ #     undef __KERNEL__
+-#   else
++#   elif defined(__GLIBC__)
+       /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */
+       /* struct sigcontext.  libc6 (glibc2) uses "struct sigcontext" in     */
+       /* prototypes, so we have to include the top-level sigcontext.h to    */

diff --git a/sys-devel/gcc/files/4.9.4/gthread.patch 
b/sys-devel/gcc/files/4.9.4/gthread.patch
new file mode 100644
index 0000000..48aeff1
--- /dev/null
+++ b/sys-devel/gcc/files/4.9.4/gthread.patch
@@ -0,0 +1,37 @@
+diff -Naur gcc-4.9.4.orig/libgfortran/acinclude.m4 
gcc-4.9.4/libgfortran/acinclude.m4
+--- gcc-4.9.4.orig/libgfortran/acinclude.m4    2016-12-24 16:16:53.481696091 
-0800
++++ gcc-4.9.4/libgfortran/acinclude.m4 2016-12-24 16:42:52.045622116 -0800
+@@ -100,7 +100,7 @@
+             [Define to 1 if the target supports #pragma weak])
+   fi
+   case "$host" in
+-    *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
++    *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
+       AC_DEFINE(GTHREAD_USE_WEAK, 0,
+               [Define to 0 if the target shouldn't use #pragma weak])
+       ;;
+diff -Naur gcc-4.9.4.orig/libgfortran/configure gcc-4.9.4/libgfortran/configure
+--- gcc-4.9.4.orig/libgfortran/configure       2016-12-24 16:16:53.557696818 
-0800
++++ gcc-4.9.4/libgfortran/configure    2016-12-24 16:43:06.557762874 -0800
+@@ -26355,7 +26355,7 @@
+ 
+   fi
+   case "$host" in
+-    *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
++    *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
+ 
+ $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
+ 
+diff -Naur gcc-4.9.4.orig/libstdc++-v3/config/os/generic/os_defines.h 
gcc-4.9.4/libstdc++-v3/config/os/generic/os_defines.h
+--- gcc-4.9.4.orig/libstdc++-v3/config/os/generic/os_defines.h 2016-12-24 
16:16:55.523715643 -0800
++++ gcc-4.9.4/libstdc++-v3/config/os/generic/os_defines.h      2016-12-24 
16:44:10.273380874 -0800
+@@ -33,4 +33,9 @@
+ // System-specific #define, typedefs, corrections, etc, go here.  This
+ // file will come before all others.
+ 
++// Disable the weak reference logic in gthr.h for os/generic because it
++// is broken on every platform unless there is implementation specific
++// workaround in gthr-posix.h and at link-time for static linking.
++#define _GLIBCXX_GTHREAD_USE_WEAK 0
++
+ #endif

diff --git a/sys-devel/gcc/files/4.9.4/posix_memalign.patch 
b/sys-devel/gcc/files/4.9.4/posix_memalign.patch
new file mode 100644
index 0000000..716aad4
--- /dev/null
+++ b/sys-devel/gcc/files/4.9.4/posix_memalign.patch
@@ -0,0 +1,29 @@
+diff -Naur gcc-4.9.4.orig/gcc/config/i386/pmm_malloc.h 
gcc-4.9.4/gcc/config/i386/pmm_malloc.h
+--- gcc-4.9.4.orig/gcc/config/i386/pmm_malloc.h        2016-12-24 
16:17:07.001825547 -0800
++++ gcc-4.9.4/gcc/config/i386/pmm_malloc.h     2016-12-24 16:20:25.242723710 
-0800
+@@ -27,12 +27,13 @@
+ #include <stdlib.h>
+ 
+ /* We can't depend on <stdlib.h> since the prototype of posix_memalign
+-   may not be visible.  */
++   may not be visible and we can't pollute the namespace either.  */
+ #ifndef __cplusplus
+-extern int posix_memalign (void **, size_t, size_t);
++extern int __gcc_posix_memalign (void **, size_t, size_t)
+ #else
+-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
++extern "C" int __gcc_posix_memalign (void **, size_t, size_t) throw ()
+ #endif
++__asm__("posix_memalign");
+ 
+ static __inline void *
+ _mm_malloc (size_t size, size_t alignment)
+@@ -42,7 +43,7 @@
+     return malloc (size);
+   if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4))
+     alignment = sizeof (void *);
+-  if (posix_memalign (&ptr, alignment, size) == 0)
++  if (__gcc_posix_memalign (&ptr, alignment, size) == 0)
+     return ptr;
+   else
+     return NULL;

diff --git a/sys-devel/gcc/files/5.4.0/cilkrts.patch 
b/sys-devel/gcc/files/5.4.0/cilkrts.patch
new file mode 100644
index 0000000..8fed5c2
--- /dev/null
+++ b/sys-devel/gcc/files/5.4.0/cilkrts.patch
@@ -0,0 +1,46 @@
+diff -Naur gcc-5.4.0.orig/libcilkrts/runtime/os-unix.c 
gcc-5.4.0/libcilkrts/runtime/os-unix.c
+--- gcc-5.4.0.orig/libcilkrts/runtime/os-unix.c        2014-05-21 
04:08:58.000000000 -0700
++++ gcc-5.4.0/libcilkrts/runtime/os-unix.c     2016-12-24 15:35:14.225647627 
-0800
+@@ -51,6 +51,7 @@
+ #if defined __linux__
+ #   include <sys/sysinfo.h>
+ #   include <sys/syscall.h>
++#   include <sched.h>
+ #elif defined __APPLE__
+ #   include <sys/sysctl.h>
+     // Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
+@@ -400,28 +401,19 @@
+ 
+ COMMON_SYSDEP void __cilkrts_yield(void)
+ {
+-#if __APPLE__ || __FreeBSD__ || __VXWORKS__
+-    // On MacOS, call sched_yield to yield quantum.  I'm not sure why we
+-    // don't do this on Linux also.
+-    sched_yield();
+-#elif defined(__DragonFly__)
+-    // On DragonFly BSD, call sched_yield to yield quantum.
+-    sched_yield();
+-#elif defined(__MIC__)
++#if defined(__MIC__)
+     // On MIC, pthread_yield() really trashes things.  Arch's measurements
+     // showed that calling _mm_delay_32() (or doing nothing) was a better
+     // option.  Delaying 1024 clock cycles is a reasonable compromise between
+     // giving up the processor and latency starting up when work becomes
+     // available
+     _mm_delay_32(1024);
+-#elif defined(__ANDROID__) || (defined(__sun__) && defined(__svr4__))
+-    // On Android and Solaris, call sched_yield to yield quantum.  I'm not
+-    // sure why we don't do this on Linux also.
+-    sched_yield();
+-#else
+-    // On Linux, call pthread_yield (which in turn will call sched_yield)
+-    // to yield quantum.
++#elif defined(__sun__) && !defined(__svr4__)
++    // On old SunOS call pthread_yield to yield a quantum.
+     pthread_yield();
++#else
++    // On other platforms call sched_yield to yield a quantum.
++    sched_yield();
+ #endif
+ }
+ 

diff --git a/sys-devel/gcc/files/5.4.0/linker_path.patch 
b/sys-devel/gcc/files/5.4.0/linker_path.patch
new file mode 100644
index 0000000..a2584d4
--- /dev/null
+++ b/sys-devel/gcc/files/5.4.0/linker_path.patch
@@ -0,0 +1,213 @@
+diff -Naur gcc-5.4.0.orig/gcc/config/aarch64/aarch64-linux.h 
gcc-5.4.0/gcc/config/aarch64/aarch64-linux.h
+--- gcc-5.4.0.orig/gcc/config/aarch64/aarch64-linux.h  2015-07-24 
09:00:26.000000000 -0700
++++ gcc-5.4.0/gcc/config/aarch64/aarch64-linux.h       2016-12-24 
14:48:44.236623207 -0800
+@@ -23,6 +23,9 @@
+ 
+ #define GLIBC_DYNAMIC_LINKER 
"/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
+ 
++#undef MUSL_DYNAMIC_LINKER
++#define MUSL_DYNAMIC_LINKER 
"/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
++
+ #undef  ASAN_CC1_SPEC
+ #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
+ 
+diff -Naur gcc-5.4.0.orig/gcc/config/arm/linux-eabi.h 
gcc-5.4.0/gcc/config/arm/linux-eabi.h
+--- gcc-5.4.0.orig/gcc/config/arm/linux-eabi.h 2016-12-24 15:27:49.152307307 
-0800
++++ gcc-5.4.0/gcc/config/arm/linux-eabi.h      2016-12-24 14:50:04.522429254 
-0800
+@@ -77,6 +77,23 @@
+     %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+     %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+ 
++/* For ARM musl currently supports four dynamic linkers:
++   - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
++   - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
++   - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
++   - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
++   musl does not support the legacy OABI mode.
++   All the dynamic linkers live in /lib.
++   We default to soft-float, EL. */
++#undef  MUSL_DYNAMIC_LINKER
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
++#endif
++#define MUSL_DYNAMIC_LINKER \
++  "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+diff -Naur gcc-5.4.0.orig/gcc/config/i386/linux.h 
gcc-5.4.0/gcc/config/i386/linux.h
+--- gcc-5.4.0.orig/gcc/config/i386/linux.h     2015-01-05 04:33:28.000000000 
-0800
++++ gcc-5.4.0/gcc/config/i386/linux.h  2016-12-24 14:50:54.802934056 -0800
+@@ -21,3 +21,6 @@
+ 
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++
++#undef MUSL_DYNAMIC_LINKER
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
+diff -Naur gcc-5.4.0.orig/gcc/config/i386/linux64.h 
gcc-5.4.0/gcc/config/i386/linux64.h
+--- gcc-5.4.0.orig/gcc/config/i386/linux64.h   2015-01-05 04:33:28.000000000 
-0800
++++ gcc-5.4.0/gcc/config/i386/linux64.h        2016-12-24 14:51:15.579142643 
-0800
+@@ -30,3 +30,10 @@
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
++
++#undef MUSL_DYNAMIC_LINKER32
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
++#undef MUSL_DYNAMIC_LINKER64
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
++#undef MUSL_DYNAMIC_LINKERX32
++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
+diff -Naur gcc-5.4.0.orig/gcc/config/microblaze/linux.h 
gcc-5.4.0/gcc/config/microblaze/linux.h
+--- gcc-5.4.0.orig/gcc/config/microblaze/linux.h       2015-05-28 
07:08:19.000000000 -0700
++++ gcc-5.4.0/gcc/config/microblaze/linux.h    2016-12-24 14:58:26.290647241 
-0800
+@@ -28,10 +28,20 @@
+ #undef TLS_NEEDS_GOT
+ #define TLS_NEEDS_GOT 1
+ 
+-#define DYNAMIC_LINKER "/lib/ld.so.1"
++#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++
++#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:;:el}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:el}"
++#endif
++
++#undef MUSL_DYNAMIC_LINKER
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E 
".so.1"
++
+ #undef  SUBTARGET_EXTRA_SPECS
+ #define SUBTARGET_EXTRA_SPECS \
+-  { "dynamic_linker", DYNAMIC_LINKER }
++  { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
+ 
+ #undef LINK_SPEC
+ #define LINK_SPEC "%{shared:-shared} \
+diff -Naur gcc-5.4.0.orig/gcc/config/mips/linux.h 
gcc-5.4.0/gcc/config/mips/linux.h
+--- gcc-5.4.0.orig/gcc/config/mips/linux.h     2015-01-05 04:33:28.000000000 
-0800
++++ gcc-5.4.0/gcc/config/mips/linux.h  2016-12-24 15:01:34.093670361 -0800
+@@ -37,7 +37,13 @@
+ #define UCLIBC_DYNAMIC_LINKERN32 \
+   "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
+ 
++#undef MUSL_DYNAMIC_LINKER32
++#define MUSL_DYNAMIC_LINKER32 
"/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1"
++#undef MUSL_DYNAMIC_LINKER64
++#define MUSL_DYNAMIC_LINKER64 
"/lib/ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1"
++#define MUSL_DYNAMIC_LINKERN32 
"/lib/ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1"
++
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
+ #define GNU_USER_DYNAMIC_LINKERN32 \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+-                         BIONIC_DYNAMIC_LINKERN32)
++                         BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+diff -Naur gcc-5.4.0.orig/gcc/config/rs6000/linux64.h 
gcc-5.4.0/gcc/config/rs6000/linux64.h
+--- gcc-5.4.0.orig/gcc/config/rs6000/linux64.h 2015-03-09 16:18:57.000000000 
-0700
++++ gcc-5.4.0/gcc/config/rs6000/linux64.h      2016-12-24 15:03:44.985080397 
-0800
+@@ -363,19 +367,32 @@
+ #else
+ #define GLIBC_DYNAMIC_LINKER64 
"%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
+ #endif
++
++#define MUSL_DYNAMIC_LINKER32 \
++  "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
++#define MUSL_DYNAMIC_LINKER64 \
++  "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
++
+ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) \
++  "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) \
++  "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) \
++  "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER32 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
++                       MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
++                       MUSL_DYNAMIC_LINKER64)
+ 
+ #undef  DEFAULT_ASM_ENDIAN
+ #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+diff -Naur gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h 
gcc-5.4.0/gcc/config/rs6000/sysv4.h
+--- gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h   2015-09-24 06:46:45.000000000 
-0700
++++ gcc-5.4.0/gcc/config/rs6000/sysv4.h        2016-12-24 15:08:38.507113094 
-0800
+@@ -757,17 +762,27 @@
+ 
+ #define LINK_START_LINUX_SPEC ""
+ 
++#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
++
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER \
++  "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) \
++  "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) \
++  "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) \
++  "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
++                       MUSL_DYNAMIC_LINKER)
+ 
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+diff -Naur gcc-5.4.0.orig/gcc/config/sh/linux.h gcc-5.4.0/gcc/config/sh/linux.h
+--- gcc-5.4.0.orig/gcc/config/sh/linux.h       2015-01-05 04:33:28.000000000 
-0800
++++ gcc-5.4.0/gcc/config/sh/linux.h    2016-12-24 15:09:54.568853072 -0800
+@@ -43,6 +43,27 @@
+ 
+ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+ 
++#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
++#define MUSL_DYNAMIC_LINKER_E "%{mb:eb}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{!ml:eb}"
++#endif
++
++#if TARGET_CPU_DEFAULT & (MASK_HARD_SH2A_DOUBLE | MASK_SH4)
++/* "-nofpu" if any nofpu option is specified.  */
++#define MUSL_DYNAMIC_LINKER_FP \
++  "%{m1|m2|m2a-nofpu|m3|m4-nofpu|m4-100-nofpu|m4-200-nofpu|m4-300-nofpu|" \
++  "m4-340|m4-400|m4-500|m4al:-nofpu}"
++#else
++/* "-nofpu" if none of the hard fpu options are specified.  */
++#define MUSL_DYNAMIC_LINKER_FP "%{m2a|m4|m4-100|m4-200|m4-300|m4a:;:-nofpu}"
++#endif
++
++#undef MUSL_DYNAMIC_LINKER
++#define MUSL_DYNAMIC_LINKER \
++  "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
++  "%{mfdpic:-fdpic}.so.1"
++
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+ 
+ #undef SUBTARGET_LINK_EMUL_SUFFIX

diff --git a/sys-devel/gcc/files/5.4.0/musl.patch 
b/sys-devel/gcc/files/5.4.0/musl.patch
new file mode 100644
index 0000000..c1541b2
--- /dev/null
+++ b/sys-devel/gcc/files/5.4.0/musl.patch
@@ -0,0 +1,502 @@
+diff -Naur gcc-5.4.0.orig/fixincludes/mkfixinc.sh 
gcc-5.4.0/fixincludes/mkfixinc.sh
+--- gcc-5.4.0.orig/fixincludes/mkfixinc.sh     2012-10-28 14:42:48.000000000 
-0700
++++ gcc-5.4.0/fixincludes/mkfixinc.sh  2016-12-24 14:47:04.324620119 -0800
+@@ -19,7 +19,8 @@
+     powerpc-*-eabi*    | \
+     powerpc-*-rtems*   | \
+     powerpcle-*-eabisim* | \
+-    powerpcle-*-eabi* )
++    powerpcle-*-eabi* | \
++    *-musl* )
+       #  IF there is no include fixing,
+       #  THEN create a no-op fixer and exit
+       (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
+diff -Naur gcc-5.4.0.orig/gcc/config/glibc-stdint.h 
gcc-5.4.0/gcc/config/glibc-stdint.h
+--- gcc-5.4.0.orig/gcc/config/glibc-stdint.h   2015-01-05 04:33:28.000000000 
-0800
++++ gcc-5.4.0/gcc/config/glibc-stdint.h        2016-12-24 15:24:46.234527766 
-0800
+@@ -22,6 +22,12 @@
+ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ <http://www.gnu.org/licenses/>.  */
+ 
++/* Systems using musl libc should use this header and make sure
++   OPTION_MUSL is defined correctly before using the TYPE macros. */
++#ifndef OPTION_MUSL
++#define OPTION_MUSL 0
++#endif
++
+ #define SIG_ATOMIC_TYPE "int"
+ 
+ #define INT8_TYPE "signed char"
+@@ -43,12 +49,12 @@
+ #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long 
long unsigned int")
+ 
+ #define INT_FAST8_TYPE "signed char"
+-#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
+-#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
++#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : 
"int")
++#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : 
"int")
+ #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
+ #define UINT_FAST8_TYPE "unsigned char"
+-#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : 
"unsigned int")
+-#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : 
"unsigned int")
++#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long 
unsigned int" : "unsigned int")
++#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long 
unsigned int" : "unsigned int")
+ #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long 
long unsigned int")
+ 
+ #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
+diff -Naur gcc-5.4.0.orig/gcc/config/linux.c gcc-5.4.0/gcc/config/linux.c
+--- gcc-5.4.0.orig/gcc/config/linux.c  2015-01-05 04:33:28.000000000 -0800
++++ gcc-5.4.0/gcc/config/linux.c       2016-12-24 15:35:58.913083568 -0800
+@@ -26,7 +26,7 @@
+ bool
+ linux_libc_has_function (enum function_class fn_class)
+ {
+-  if (OPTION_GLIBC)
++  if (OPTION_GLIBC || OPTION_MUSL)
+     return true;
+   if (OPTION_BIONIC)
+     if (fn_class == function_c94
+diff -Naur gcc-5.4.0.orig/gcc/config/linux.h gcc-5.4.0/gcc/config/linux.h
+--- gcc-5.4.0.orig/gcc/config/linux.h  2015-01-05 04:33:28.000000000 -0800
++++ gcc-5.4.0/gcc/config/linux.h       2016-12-24 14:55:26.718712791 -0800
+@@ -32,10 +32,14 @@
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
++#undef OPTION_MUSL
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
+ #else
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
++#undef OPTION_MUSL
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
+ #endif
+ 
+ #define GNU_USER_TARGET_OS_CPP_BUILTINS()                     \
+@@ -50,21 +54,25 @@
+     } while (0)
+ 
+ /* Determine which dynamic linker to use depending on whether GLIBC or
+-   uClibc or Bionic is the default C library and whether
+-   -muclibc or -mglibc or -mbionic has been passed to change the default.  */
++   uClibc or Bionic or musl is the default C library and whether
++   -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
++   the default.  */
+ 
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)    \
+-  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, 
LD4)        \
++  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
+ 
+ #if DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
+ #elif DEFAULT_LIBC == LIBC_BIONIC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif /* DEFAULT_LIBC */
+@@ -81,24 +89,101 @@
+ #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
+ #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
+ #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
++/* Should be redefined for each target that supports musl.  */
++#define MUSL_DYNAMIC_LINKER "/dev/null"
++#define MUSL_DYNAMIC_LINKER32 "/dev/null"
++#define MUSL_DYNAMIC_LINKER64 "/dev/null"
++#define MUSL_DYNAMIC_LINKERX32 "/dev/null"
+ 
+ #define GNU_USER_DYNAMIC_LINKER                                               
\
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
+-                       BIONIC_DYNAMIC_LINKER)
++                       BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define GNU_USER_DYNAMIC_LINKER32                                     \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
+-                       BIONIC_DYNAMIC_LINKER32)
++                       BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64                                     \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
+-                       BIONIC_DYNAMIC_LINKER64)
++                       BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #define GNU_USER_DYNAMIC_LINKERX32                                    \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
+-                       BIONIC_DYNAMIC_LINKERX32)
++                       BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
+ 
+ /* Whether we have Bionic libc runtime */
+ #undef TARGET_HAS_BIONIC
+ #define TARGET_HAS_BIONIC (OPTION_BIONIC)
+ 
++/* musl avoids problematic includes by rearranging the include directories.
++ * Unfortunately, this is mostly duplicated from cppdefault.c */
++#if DEFAULT_LIBC == LIBC_MUSL
++#define INCLUDE_DEFAULTS_MUSL_GPP                     \
++    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,             \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },         \
++    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,                \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },         \
++    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,    \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
++
++#ifdef LOCAL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_LOCAL                   \
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },             \
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_LOCAL
++#endif
++
++#ifdef PREFIX_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_PREFIX                  \
++    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_PREFIX
++#endif
++
++#ifdef CROSS_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_CROSS                   \
++    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#ifdef TOOL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_TOOL                    \
++    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_TOOL
++#endif
++
++#ifdef NATIVE_SYSTEM_HEADER_DIR
++#define INCLUDE_DEFAULTS_MUSL_NATIVE                  \
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 },      \
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_NATIVE
++#endif
++
++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
++# define INCLUDE_DEFAULTS_MUSL_LOCAL
++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
++# define INCLUDE_DEFAULTS_MUSL_NATIVE
++#else
++# undef INCLUDE_DEFAULTS_MUSL_CROSS
++# define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#undef INCLUDE_DEFAULTS
++#define INCLUDE_DEFAULTS                              \
++  {                                                   \
++    INCLUDE_DEFAULTS_MUSL_GPP                         \
++    INCLUDE_DEFAULTS_MUSL_LOCAL                               \
++    INCLUDE_DEFAULTS_MUSL_PREFIX                      \
++    INCLUDE_DEFAULTS_MUSL_CROSS                               \
++    INCLUDE_DEFAULTS_MUSL_TOOL                                \
++    INCLUDE_DEFAULTS_MUSL_NATIVE                      \
++    { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },           \
++    { 0, 0, 0, 0, 0, 0 }                              \
++  }
++#endif
++
+ #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
+ /* This is a *uclinux* target.  We don't define below macros to normal linux
+    versions, because doing so would require *uclinux* targets to include
+diff -Naur gcc-5.4.0.orig/gcc/config/linux.opt gcc-5.4.0/gcc/config/linux.opt
+--- gcc-5.4.0.orig/gcc/config/linux.opt        2015-01-05 04:33:28.000000000 
-0800
++++ gcc-5.4.0/gcc/config/linux.opt     2016-12-24 14:56:23.784327534 -0800
+@@ -28,5 +28,9 @@
+ Use GNU C library
+ 
+ muclibc
+-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
++Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl)
+ Use uClibc C library
++
++mmusl
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic)
++Use musl C library.
+diff -Naur gcc-5.4.0.orig/gcc/config/rs6000/linux64.h 
gcc-5.4.0/gcc/config/rs6000/linux64.h
+--- gcc-5.4.0.orig/gcc/config/rs6000/linux64.h 2015-03-09 16:18:57.000000000 
-0700
++++ gcc-5.4.0/gcc/config/rs6000/linux64.h      2016-12-24 15:03:44.985080397 
-0800
+@@ -299,10 +299,14 @@
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
++#undef OPTION_MUSL
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
+ #else
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
++#undef OPTION_MUSL
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
+ #endif
+ 
+ /* Determine what functions are present at the runtime;
+diff -Naur gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h 
gcc-5.4.0/gcc/config/rs6000/sysv4.h
+--- gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h   2015-09-24 06:46:45.000000000 
-0700
++++ gcc-5.4.0/gcc/config/rs6000/sysv4.h        2016-12-24 15:08:38.507113094 
-0800
+@@ -943,3 +959,73 @@
+ /* This target uses the sysv4.opt file.  */
+ #define TARGET_USES_SYSV4_OPT 1
+ 
++/* Include order changes for musl, same as in generic linux.h.  */
++#if DEFAULT_LIBC == LIBC_MUSL
++#define INCLUDE_DEFAULTS_MUSL_GPP                     \
++    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,             \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },         \
++    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,                \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },         \
++    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,    \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
++
++#ifdef LOCAL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_LOCAL                   \
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },             \
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_LOCAL
++#endif
++
++#ifdef PREFIX_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_PREFIX                  \
++    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_PREFIX
++#endif
++
++#ifdef CROSS_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_CROSS                   \
++    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#ifdef TOOL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_TOOL                    \
++    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_TOOL
++#endif
++
++#ifdef NATIVE_SYSTEM_HEADER_DIR
++#define INCLUDE_DEFAULTS_MUSL_NATIVE                  \
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 },      \
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_NATIVE
++#endif
++
++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
++# define INCLUDE_DEFAULTS_MUSL_LOCAL
++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
++# define INCLUDE_DEFAULTS_MUSL_NATIVE
++#else
++# undef INCLUDE_DEFAULTS_MUSL_CROSS
++# define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#undef INCLUDE_DEFAULTS
++#define INCLUDE_DEFAULTS                              \
++  {                                                   \
++    INCLUDE_DEFAULTS_MUSL_GPP                         \
++    INCLUDE_DEFAULTS_MUSL_LOCAL                               \
++    INCLUDE_DEFAULTS_MUSL_PREFIX                      \
++    INCLUDE_DEFAULTS_MUSL_CROSS                               \
++    INCLUDE_DEFAULTS_MUSL_TOOL                                \
++    INCLUDE_DEFAULTS_MUSL_NATIVE                      \
++    { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },           \
++    { 0, 0, 0, 0, 0, 0 }                              \
++  }
++#endif
+diff -Naur gcc-5.4.0.orig/gcc/config.gcc gcc-5.4.0/gcc/config.gcc
+--- gcc-5.4.0.orig/gcc/config.gcc      2016-12-24 15:28:09.922509373 -0800
++++ gcc-5.4.0/gcc/config.gcc   2016-12-24 15:39:19.482040184 -0800
+@@ -575,7 +575,7 @@
+ esac
+ 
+ # Common C libraries.
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
+ 
+ # 32-bit x86 processors supported by --with-arch=.  Each processor
+ # MUST be separated by exactly one space.
+@@ -720,6 +720,9 @@
+     *-*-*uclibc*)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
+       ;;
++    *-*-*musl*)
++      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
++      ;;
+     *)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+       ;;
+@@ -1438,7 +1441,7 @@
+               extra_options="${extra_options} linux-android.opt"
+               # Assume modern glibc if not targeting Android nor uclibc.
+               case ${target} in
+-              *-*-*android*|*-*-*uclibc*)
++              *-*-*android*|*-*-*uclibc*|*-*-*musl*)
+                 ;;
+               *)
+                 default_gnu_indirect_function=yes
+@@ -1507,7 +1510,7 @@
+               extra_options="${extra_options} linux-android.opt"
+               # Assume modern glibc if not targeting Android nor uclibc.
+               case ${target} in
+-              *-*-*android*|*-*-*uclibc*)
++              *-*-*android*|*-*-*uclibc*|*-*-*musl*)
+                 ;;
+               *)
+                 default_gnu_indirect_function=yes
+diff -Naur gcc-5.4.0.orig/gcc/configure gcc-5.4.0/gcc/configure
+--- gcc-5.4.0.orig/gcc/configure       2016-12-24 15:28:54.117939552 -0800
++++ gcc-5.4.0/gcc/configure    2016-12-24 15:13:46.057105137 -0800
+@@ -27837,6 +27837,9 @@
+ else
+   gcc_cv_libc_provides_ssp=no
+     case "$target" in
++       *-*-musl*)
++       # All versions of musl provide stack protector
++       gcc_cv_libc_provides_ssp=yes;;
+        *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+       # glibc 2.4 and later provides __stack_chk_fail and
+       # either __stack_chk_guard, or TLS access to stack guard canary.
+@@ -27869,6 +27872,7 @@
+        # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
+        # simply assert that glibc does provide this, which is true for all
+        # realistically usable GNU/Hurd configurations.
++       # All supported versions of musl provide it as well
+        gcc_cv_libc_provides_ssp=yes;;
+        *-*-darwin* | *-*-freebsd*)
+        ac_fn_c_check_func "$LINENO" "__stack_chk_fail" 
"ac_cv_func___stack_chk_fail"
+@@ -27965,6 +27969,9 @@
+       gcc_cv_target_dl_iterate_phdr=no
+     fi
+     ;;
++  *-linux-musl*)
++    gcc_cv_target_dl_iterate_phdr=yes
++    ;;
+ esac
+ 
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+diff -Naur gcc-5.4.0.orig/gcc/configure.ac gcc-5.4.0/gcc/configure.ac
+--- gcc-5.4.0.orig/gcc/configure.ac    2016-12-24 15:28:32.129725419 -0800
++++ gcc-5.4.0/gcc/configure.ac 2016-12-24 15:14:52.372750299 -0800
+@@ -5287,6 +5287,9 @@
+       gcc_cv_libc_provides_ssp,
+       [gcc_cv_libc_provides_ssp=no
+     case "$target" in
++       *-*-musl*)
++       # All versions of musl provide stack protector
++       gcc_cv_libc_provides_ssp=yes;;
+        *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+       # glibc 2.4 and later provides __stack_chk_fail and
+       # either __stack_chk_guard, or TLS access to stack guard canary.
+@@ -5313,6 +5316,7 @@
+        # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
+        # simply assert that glibc does provide this, which is true for all
+        # realistically usable GNU/Hurd configurations.
++       # All supported versions of musl provide it as well
+        gcc_cv_libc_provides_ssp=yes;;
+        *-*-darwin* | *-*-freebsd*)
+        AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
+@@ -5386,6 +5390,9 @@
+       gcc_cv_target_dl_iterate_phdr=no
+     fi
+     ;;
++  *-linux-musl*)
++    gcc_cv_target_dl_iterate_phdr=yes
++    ;;
+ esac
+ GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+diff -Naur gcc-5.4.0.orig/libgcc/unwind-dw2-fde-dip.c 
gcc-5.4.0/libgcc/unwind-dw2-fde-dip.c
+--- gcc-5.4.0.orig/libgcc/unwind-dw2-fde-dip.c 2015-01-27 02:02:26.000000000 
-0800
++++ gcc-5.4.0/libgcc/unwind-dw2-fde-dip.c      2016-12-24 15:16:56.850961302 
-0800
+@@ -59,6 +59,12 @@
+ 
+ #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+     && defined(TARGET_DL_ITERATE_PHDR) \
++    && defined(__linux__)
++# define USE_PT_GNU_EH_FRAME
++#endif
++
++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
++    && defined(TARGET_DL_ITERATE_PHDR) \
+     && (defined(__DragonFly__) || defined(__FreeBSD__))
+ # define ElfW __ElfN
+ # define USE_PT_GNU_EH_FRAME
+diff -Naur gcc-5.4.0.orig/libitm/config/arm/hwcap.cc 
gcc-5.4.0/libitm/config/arm/hwcap.cc
+--- gcc-5.4.0.orig/libitm/config/arm/hwcap.cc  2015-01-05 04:33:28.000000000 
-0800
++++ gcc-5.4.0/libitm/config/arm/hwcap.cc       2016-12-24 15:19:01.076169845 
-0800
+@@ -40,7 +40,7 @@
+ 
+ #ifdef __linux__
+ #include <unistd.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <elf.h>
+ 
+ static void __attribute__((constructor))
+diff -Naur gcc-5.4.0.orig/libitm/config/linux/x86/tls.h 
gcc-5.4.0/libitm/config/linux/x86/tls.h
+--- gcc-5.4.0.orig/libitm/config/linux/x86/tls.h       2015-01-05 
04:33:28.000000000 -0800
++++ gcc-5.4.0/libitm/config/linux/x86/tls.h    2016-12-24 15:20:21.897956131 
-0800
+@@ -25,16 +25,19 @@
+ #ifndef LIBITM_X86_TLS_H
+ #define LIBITM_X86_TLS_H 1
+ 
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ /* Use slots in the TCB head rather than __thread lookups.
+    GLIBC has reserved words 10 through 13 for TM.  */
+ #define HAVE_ARCH_GTM_THREAD 1
+ #define HAVE_ARCH_GTM_THREAD_DISP 1
+ #endif
++#endif
+ 
+ #include "config/generic/tls.h"
+ 
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ namespace GTM HIDDEN {
+ 
+ #ifdef __x86_64__
+@@ -101,5 +104,6 @@
+ 
+ } // namespace GTM
+ #endif /* >= GLIBC 2.10 */
++#endif
+ 
+ #endif // LIBITM_X86_TLS_H
+diff -Naur gcc-5.4.0.orig/libstdc++-v3/configure.host 
gcc-5.4.0/libstdc++-v3/configure.host
+--- gcc-5.4.0.orig/libstdc++-v3/configure.host 2015-06-24 02:59:28.000000000 
-0700
++++ gcc-5.4.0/libstdc++-v3/configure.host      2016-12-24 15:21:16.012482591 
-0800
+@@ -273,6 +273,9 @@
+   freebsd*)
+     os_include_dir="os/bsd/freebsd"
+     ;;
++  linux-musl*)
++    os_include_dir="os/generic"
++    ;;
+   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
+     if [ "$uclibc" = "yes" ]; then
+       os_include_dir="os/uclibc"

diff --git a/sys-devel/gcc/files/5.4.0/ppc-secure_plt.patch 
b/sys-devel/gcc/files/5.4.0/ppc-secure_plt.patch
new file mode 100644
index 0000000..4e7f9d4
--- /dev/null
+++ b/sys-devel/gcc/files/5.4.0/ppc-secure_plt.patch
@@ -0,0 +1,59 @@
+diff -Naur gcc-5.4.0.orig/gcc/config/rs6000/secureplt.h 
gcc-5.4.0/gcc/config/rs6000/secureplt.h
+--- gcc-5.4.0.orig/gcc/config/rs6000/secureplt.h       2015-01-05 
04:33:28.000000000 -0800
++++ gcc-5.4.0/gcc/config/rs6000/secureplt.h    2016-12-24 15:04:26.850531396 
-0800
+@@ -18,3 +18,4 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
+diff -Naur gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h 
gcc-5.4.0/gcc/config/rs6000/sysv4.h
+--- gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h   2015-09-24 06:46:45.000000000 
-0700
++++ gcc-5.4.0/gcc/config/rs6000/sysv4.h        2016-12-24 15:08:38.507113094 
-0800
+@@ -537,6 +537,9 @@
+ #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
+ #define CC1_SECURE_PLT_DEFAULT_SPEC ""
+ #endif
++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
++#endif
+ 
+ /* Pass -G xxx to the compiler.  */
+ #undef CC1_SPEC
+@@ -567,6 +570,7 @@
+                : %(link_start_default)     }"
+ 
+ #define LINK_START_DEFAULT_SPEC ""
++#define LINK_SECURE_PLT_SPEC LINK_SECURE_PLT_DEFAULT_SPEC
+ 
+ #undef        LINK_SPEC
+ #define       LINK_SPEC "\
+@@ -574,6 +578,7 @@
+ %{R*} \
+ %(link_shlib) \
+ %{!T*: %(link_start) } \
++%{!static: %{!mbss-plt: %(link_secure_plt)}} \
+ %(link_os)"
+ 
+ /* Shared libraries are not default.  */
+@@ -889,6 +904,7 @@
+   { "link_os_openbsd",                LINK_OS_OPENBSD_SPEC },                 
\
+   { "link_os_default",                LINK_OS_DEFAULT_SPEC },                 
\
+   { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC },          \
++  { "link_secure_plt",                LINK_SECURE_PLT_SPEC },                 
\
+   { "cpp_os_ads",             CPP_OS_ADS_SPEC },                      \
+   { "cpp_os_yellowknife",     CPP_OS_YELLOWKNIFE_SPEC },              \
+   { "cpp_os_mvme",            CPP_OS_MVME_SPEC },                     \
+diff -Naur gcc-5.4.0.orig/gcc/config.gcc gcc-5.4.0/gcc/config.gcc
+--- gcc-5.4.0.orig/gcc/config.gcc      2016-12-24 15:28:09.922509373 -0800
++++ gcc-5.4.0/gcc/config.gcc   2016-12-24 15:39:19.482040184 -0800
+@@ -2413,6 +2416,10 @@
+           powerpc*-*-linux*paired*)
+               tm_file="${tm_file} rs6000/750cl.h" ;;
+       esac
++      case ${target} in
++          *-linux*-musl*)
++              enable_secureplt=yes ;;
++      esac
+       if test x${enable_secureplt} = xyes; then
+               tm_file="rs6000/secureplt.h ${tm_file}"
+       fi

diff --git a/sys-devel/gcc/files/6.3.0/musl.patch 
b/sys-devel/gcc/files/6.3.0/musl.patch
new file mode 100644
index 0000000..03a5dc2
--- /dev/null
+++ b/sys-devel/gcc/files/6.3.0/musl.patch
@@ -0,0 +1,63 @@
+diff -Naur gcc-6.2.0.orig/gcc/config/i386/i386.c 
gcc-6.2.0/gcc/config/i386/i386.c
+--- gcc-6.2.0.orig/gcc/config/i386/i386.c      2016-12-24 15:55:23.355343088 
-0800
++++ gcc-6.2.0/gcc/config/i386/i386.c   2016-12-24 15:55:58.718681693 -0800
+@@ -40325,10 +40325,10 @@
+     {
+     case IX86_BUILTIN_CPU_INIT:
+       {
+-      /* Make it call __cpu_indicator_init in libgcc. */
++      /* Make it call __cpu_indicator_init_local in libgcc. */
+       tree call_expr, fndecl, type;
+         type = build_function_type_list (integer_type_node, NULL_TREE); 
+-      fndecl = build_fn_decl ("__cpu_indicator_init", type);
++      fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
+       call_expr = build_call_expr (fndecl, 0); 
+       return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
+       }
+diff -Naur gcc-6.2.0.orig/gcc/config/linux.c gcc-6.2.0/gcc/config/linux.c
+--- gcc-6.2.0.orig/gcc/config/linux.c  2016-12-24 15:55:23.308342638 -0800
++++ gcc-6.2.0/gcc/config/linux.c       2016-12-24 16:00:51.852488459 -0800
+@@ -26,7 +26,7 @@
+ bool
+ linux_libc_has_function (enum function_class fn_class)
+ {
+-  if (OPTION_GLIBC)
++  if (OPTION_GLIBC || OPTION_MUSL)
+     return true;
+   if (OPTION_BIONIC)
+     if (fn_class == function_c94
+diff -Naur gcc-6.2.0.orig/gcc/config.gcc gcc-6.2.0/gcc/config.gcc
+--- gcc-6.2.0.orig/gcc/config.gcc      2016-12-24 15:55:15.957272251 -0800
++++ gcc-6.2.0/gcc/config.gcc   2016-12-24 16:02:12.297258721 -0800
+@@ -1484,7 +1484,7 @@
+               extra_options="${extra_options} linux-android.opt"
+               # Assume modern glibc if not targeting Android nor uclibc.
+               case ${target} in
+-              *-*-*android*|*-*-*uclibc*)
++              *-*-*android*|*-*-*uclibc*|*-*-*musl*)
+                 ;;
+               *)
+                 default_gnu_indirect_function=yes
+@@ -1553,7 +1553,7 @@
+               extra_options="${extra_options} linux-android.opt"
+               # Assume modern glibc if not targeting Android nor uclibc.
+               case ${target} in
+-              *-*-*android*|*-*-*uclibc*)
++              *-*-*android*|*-*-*uclibc*|*-*-*musl*)
+                 ;;
+               *)
+                 default_gnu_indirect_function=yes
+diff -Naur gcc-6.2.0.orig/libgcc/config/i386/cpuinfo.c 
gcc-6.2.0/libgcc/config/i386/cpuinfo.c
+--- gcc-6.2.0.orig/libgcc/config/i386/cpuinfo.c        2016-12-24 
15:55:15.817270911 -0800
++++ gcc-6.2.0/libgcc/config/i386/cpuinfo.c     2016-12-24 15:57:05.399320163 
-0800
+@@ -485,7 +485,7 @@
+   return 0;
+ }
+ 
+-#if defined SHARED && defined USE_ELF_SYMVER
+-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
+-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
++#ifndef SHARED
++int __cpu_indicator_init_local (void)
++  __attribute__ ((weak, alias ("__cpu_indicator_init")));
+ #endif

diff --git a/sys-devel/gcc/files/fix_libtool_files.sh 
b/sys-devel/gcc/files/fix_libtool_files.sh
index 97fb91c..eb96df2 100644
--- a/sys-devel/gcc/files/fix_libtool_files.sh
+++ b/sys-devel/gcc/files/fix_libtool_files.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -38,10 +38,9 @@ ARGV2=$2
 ARGV3=$3
 
 . /etc/profile || exit 1
-. /etc/init.d/functions.sh || exit 1
 
 if [ ${EUID:-0} -ne 0 ] ; then
-       eerror "${0##*/}: Must be root."
+       echo "${0##*/}: Must be root."
        exit 1
 fi
 
@@ -54,7 +53,7 @@ OLDCHOST=
 AWKDIR="/usr/share/gcc-data"
 
 if [ ! -r "${AWKDIR}/fixlafiles.awk" ] ; then
-       eerror "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!"
+       echo "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!"
        exit 1
 fi
 
@@ -62,7 +61,7 @@ OLDVER=${ARGV1}
 
 export OLDVER OLDCHOST
 
-einfo "Scanning libtool files for hardcoded gcc library paths..."
+echo "Scanning libtool files for hardcoded gcc library paths..."
 exec gawk -f "${AWKDIR}/fixlafiles.awk"
 
 # vim:ts=4

diff --git a/sys-devel/gcc/files/gcc-5.4.0-pr68470.patch 
b/sys-devel/gcc/files/gcc-5.4.0-pr68470.patch
new file mode 100644
index 0000000..7f314cf
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-5.4.0-pr68470.patch
@@ -0,0 +1,57 @@
+diff -Naur gcc-5.4.0.orig/gcc/ipa-split.c gcc-5.4.0/gcc/ipa-split.c
+--- gcc-5.4.0.orig/gcc/ipa-split.c     2016-03-30 05:27:12.000000000 -0700
++++ gcc-5.4.0/gcc/ipa-split.c  2016-12-24 17:10:50.205152721 -0800
+@@ -1246,7 +1246,6 @@
+   edge e;
+   edge_iterator ei;
+   tree retval = NULL, real_retval = NULL, retbnd = NULL;
+-  bool split_part_return_p = false;
+   bool with_bounds = chkp_function_instrumented_p (current_function_decl);
+   gimple last_stmt = NULL;
+   unsigned int i;
+@@ -1287,12 +1286,28 @@
+       args_to_pass.safe_push (arg);
+       }
+ 
+-  /* See if the split function will return.  */
++  /* See if the split function or the main part will return.  */
++  bool main_part_return_p = false;
++  bool split_part_return_p = false;
+   FOR_EACH_EDGE (e, ei, return_bb->preds)
+-    if (bitmap_bit_p (split_point->split_bbs, e->src->index))
+-      break;
+-  if (e)
+-    split_part_return_p = true;
++    {
++      if (bitmap_bit_p (split_point->split_bbs, e->src->index))
++      split_part_return_p = true;
++      else
++      main_part_return_p = true;
++    }
++  /* The main part also returns if we we split on a fallthru edge
++     and the split part returns.  */
++  if (split_part_return_p)
++    FOR_EACH_EDGE (e, ei, split_point->entry_bb->preds)
++      {
++      if (! bitmap_bit_p (split_point->split_bbs, e->src->index)
++          && single_succ_p (e->src))
++        {
++          main_part_return_p = true;
++          break;
++        }
++      }
+ 
+   /* Add return block to what will become the split function.
+      We do not return; no return block is needed.  */
+@@ -1336,6 +1351,11 @@
+   else
+     bitmap_set_bit (split_point->split_bbs, return_bb->index);
+ 
++  /* If the main part doesn't return pretend the return block wasn't
++     found for all of the following.  */
++  if (! main_part_return_p)
++    return_bb = EXIT_BLOCK_PTR_FOR_FN (cfun);
++
+   /* If RETURN_BB has virtual operand PHIs, they must be removed and the
+      virtual operand marked for renaming as we change the CFG in a way that
+      tree-inline is not able to compensate for.

diff --git a/sys-devel/gcc/files/gcc-6.1.0-musl-cpu.patch 
b/sys-devel/gcc/files/gcc-6.1.0-musl-cpu.patch
deleted file mode 100644
index c11afb5..0000000
--- a/sys-devel/gcc/files/gcc-6.1.0-musl-cpu.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 3d044e8..82523e1 100644
---- a/gcc/config/i386/i386.c
-+++ b/gcc/config/i386/i386.c
-@@ -40269,10 +40269,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx 
subtarget,
-     {
-     case IX86_BUILTIN_CPU_INIT:
-       {
--      /* Make it call __cpu_indicator_init in libgcc. */
-+      /* Make it call __cpu_indicator_init_local in libgcc.a. */
-       tree call_expr, fndecl, type;
-         type = build_function_type_list (integer_type_node, NULL_TREE); 
--      fndecl = build_fn_decl ("__cpu_indicator_init", type);
-+      fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
-       call_expr = build_call_expr (fndecl, 0); 
-       return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
-       }
-diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
-index 8c2248d..6c82f15 100644
---- a/libgcc/config/i386/cpuinfo.c
-+++ b/libgcc/config/i386/cpuinfo.c
-@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
-   return 0;
- }
- 
--#if defined SHARED && defined USE_ELF_SYMVER
--__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
--__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
-+#ifndef SHARED
-+int __cpu_indicator_init_local (void)
-+  __attribute__ ((weak, alias ("__cpu_indicator_init")));
- #endif

diff --git a/sys-devel/gcc/files/mkinfodir b/sys-devel/gcc/files/mkinfodir
deleted file mode 100644
index a62840e..0000000
--- a/sys-devel/gcc/files/mkinfodir
+++ /dev/null
@@ -1,233 +0,0 @@
-#!/bin/bash
-# $Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $
-# Generate the top-level Info node, given a directory of Info files
-# and (optionally) a skeleton file.  The output will be suitable for a
-# top-level dir file.  The skeleton file contains info topic names in the
-# order they should appear in the output.  There are three special
-# lines that alter the behavior: a line consisting of just "--" causes
-# the next line to be echoed verbatim to the output.  A line
-# containing just "%%" causes all the remaining filenames (wildcards
-# allowed) in the rest of the file to be ignored.  A line containing
-# just "!!" exits the script when reached (unless preceded by a line
-# containing just "--").  Once the script reaches the end of the
-# skeleton file, it goes through the remaining files in the directory
-# in order, putting their entries at the end.  The script will use the
-# ENTRY information in each info file if it exists.  Otherwise it will
-# make a minimal entry.
-
-# sent by Jeffrey Osier <jeff...@cygnus.com>, who thinks it came from
-# z...@winternet.com (david d `zoo' zuhn)
-
-# modified 7 April 1995 by Joe Harrington <j...@tecate.gsfc.nasa.gov> to
-# take special flags
-
-INFODIR=$1
-if [ $# = 2 ] ; then
-  SKELETON=$2
-else
-  SKELETON=/dev/null
-fi
-
-skip=
-
-if [ $# -gt 2 ] ; then
-  echo usage: $0 info-directory [ skeleton-file ] 1>&2
-  exit 1
-elif [ -z "${INFODIR}" ] ; then
-  INFODIR="%%DEFAULT_INFO_DIR%%"
-else
-  true
-fi
-
-if [ ! -d ${INFODIR} ] ; then
-  echo "$0: first argument must specify a directory"
-  exit 1
-fi
-
-### output the dir header
-echo "-*- Text -*-"
-echo "This file was generated automatically by $0."
-echo "This version was generated on `date`"
-echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`"
-
-cat << moobler
-\$Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $
-This is the file .../info/dir, which contains the topmost node of the
-Info hierarchy.  The first time you invoke Info you start off
-looking at that node, which is (dir)Top.
-
-File: dir      Node: Top       This is the top of the INFO tree
-
-  This (the Directory node) gives a menu of major topics. 
-  Typing "q" exits, "?" lists all Info commands, "d" returns here,
-  "h" gives a primer for first-timers,
-  "mEmacs<Return>" visits the Emacs topic, etc.
-
-  In Emacs, you can click mouse button 2 on a menu item or cross reference
-  to select it.
-
-* Menu: The list of major topics begins on the next line.
-
-moobler
-
-### go through the list of files in the skeleton.  If an info file
-### exists, grab the ENTRY information from it.  If an entry exists
-### use it, otherwise create a minimal dir entry.
-###
-### Then remove that file from the list of existing files.  If any
-### additional files remain (ones that don't have a skeleton entry), 
-### then generate entries for those in the same way, putting the info for 
-### those at the end....
-
-infofiles=`(cd ${INFODIR}; /bin/ls | grep -v '\-[0-9]*\.gz$' | grep -v 
'\-[0-9]*$' | egrep -v '^dir$|^dir\.info$|^dir\.orig$')`
-
-# echoing gets clobbered by backquotes; we do it the hard way...
-lines=`wc $SKELETON | awk '{print $1}'`
-line=1
-while [ $lines -ge $line ] ; do
-  # Read one line from the file.  This is so that we can echo lines with
-  # whitespace and quoted characters in them.
-  fileline=`awk NR==$line $SKELETON`
-
-  # flag fancy features
-  if [ ! -z "$echoline" ] ; then       # echo line
-    echo "$fileline"
-    fileline=
-    echoline=
-  elif [ "${fileline}" = "--" ] ; then # should we echo the next line?
-    echoline=1
-  elif [ "${fileline}" = "%%" ] ; then # eliminate remaining files from dir?
-    skip=1
-  elif [ "${fileline}" = "!!" ] ; then # quit now
-    exit 0
-  fi
-
-  # handle files if they exist
-  for file in $fileline"" ; do # expand wildcards ("" handles blank lines)
-
-    fname=
-
-    if [ -z "$echoline" -a ! -z "$file" ] ; then
-
-      # Find the file to operate upon.  Check both possible names.
-      infoname=`echo $file | sed 's/\.gz$//'`
-      infoname=`echo $infoname | sed 's/\.info$//'`
-      noext=
-      ext=
-      if [ -f ${INFODIR}/$infoname ] ; then
-        noext=$infoname
-      fi
-      if [ -f ${INFODIR}/${infoname}.info ] ; then
-        ext=${infoname}.info
-      fi
-      if [ -f ${INFODIR}/${infoname}.info.gz ] ; then
-       ext=${infoname}.info.gz
-      fi
-      # If it exists with both names take what was said in the file.
-      if [ ! -z "$ext" -a ! -z "$noext" ]; then
-        fname=$file
-        warn="### Warning: $ext and $noext both exist!  Using ${file}. ###"
-      elif [ ! \( -z "$ext" -a -z "$noext" \) ]; then
-        # just take the name if it exists only once
-        fname=${noext}${ext}
-      fi
-
-      # if we found something and aren't skipping, do the entry
-      if [ ! -z "$fname" ] ; then
-        if [ -z "$skip" ] ; then
-
-          if [ ! -z "$warn" ] ; then   # issue any warning
-           echo $warn
-           warn=
-          fi
-         if [ "${fname##*.}" = "gz" ] ; then
-           entry=`zcat ${INFODIR}/${fname} | sed -e 
'1,/START-INFO-DIR-ENTRY/d' \
-                    -e '/END-INFO-DIR-ENTRY/,$d' `
-         else
-            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
-                    -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$fname`
-         fi
-          if [ ! -z "${entry}" ] ; then
-            echo "${entry}"
-          else
-            echo "* ${infoname}: (${infoname})."
-          fi
-        fi
-
-        # remove the name from the directory listing
-       infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${fname} / /" -e "s/  / 
/g"`
-
-      fi
-
-    fi
-
-  done
-
-  line=`expr $line + 1`
-done
-
-if [ -z "${infofiles}" ] ; then
-  exit 0
-elif [ $lines -gt 0 ]; then
-  echo
-fi
-
-# Sort remaining files by INFO-DIR-SECTION.
-prevsect=
-filesectdata=`(cd ${INFODIR}; fgrep INFO-DIR-SECTION /dev/null ${infofiles} | \
-             fgrep -v 'INFO-DIR-SECTION Miscellaneous' | \
-             sort -t: -k2 -k1 | tr ' ' '_')`
-for sectdata in ${filesectdata}; do
-  file=`echo ${sectdata} | cut -d: -f1`
-  section=`sed -n -e 's/^INFO-DIR-SECTION //p' ${INFODIR}/${file}`
-  infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${file} / /" -e "s/  / /g"`
-
-  if [ "${prevsect}" != "${section}" ] ; then
-    if [ ! -z "${prevsect}" ] ; then
-      echo ""
-    fi
-    echo "${section}"
-    prevsect="${section}"
-  fi
-  infoname=`echo $file | sed 's/\.gz$//'`
-  infoname=`echo $infoname | sed 's/\.info$//'`
-  if [ "${file##*.}" = "gz" ] ; then
-           entry=`zcat ${INFODIR}/$file | sed -e '1,/START-INFO-DIR-ENTRY/d' \
-                    -e '/END-INFO-DIR-ENTRY/,$d' `
-         else
-            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
-                    -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file`
-         fi
-  if [ ! -z "${entry}" ] ; then
-    echo "${entry}"
-  elif [ ! -d "${INFODIR}/${file}" ] ; then
-    echo "* ${infoname}: (${infoname})."
-  fi
-done
-
-# Process miscellaneous files.
-for file in ${infofiles}; do
-  if [ ! -z "${prevsect}" ] ; then
-    echo ""
-    echo "Miscellaneous"
-    prevsect=""
-  fi
-
-  infoname=`echo $file | sed 's/\.gz$//'`
-  infoname=`echo $infoname | sed 's/\.info$//'`
-  if [ "${file##*.}" = "gz" ] ; then
-           entry=`zcat ${INFODIR}/${file} | sed -e '1,/START-INFO-DIR-ENTRY/d' 
\
-                    -e '/END-INFO-DIR-ENTRY/,$d'`
-         else
-            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
-                    -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file`
-         fi
-
-
-  if [ ! -z "${entry}" ] ; then
-    echo "${entry}"
-  elif [ ! -d "${INFODIR}/${file}" ] ; then
-    echo "* ${infoname}: (${infoname})."
-  fi
-done
-

diff --git a/sys-devel/gcc/gcc-5.4.0.ebuild b/sys-devel/gcc/gcc-5.4.0.ebuild
new file mode 100644
index 0000000..8dc1a67
--- /dev/null
+++ b/sys-devel/gcc/gcc-5.4.0.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.5"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+PIE_MUSL_STABLE="amd64 arm ppc mips x86"
+SSP_MUSL_STABLE="amd64 arm ppc mips"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+       elibc_glibc? ( >=sys-libs/glibc-2.8 )
+       >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+       PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+       if has_version '<sys-libs/glibc-2.12' ; then
+               ewarn "Your host glibc is too old; disabling automatic fortify."
+               ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 
#362315"
+               EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+       fi
+       is_crosscompile && EPATCH_EXCLUDE+=" 05_all_gcc-spec-env.patch"
+
+       toolchain_src_prepare
+
+       # Upstream Patch
+       epatch "${FILESDIR}"/${PN}-4.9.3-tree-vect-data-refs-correctness.patch
+       epatch "${FILESDIR}"/${PN}-5.4.0-pr68470.patch
+
+       if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
+               epatch "${FILESDIR}"/4.9.4/gthread.patch
+               epatch "${FILESDIR}"/4.9.4/boehm_gc.patch
+               epatch "${FILESDIR}"/4.9.4/posix_memalign.patch
+               epatch "${FILESDIR}"/5.4.0/cilkrts.patch
+               epatch "${FILESDIR}"/5.4.0/linker_path.patch
+               epatch "${FILESDIR}"/5.4.0/musl.patch
+               epatch "${FILESDIR}"/5.4.0/ppc-secure_plt.patch
+       fi
+}

diff --git a/sys-devel/gcc/gcc-6.1.0.ebuild b/sys-devel/gcc/gcc-6.1.0.ebuild
deleted file mode 100644
index 837ef48..0000000
--- a/sys-devel/gcc/gcc-6.1.0.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="4"
-
-PATCH_VER="1.0"
-#UCLIBC_VER="1.0"
-
-# Hardened gcc 4 stuff
-#PIE_VER="0.6.5"
-#SPECS_VER="0.2.0"
-#SPECS_GCC_VER="4.4.3"
-# arch/libc configurations known to be stable with {PIE,SSP}-by-default
-#PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
-#PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
-#SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
-# uclibc need tls and nptl support for SSP support
-# uclibc need to be >= 0.9.33
-#SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
-PIE_MUSL_STABLE="amd64 arm ppc mips x86"
-SSP_MUSL_STABLE="amd64 arm ppc mips"
-#end Hardened stuff
-
-inherit toolchain
-
-KEYWORDS=""
-
-RDEPEND=""
-DEPEND="${RDEPEND}
-       elibc_glibc? ( >=sys-libs/glibc-2.8 )
-       >=${CATEGORY}/binutils-2.20"
-
-if [[ ${CATEGORY} != cross-* ]] ; then
-       PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
-fi
-
-src_prepare() {
-
-       toolchain_src_prepare
-       if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
-               epatch "${FILESDIR}"/${P}-musl-cpu.patch
-       fi
-}

diff --git a/sys-devel/gcc/gcc-6.3.0.ebuild b/sys-devel/gcc/gcc-6.3.0.ebuild
new file mode 100644
index 0000000..cffb62e
--- /dev/null
+++ b/sys-devel/gcc/gcc-6.3.0.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+PATCH_VER="1.0"
+#UCLIBC_VER="1.0"
+
+inherit eutils toolchain
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+       elibc_glibc? ( >=sys-libs/glibc-2.13 )
+       >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+       PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.13 )"
+fi
+
+src_prepare() {
+       toolchain_src_prepare
+
+       if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
+               epatch "${FILESDIR}"/4.9.4/boehm_gc.patch
+               epatch "${FILESDIR}"/4.9.4/posix_memalign.patch
+               epatch "${FILESDIR}"/5.4.0/cilkrts.patch
+               epatch "${FILESDIR}"/6.3.0/musl.patch
+       fi
+}

diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml
index e875d77..43abab0 100644
--- a/sys-devel/gcc/metadata.xml
+++ b/sys-devel/gcc/metadata.xml
@@ -9,25 +9,28 @@
     <flag name="awt">Useful only when building GCJ, this enables Abstract 
Window Toolkit
       (AWT) peer support on top of GTK+</flag>
     <flag name="cilk">Support the Cilk Plus language (C/C++ based languages 
for parallel programming)</flag>
+    <flag name="d">Enable support for the D programming language</flag>
     <flag name="fixed-point">Enable fixed-point arithmetic support for MIPS 
targets 
       in gcc (Warning: significantly increases compile time!)</flag>
     <flag name="go">Build the GCC Go language frontend.</flag>
     <flag name="graphite">Add support for the framework for loop
       optimizations based on a polyhedral intermediate representation</flag>
+    <flag name="jit">Enable libgccjit so other applications can embed gcc for 
Just-In-Time compilation.
+      This will slow down the compiler a bit as it forces all of the toolchain 
to be shared libs.</flag>
     <flag name="libssp">Build SSP support into a dedicated library rather than 
use the
       code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT 
DOES)</flag>
+    <flag name="mpx">Enable support for Intel Memory Protection Extensions 
(MPX)</flag>
     <flag name="mudflap">Add support for mudflap, a pointer use checking 
library</flag>
-    <flag name="multislot">Allow for SLOTs to include minor version (3.3.4
-      instead of just 3.3)</flag>
     <flag name="nopie">Disable PIE support (NOT FOR GENERAL USE)</flag>
     <flag name="nossp">Disable SSP support (NOT FOR GENERAL USE)</flag>
-    <flag name="ssp">Enable SSP support</flag>
     <flag name="objc">Build support for the Objective C code language</flag>
     <flag name="objc++">Build support for the Objective C++ language</flag>
     <flag name="objc-gc">Build support for the Objective C code language 
Garbage
       Collector</flag>
     <flag name="regression-test">Run the testsuite and install the results 
(requires FEATURES=test)</flag>
-    <flag name="sanitize">Build support various sanitizer functions 
(ASAN/TSAN/etc...)</flag>
+    <flag name="sanitize">Build support for various sanitizer functions 
(ASAN/TSAN/etc...)</flag>
+    <flag name="ssp">Build packages with stack smashing protector on by 
default</flag>
+    <flag name="vtv">Build support for virtual table verification (a C++ 
hardening feature)</flag>
   </use>
   <upstream>
     <remote-id type="cpe">cpe:/a:gnu:gcc</remote-id>

Reply via email to