public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2017-11-25 15:04 Fabian Groffen
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2017-11-25 15:04 UTC (permalink / raw
  To: gentoo-commits

commit:     dcb1a90da8a6b33bbc651b5d76bd66e27de7b433
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 15:03:11 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 15:03:11 2017 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=dcb1a90d

sys-devel/binutils: cleanup

Package-Manager: Portage-2.3.13-prefix, Repoman-2.3.4
RepoMan-Options: --force

 sys-devel/binutils/Manifest                        |   33 -
 sys-devel/binutils/binutils-2.19.1-r01.1.ebuild    |   41 -
 sys-devel/binutils/binutils-2.20.1-r1.ebuild       |   30 -
 sys-devel/binutils/binutils-2.21.1-r1.ebuild       |   30 -
 sys-devel/binutils/binutils-2.22-r1.ebuild         |   60 -
 sys-devel/binutils/binutils-2.23.2.ebuild          |   67 -
 sys-devel/binutils/binutils-2.23.51.0.3.ebuild     |   60 -
 sys-devel/binutils/binutils-2.23.51.0.5.ebuild     |   60 -
 sys-devel/binutils/binutils-2.23.51.0.6.ebuild     |   60 -
 sys-devel/binutils/binutils-2.23.51.0.8.ebuild     |   60 -
 sys-devel/binutils/binutils-2.23.52.0.2.ebuild     |   60 -
 sys-devel/binutils/binutils-2.23.ebuild            |   68 -
 sys-devel/binutils/binutils-2.24-r1.ebuild         |   58 -
 sys-devel/binutils/binutils-2.24-r2.ebuild         |   59 -
 sys-devel/binutils/binutils-2.24.51.0.1.ebuild     |   58 -
 sys-devel/binutils/binutils-2.24.51.0.2.ebuild     |   59 -
 sys-devel/binutils/binutils-2.25.1-r1.ebuild       |   31 -
 sys-devel/binutils/binutils-2.26.1.ebuild          |   31 -
 sys-devel/binutils/files/2.18-bfd-alloca.patch     |  130 -
 sys-devel/binutils/files/2.18-bfd-bufsz.patch      |   38 -
 sys-devel/binutils/files/2.18-bfd-ia64elf.patch    |   96 -
 sys-devel/binutils/files/2.18-gprof-fabs.patch     |  151 --
 sys-devel/binutils/files/2.18-ldwrap-interix.sh    |   82 -
 sys-devel/binutils/files/2.18-solarisx86_64.patch  |   32 -
 sys-devel/binutils/files/2.21-ldwrap-interix.sh    |   94 -
 sys-devel/binutils/files/binutils-2.16-gcc4.patch  |   11 -
 .../binutils/files/binutils-2.16-solaris10.patch   |   34 -
 .../binutils/files/binutils-2.18.50.0.7-mint.patch | 2503 ------------------
 .../files/binutils-2.18.50.0.7-mint2.patch         |   94 -
 .../files/binutils-2.18.50.0.9-reloc.patch         |   20 -
 .../binutils-2.18.50.0.9-solaris-eh-frame.patch    |  183 --
 .../binutils/files/binutils-2.19.1-hppa-hpux.patch |  444 ----
 .../binutils/files/binutils-2.19.1-hpux.patch      |   22 -
 .../binutils/files/binutils-2.19.1-parallel.patch  |   12 -
 .../binutils-2.20.51.0.1-linux-x86-on-amd64.patch  |   13 -
 .../binutils/files/binutils-2.21.51.0.6-mint.patch | 2775 --------------------
 .../binutils/files/binutils-2.21.53.0.2-mint.patch | 2667 -------------------
 .../files/binutils-2.23-ar-ranlib-truncate.patch   |   37 -
 .../binutils/files/binutils-2.23-mbstate_t.patch   |  184 --
 39 files changed, 10547 deletions(-)

diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
index bfb43e8b96..e348252d68 100644
--- a/sys-devel/binutils/Manifest
+++ b/sys-devel/binutils/Manifest
@@ -1,36 +1,3 @@
-DIST binutils-2.19.1-patches-1.2.tar.bz2 10544 SHA256 128c949a46e6c516b5ebb2dbb7be553db7d8f1ee174896d1b63adbd0950030b3 SHA512 6aa2c923748d5b80f8e495176f19d8df8defcaa53915835b57a1da7c7a78668cb63d3380dd027593c8909a35de61adf2ea3d0ace64eeb537171271a6c6cbf33e WHIRLPOOL 04b26a82b2021626d4402c3275776bd9f91139082ae799350f9605bfa7e72fd3d72aac7636fbeb0e1fcdb93b6e903b396320b439502462baad06a61b0a3960e6
-DIST binutils-2.19.1.tar.bz2 16306586 SHA256 2dbd2c554b70d915c5b32fcfd401d03afcbf202529059c7a80af3993885ad1c2 SHA512 22af3cf65ad2f76469440fb992e50a10895fcec1265b98781138db0fc40bf06565af86dc73ca0b97bee764ec797439a89b5dbca2a5da74f375af55383887c436 WHIRLPOOL 340c12072a60c8f7b4b930a857e87d9723bdd2b0c61bef5a06810e11406f3e7955632a93a59c68b60220a882ff99273af3a9995872aa7a11604dd04182ebc6a2
-DIST binutils-2.20.1-patches-1.2.tar.bz2 15747 SHA256 30738e18f492bd653421d4bc4d52b841680fe4b17a69524e081d9befadef6d3b SHA512 23c1026db7748f9f958d32f6bfd2b362dae3bdee33612fb6a0cc4277fcb360a55c5618dc748a7119b12794a1bc22ea70af92c04f5283c0041bc681e5db4266b4 WHIRLPOOL fc73133cbd0aaf9447296425dd22907d3b984a9d8c0631be5155cd887ca44932b5d3651d538783ac10e520c6b43a077fb045ea720d95855f04b4ba47cb9076a2
-DIST binutils-2.20.1.tar.bz2 17591527 SHA256 71d37c96451333c5c0b84b170169fdcb138bbb27397dc06281905d9717c8ed64 SHA512 b05c93eb9ba8db344fbdee3c5b36ed5a7ad1366f948d41af43286715c7345a2477e0808d25f7bbf81b54ab06c4d46356d44318d56efcdbef42236d1a694411fc WHIRLPOOL 6166462fce695914a32c3295dadb6782716bb6693ee0a2a5543cc925e4967f5bccf38a5a2c244703bb9990acd229d0588a9463c62cec042f24107854c631518e
-DIST binutils-2.21.1-patches-1.4.tar.bz2 20033 SHA256 51e50584a7364549649cc6c59f4a678b07595979811e8e2150264318c3b4493d SHA512 66b71031a782f9708dc5f8ac9171b2be0bbca102b44705155b292329e0664cc71b649f4d8fa50ad0d9123436c03b994da5a0fddc32e43bf2d50e74c68609e508 WHIRLPOOL 2bdc11027b3dcd27c766b4ca5f578a32838d15b3370b4093f1c30887200b82bfaa732df9af23f545d58bbbf373c9967a31fcbb19b3f9b855f0923143e77fa9f5
-DIST binutils-2.21.1.tar.bz2 18997755 SHA256 cdecfa69f02aa7b05fbcdf678e33137151f361313b2f3e48aba925f64eabf654 SHA512 3f550f6833a41e9b17d1f515eea0de8dc14aefb7dd69c65b821aa1336aea4c3f55b4457a1781ab7b32bda049798fef3cf989148e4acb0fca8baca5af74766f31 WHIRLPOOL 1025ac3714f2406ee5afcda3f7a23f788a35e354b928f4b11c7448150a5613f793c2aa471f4612c5015e89d5abbb61522a7a0265286fcf2788fbf1194fb60201
-DIST binutils-2.22-patches-1.5.tar.bz2 37350 SHA256 51cad7b3c2d18db0f7d2e4a3e46e37f00eb720cfa663ea396e16dcfbba12a07c SHA512 407490be54fec09faf26e8062cf28d2ea2d58df669642e7582fe51776726f00af8c18194a17438e18068c91b7634fca2d0f33c7231e847ba5141f901d9743ad7 WHIRLPOOL d62be803705d4e526324719fae69c06c303cc2500aeac04cb711eff383a2732ec3f47f9d91deef954c60877e08fed2c2659636dad07086ceaf12c8b899b075f1
-DIST binutils-2.22.tar.bz2 19973532 SHA256 6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6313ca9 SHA512 ffe8ef263ef99183e8cc823fe8487ff7d0f7bf9a8efd2853b5f4636aca0023850d13de4eac7d77a5f69413d8a50e6f95bb14569be53df86c0bce38034525ab74 WHIRLPOOL 8bea2f2082600587649a5f9fffada9c6cf14f42ebddd1e6a4b4d7be25446d7ad76e1335cf8cefe30c812ced408c9dacb55d0033e4b0eaff83efbbfb5ea5f60dc
-DIST binutils-2.23-patches-1.1.tar.xz 13424 SHA256 ef6cbc34251c655d7fb0126c11a0211eb825438fd27de9aaf9bad0d2f264b8a9 SHA512 ccf44284da4e29803beab5630d63588f76f94b53c29a17c7a2a989a9ae7ed4c3083348baa8546700dbdf5da40787443d7019dc5ab613e5f46545e83523ff37fd WHIRLPOOL 3761e5a312dd105fc2cfd873416e3597e801305a18870c618deeb723af7cf65c3dc2102a83412b1191fd2169cde4fee29501e50a282edd267103af460eeb5e43
-DIST binutils-2.23.2-patches-1.0.tar.xz 10884 SHA256 47df1338ee285548630dabb6e414cd7ffffaf068a56ea22a185608fcbd091703 SHA512 25d52694e653dd2642eb643ef3bd48a099876515d66b0b1ed8dfa5f60cadaa1bb92a589e370528ec52add7571c0ea1a98859bfde0821c73ec0ded492fff0915c WHIRLPOOL 2aba579641a1b8e701b25c9d0094c9991e151ddd0b02fae7273ca8c9e31fd344cbf3782c5a5f9960a9bee16b41bc898c8ad0ec76ba8ee396d28e878dac47ffc7
-DIST binutils-2.23.2.tar.bz2 21440347 SHA256 fe914e56fed7a9ec2eb45274b1f2e14b0d8b4f41906a5194eac6883cfe5c1097 SHA512 dec753bbba008f1526b89cf1bd85feba78f362f5333ffdf93953fd131eb755976dec82a0a4ba38c43d2434da007137780cfe674de5414be5cf7ce7fbc6af6d16 WHIRLPOOL 1be65f03569d599899c5b57ac7aedbf90b311f9a47c1883dc62c0717b0757ebfb33e17ab3def8d0b805daabba67cf554463f88675c9f552a6fd8dbe7ca77b442
-DIST binutils-2.23.51.0.3-patches-1.1.tar.xz 13484 SHA256 f81f93324d7afdbd33496a17ab5a362515b21bb4b3ca8740fce6c299df56521c SHA512 8d1c5dbc0ab990ebc1c24abfc33b9e77cd3d257d68f87411a8ae8a2d9063b03e9b24ef8a99dc5cc9dc52b57a38be78ff4c9900d1f79602988da781bd0efbf86f WHIRLPOOL 975f8926ae2a79b5c51791035bcebe354ee51dda27337549e0445525054b151da6c312d071b4d2fdef662b42b609c6879b4917cb7ce7a1ef67d900ddb6193722
-DIST binutils-2.23.51.0.3.tar.xz 13831120 SHA256 2162905dabf191a2a803eab8d31e7be52d96d6ccd1e0ce42e25d82c6be918cd0 SHA512 bd79d662471bb1602a85933ce7560f6a0cfbc854feabb1353c7f4a8642eace6fdf7d1d24c6e75babe5a7fbe932fa3077f0d417263d3a1d0e5692dd7b2cca2dd1 WHIRLPOOL 624cdac6856a67f8bec3bb95bf29d619b5dcbe7da70cbbf557cf19057cd0776c5b4d8eed6f1b64db3b7e30d24791b141e87ed4a8b1d241b2d94ceaddb55c56da
-DIST binutils-2.23.51.0.5-patches-1.0.tar.xz 10928 SHA256 9889366e64fbf04bbc6a2962bc2b6f200c4ad95c009706b9ea3b9745886ca35b SHA512 f9ad9c35af37b95c3576d4c2b5a12a2798ba6da0d6ef25715a5b7bfa421905ce78ad056c2ff36cd36e1ecc143dc0df99238687405216c0acf6ba96a0d17c4391 WHIRLPOOL 89c81ebf496c902f3e882dacc0af2afb9580f2f84335ee1ca78e4196fea2ab1f84a815842d0445d2ea475f5a93bd19d029a8dedaf17b2dcca83ff8abcbfac338
-DIST binutils-2.23.51.0.5.tar.xz 13883528 SHA256 db3cab6fa59b4dc14760066db2fa8db49531494806e243601c7f433f1fc366ed SHA512 c1d35761d09f4d6a0844198dba0cafa40091bc7cc100bb154bf780cc38e03bdcb83ab33279b4504c22c5b77153548cc5a60fcda6158cded80da6aa330f51404c WHIRLPOOL 9d1b876bfe1ddb23e279b4ba86ee74ebcdd38bee712fe547b6a4966914b22f5dbb0653d35b7ae54fcf37d6cf54a0bbecda0da909dc92b93d443126b4e8e6b256
-DIST binutils-2.23.51.0.6-patches-1.0.tar.xz 10720 SHA256 cb4f6f67a69e19ab53591ff17ff0132e5367eff8630524183b043f7f98c604dd SHA512 de39edf6e69768877ac431fb663a00015d7603a4f40f9d11e0735475438c79662bf9bb7c3ae237d02d5cb8b7ee6dd63f24752e503162371027a088a5b79ce159 WHIRLPOOL 58a68d8de273fcad786829ee18b56e61e5d010051aaddfee310ac0a201d858147863d5762ad51332943d963df68509676a8cfedc2f769b905a017a990df59904
-DIST binutils-2.23.51.0.6.tar.xz 13907008 SHA256 0a2468ef7f99bf8162ebe5317dc3366f3555e9a453d0974fb96469d1122b0ce0 SHA512 8f3eed935dbc0e6fde55a420833835db8c4bfdd43047046da0bc30b2faee83701ddd78f24ac41ef236641f38465e282ec65d18e93da3f848034b2d5b335150af WHIRLPOOL 1c0c7985140c81b6b3d51048d8b94fedd710d995ecd0ed13daaa17f6a14658c812c683d45440040d215fce948e75df41a5f46e73ca0e7410fa92a663d7ddca4e
-DIST binutils-2.23.51.0.8-patches-1.0.tar.xz 10712 SHA256 1a0bd1500c87089e6609e97697912bd00fd44ac35fd9711c9c7b4267ede34cc0 SHA512 47f22c94fc387409c04d826db7592e1bddb991a990af108e21126ba5dc117740d1e87fa2178f51cc5c73c1b3f0fef55eda36308a722d1d9673a5ba639115995e WHIRLPOOL 2efba9385d71c07055be90c9aedfcd0180d47197a08563df1ba6abd5802852624ec4e6837c86e8f809ce485f90d2644038b35c0d6a366e4712038eebc117e3a9
-DIST binutils-2.23.51.0.8.tar.xz 13922836 SHA256 e345d7b7a14eb903074311a986d2a93af849b83799e3a5aa13308615a01eaf1e SHA512 8124974114398cc1fc88eb5681bfea8369371a2636da5d0ed7993cba43462edea9cc3ddfed30bf7bf7d13c2981cfece39da30a019093a5f9d7935b5b57373aad WHIRLPOOL adfe57a30fd72544a8e7ece1cf6a40f19ff08d237964c40591a3f50eb81acbb687b53d94ab3f491807cb599a691575ca77c3171fc67b9effc959d04490ca26e3
-DIST binutils-2.23.52.0.2-patches-1.0.tar.xz 11144 SHA256 528c19ba15439081c18e7740d4bf793222a6e882f0144891974e8b0fe997f26e SHA512 d599b9fc222cbe4b45987b83cb17fdcf759c5ebf725f42de2cd301da738d99f8f27fdf6ad9b0a55f13dbf02a7be43d84385c7a80641b43d596b5c258b1380bcd WHIRLPOOL 5a3f6c87e3dffb97eb73e03970d28382a55ea00cc4c4b60207adadbed60158cf023f3934aa6e4c297c0ae76249c4db160dacceb6319d4e59fd57dd3467b1548f
-DIST binutils-2.23.52.0.2.tar.xz 14380940 SHA256 c2229d5d4067c782b67cfaf7f049acd8361407c0870991bc5430be5c548f6825 SHA512 18b107e10809d485ff13bc063865a11526a144ac1f53946276457c71c2ffc01c177bab857ea6aa92cafc6e238f75a73e8991552f72d7f3a0fbd1ec411d5f93bf WHIRLPOOL d6219b8377af947dc2daf70cc3de9c91b83d31e03aa35729944687110a8f69d10a98eedef9755956411fe2f10a073ffd0c9b6b82062039560e2f95d36e3c6ba2
-DIST binutils-2.23.tar.bz2 21402046 SHA256 5f975e744a0fd4a4ab0b28dd6d0921685b3279207823226df92429389dbee452 SHA512 079939e1000e358e830c4563543f2a00ae127ef6e18306eda55a775254509951114d24647cf2c3fef49ac4409c8e9895085efb85cc71566a5b4fe0106b8375bd WHIRLPOOL 3713090b5f0d2b6fec14664ce862e0c7c7eeb0bf37bde19e4d07a48bafb61d388929e6ae993a6954aa6432fea9484b4646bc2938df308bcbf6142a0d5dfc1f69
-DIST binutils-2.24-patches-1.1.tar.xz 11588 SHA256 f68a0ee750f5f7d80371e12a0449bca31a3ecc5075ed1b19a8245a16b6768a75 SHA512 d08c231135edcd59159806e76ad670b736b745b4b66e42384ddc14575fe589c8117fe58897d96eb6e852250d00cef3c552b9bfc6d03fa237ba5ae863f2ce150c WHIRLPOOL 88cc854d221d86ec3b4688c45107cf551657297b1ae1b3d30cfd90482ea61c8b0abc7d26b476538b87e946b6e0c15ed8c3fe17cc25460b08507e0dc0f9002dae
-DIST binutils-2.24-patches-1.3.tar.xz 13304 SHA256 b8832f9595f347171fa11fc71b6d4b4e6a04bda6040e463b62da75e999b5f8fd SHA512 91eb75a298da6d962d0e9b6b8ecb500501beebcb24ba51ffcb48374b5e226e43c1891bfe1c8c7ef6b201744ff8e25b15309bdd45515099c7f57ad701201c7062 WHIRLPOOL f53261e459c376551b24fb67e94252d59983177d841503dcf35213260c3b24bc4e4d80c91418323d88761e96e60ed366dce6cf3f23eeec4d698caf183c6bac48
-DIST binutils-2.24.51.0.1-patches-1.1.tar.xz 11636 SHA256 32c61f04e864883f340086a5b34a79e9f10ba5e8b99f80f82c4fbdd7dae7fa11 SHA512 d3cdfeb8c612c8778a380144de4e0343241fd9539a8bdba98fe7e5013549d1e500d82febaed190e5399306db72f71e84b85e906b73bd3ca67b51a47af5df9dc2 WHIRLPOOL cf90006959a58d087d4884ff88b2dee512b9bc937719371fee5b4e9d46056a64d1863661c41c58ef905efed2343f80622690708ba84a392e8c2b3ec1f315018e
-DIST binutils-2.24.51.0.1.tar.xz 14963340 SHA256 8491c5247502966032c8549eee8bc0283bcf93ed5003900d74d146104e0042d9 SHA512 e3b3fea22b9c140d595430e54e5423990cf1a9ca9719d8e9f5fa393acb35d364e54e279a5fe38484d6da9e210692d47bf319c16b4495a958a7795dea76ae462c WHIRLPOOL fb54bbf510aaa9af88421fa29de495d86c2ad1d2075c45d022dbe9c50e63e25a28b0ac8eb508c875bec60ac0adf018b64348d6f67da2f141c7e40844b862af62
-DIST binutils-2.24.51.0.2-patches-1.1.tar.xz 11636 SHA256 cb49bce2fd55b593368a092f61a94b1af197383aca1a34b0f672fec569d49a79 SHA512 881425f9e03314bef0684bb0f3560b14f9d493f85c08aa6a7d15e91746886e40aec533fdc33995f059411ad818c73ac3d3398f3a322e9d2d704a36b1da7b0afc WHIRLPOOL 7f5b404dad462229dd212c90d28cb7ae62245941ca3ff45d28f1eef6165cfc71ee48becd42262520265652e70122c2a15870581f35fb2f69e9f9da9751a60e8f
-DIST binutils-2.24.51.0.2.tar.xz 14985864 SHA256 51a302ce92d22292329e09f30e25d66106e837a52b667a84df62c773f57c76b3 SHA512 005130ad7376c55c04c7f9c075c2a80b4fa5a174c1bc645e70394fcc3be0c636b5db8fea22ec0394177ce43cce315c9f7fe17d636adfbc14da4b1e81217bb730 WHIRLPOOL 0765dac0e5143f661128fe5bc4569253bcaf33b969469d525ec5314c45cdcd2ab3018e6c3cd82f1c6291379003b848fbadf7ff9c3b5aa512dc55c17cf42fde12
-DIST binutils-2.24.tar.bz2 22716802 SHA256 e5e8c5be9664e7f7f96e0d09919110ab5ad597794f5b1809871177a0f0f14137 SHA512 5ec95ad47d49b12c4558a8db0ca2109d3ee1955e3776057f3330c4506f8f4d1cf5e505fbf8a16b98403a0fcdeaaf986fe0a22be6456247dbdace63ce1f776b12 WHIRLPOOL 619634dfdc73b8f6e9933b4642f5f9faf147c388a6d39283cd7639d83f3d7a601981cf49a787c43c17a942c563f24dc8dcc682138b5d3102a5650e1b9d15bd50
-DIST binutils-2.25.1-patches-1.1.tar.xz 18724 SHA256 3d4c0ab2d45d3a952f60246fa5a4353f057c03110130b50e3b2103bd49c345fa SHA512 209c55bf26b51d8c513b40abd2d95f687159c4e964a6c732924f277d04c97323c427fe452c63d5ec6962dcd8892d6d5d807ba88826739425bce6812a31f573dd WHIRLPOOL 2b650af352183d2b58abaee955b223606d63bd5f22a73360e79af1d3b575c5ea385f90be92348ec850534d96f7b6632b1e494f314ec1655eedc26108e849aab7
-DIST binutils-2.25.1.tar.bz2 24163561 SHA256 b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22 SHA512 0b36dda0e6d32cd25613c0e64b56b28312515c54d6a159efd3db9a86717f114ab0a0a1f69d08975084d55713ebaeab64e4085c9b3d1c3fa86712869f80eb954d WHIRLPOOL daa804331ee880296c2fe29fd9b8a52cc695629d4bbe0b9889d96ffc54d330f00fac3f3cb12b3aaf6b7505521ef499c53760912cd7c9bb54f2d5e288224bd1eb
-DIST binutils-2.26.1-patches-1.0.tar.xz 11212 SHA256 e56e2a6b64b8abe2f4aed1a9b1517fc8cbb5fd661f40118d0163d93943870e77 SHA512 c520967659c66f05f7ad795bb0bc2522e139977ab3ae8cfd9ec0d093a412a7291d1cabaa6b429c618fcf7253458a6fbe5a7dc3f62e0ac9762667308067db075c WHIRLPOOL 027b6a864134e2690d309922009740338bbd927581c6657c640d3061447f308c2e27a8c06a9202ae3f4aac4bcbf9e28303b52f81745d4062bf5b8c638cd1a9b7
-DIST binutils-2.26.1.tar.bz2 25595243 SHA256 39c346c87aa4fb14b2f786560aec1d29411b6ec34dce3fe7309fe3dd56949fd8 SHA512 9d9165609fd3b0f20d616f9891fc8e2b466eb13e2bfce40125e12427f8f201d20e2b8322bb6cb2b45e8df812f0e8ac059149f8a1f69ba3ed9d86a35c6a540b67 WHIRLPOOL c33eecdf855dd17314c3b7bbb0060399148d4dba867eb038bfb7555010fd003ba8b5b86480e4df389e19bba7b1fd0b9264291e6af20be4ffd4ff504d2255d003
 DIST binutils-2.27-patches-1.0.tar.xz 8852 SHA256 07be45786e1e56498aad2c52a43d4104ccd0ded3c6a84a930486bc418d7fa36d SHA512 489b5fff87886682d8e98eafa2f082e6dcf811d2a693b6c41d76bd1ac50815a6e7d26fb7c9e3811c2d8e0e1dc307557e6ffe46d1d0f7caeb581060cf14bda899 WHIRLPOOL cf73342292a6dd8450a420f62a6a28e1ae38eed2c0b62643619ac002f3e9233ba5a0df19deb862167e88bd2c4a7ef4e002fe4d76f971eba876014d145dc30171
 DIST binutils-2.27.tar.bz2 26099568 SHA256 369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88 SHA512 cf276f84935312361a2ca077e04d0b469d23a3aed979d8ba5d92ea590904ffb2c2e7ed12cc842822bfc402836be86f479660cef3791aa62f3753d8a1a6f564cb WHIRLPOOL d3204b4900529f697285fb1fe622ecc949c43f064e6b83a1cecb1ea8810a214842c729266c9a44537dc0a86d6d2b3ac100f54c721cc284e54f9d6feb90930d15
 DIST binutils-2.28.1-patches-1.0.tar.xz 19772 SHA256 50cfce6ef7f546dcdb983a8b632507b5cdd51095e4acf1f15bfcd68027d438a4 SHA512 c2c7d22e1013e79040c4dcb4d70649e78a070976ba3a4bc2ceb4805827b9d93eea1805c85db4fcb6b31be5218c3d7b42a4990437a7c01dc01fd7e9dedb606828 WHIRLPOOL 2369fce643cc9b83724b486521621d744de0eaf3d95fdd34c7f1c785bc400f3ed31ae6105001870f33539664d84dd9caae854725e20007f136929d2ece755247

diff --git a/sys-devel/binutils/binutils-2.19.1-r01.1.ebuild b/sys-devel/binutils/binutils-2.19.1-r01.1.ebuild
deleted file mode 100644
index cd68aa9210..0000000000
--- a/sys-devel/binutils/binutils-2.19.1-r01.1.ebuild
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.19.1-r1.ebuild,v 1.9 2011/09/22 17:29:31 vapier Exp $
-
-PATCHVER="1.2"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	epatch "${FILESDIR}"/binutils-2.18.50.0.7-mint.patch
-	epatch "${FILESDIR}"/binutils-2.18.50.0.7-mint2.patch
-	epatch "${FILESDIR}"/binutils-2.19.50.0.1-mint.patch
-	epatch "${FILESDIR}"/${P}-parallel.patch
-	epatch "${FILESDIR}"/${P}-hpux.patch
-	epatch "${FILESDIR}"/${P}-hppa-hpux.patch # DESTDIR with libtool
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-	*-hpux*)
-		ln -s /usr/ccs/bin/ld "${ED}${BINPATH}"/ld || die "Cannot create ld symlink"
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.20.1-r1.ebuild b/sys-devel/binutils/binutils-2.20.1-r1.ebuild
deleted file mode 100644
index 7524cc2349..0000000000
--- a/sys-devel/binutils/binutils-2.20.1-r1.ebuild
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.20.1-r1.ebuild,v 1.16 2012/05/31 04:45:38 vapier Exp $
-
-PATCHVER="1.2"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-	*-hpux*)
-		ln -s /usr/ccs/bin/ld "${ED}${BINPATH}"/ld || die "Cannot create ld symlink"
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.21.1-r1.ebuild b/sys-devel/binutils/binutils-2.21.1-r1.ebuild
deleted file mode 100644
index eaff95208e..0000000000
--- a/sys-devel/binutils/binutils-2.21.1-r1.ebuild
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.21.1-r1.ebuild,v 1.12 2011/12/28 20:33:56 halcy0n Exp $
-
-PATCHVER="1.4"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-	*-hpux*)
-		ln -s /usr/ccs/bin/ld "${ED}${BINPATH}"/ld || die "Cannot create ld symlink"
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.22-r1.ebuild b/sys-devel/binutils/binutils-2.22-r1.ebuild
deleted file mode 100644
index e892cd7880..0000000000
--- a/sys-devel/binutils/binutils-2.22-r1.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.22-r1.ebuild,v 1.16 2012/09/29 16:06:32 armin76 Exp $
-
-PATCHVER="1.5"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	[[ $SYMLINK_LIB == yes ]] &&
-	epatch "${FILESDIR}"/${PN}-2.20.51.0.1-linux-x86-on-amd64.patch
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.23.2.ebuild b/sys-devel/binutils/binutils-2.23.2.ebuild
deleted file mode 100644
index 13c993a22b..0000000000
--- a/sys-devel/binutils/binutils-2.23.2.ebuild
+++ /dev/null
@@ -1,67 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.23.2.ebuild,v 1.12 2013/12/26 14:43:05 maekke Exp $
-
-PATCHVER="1.0"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-# See #464152
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	[[ $SYMLINK_LIB == yes ]] &&
-	epatch "${FILESDIR}"/${PN}-2.20.51.0.1-linux-x86-on-amd64.patch
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	else
-		# bug #491620
-		sed -i \
-			-e 's/@colophon/@@colophon/' \
-			-e 's/doc@cygnus.com/doc@@cygnus.com/' \
-			bfd/doc/bfd.texinfo || die
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.23.51.0.3.ebuild b/sys-devel/binutils/binutils-2.23.51.0.3.ebuild
deleted file mode 100644
index 058569f1ec..0000000000
--- a/sys-devel/binutils/binutils-2.23.51.0.3.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.23.51.0.3.ebuild,v 1.2 2012/11/02 22:44:29 vapier Exp $
-
-PATCHVER="1.1"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-#KEYWORDS="~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	[[ $SYMLINK_LIB == yes ]] &&
-	epatch "${FILESDIR}"/${PN}-2.20.51.0.1-linux-x86-on-amd64.patch
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.23.51.0.5.ebuild b/sys-devel/binutils/binutils-2.23.51.0.5.ebuild
deleted file mode 100644
index 819175a808..0000000000
--- a/sys-devel/binutils/binutils-2.23.51.0.5.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.23.51.0.5.ebuild,v 1.1 2012/11/13 00:00:39 vapier Exp $
-
-PATCHVER="1.0"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-#KEYWORDS="~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	[[ $SYMLINK_LIB == yes ]] &&
-	epatch "${FILESDIR}"/${PN}-2.20.51.0.1-linux-x86-on-amd64.patch
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.23.51.0.6.ebuild b/sys-devel/binutils/binutils-2.23.51.0.6.ebuild
deleted file mode 100644
index a108e4e8d5..0000000000
--- a/sys-devel/binutils/binutils-2.23.51.0.6.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.23.51.0.6.ebuild,v 1.1 2012/11/26 18:01:14 vapier Exp $
-
-PATCHVER="1.0"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-#KEYWORDS="~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	[[ $SYMLINK_LIB == yes ]] &&
-	epatch "${FILESDIR}"/${PN}-2.20.51.0.1-linux-x86-on-amd64.patch
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.23.51.0.8.ebuild b/sys-devel/binutils/binutils-2.23.51.0.8.ebuild
deleted file mode 100644
index b31c91d7fe..0000000000
--- a/sys-devel/binutils/binutils-2.23.51.0.8.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.23.51.0.8.ebuild,v 1.1 2012/12/29 20:58:39 vapier Exp $
-
-PATCHVER="1.0"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-#KEYWORDS="~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	[[ $SYMLINK_LIB == yes ]] &&
-	epatch "${FILESDIR}"/${PN}-2.20.51.0.1-linux-x86-on-amd64.patch
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.23.52.0.2.ebuild b/sys-devel/binutils/binutils-2.23.52.0.2.ebuild
deleted file mode 100644
index a1b9b94203..0000000000
--- a/sys-devel/binutils/binutils-2.23.52.0.2.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.23.52.0.2.ebuild,v 1.1 2013/05/05 04:17:49 vapier Exp $
-
-PATCHVER="1.0"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-#KEYWORDS="~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	[[ $SYMLINK_LIB == yes ]] &&
-	epatch "${FILESDIR}"/${PN}-2.20.51.0.1-linux-x86-on-amd64.patch
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.23.ebuild b/sys-devel/binutils/binutils-2.23.ebuild
deleted file mode 100644
index f2d16c017b..0000000000
--- a/sys-devel/binutils/binutils-2.23.ebuild
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.23.ebuild,v 1.2 2012/11/02 22:44:29 vapier Exp $
-
-PATCHVER="1.1"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	[[ $SYMLINK_LIB == yes ]] &&
-	epatch "${FILESDIR}"/${PN}-2.20.51.0.1-linux-x86-on-amd64.patch
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.23-mbstate_t.patch
-	epatch "${FILESDIR}"/${PN}-2.23-ar-ranlib-truncate.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	else
-		# bug #491620
-		sed -i \
-			-e 's/@colophon/@@colophon/' \
-			-e 's/doc@cygnus.com/doc@@cygnus.com/' \
-			bfd/doc/bfd.texinfo || die
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.24-r1.ebuild b/sys-devel/binutils/binutils-2.24-r1.ebuild
deleted file mode 100644
index d482593dae..0000000000
--- a/sys-devel/binutils/binutils-2.24-r1.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.24-r1.ebuild,v 1.1 2014/01/07 04:43:47 patrick Exp $
-
-PATCHVER="1.1"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.24-r2.ebuild b/sys-devel/binutils/binutils-2.24-r2.ebuild
deleted file mode 100644
index 6ac7598922..0000000000
--- a/sys-devel/binutils/binutils-2.24-r2.ebuild
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.24-r1.ebuild,v 1.1 2014/01/07 04:43:47 patrick Exp $
-
-PATCHVER="1.3"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.24-cygwin-nointl.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.24.51.0.1.ebuild b/sys-devel/binutils/binutils-2.24.51.0.1.ebuild
deleted file mode 100644
index 6c4b7817ce..0000000000
--- a/sys-devel/binutils/binutils-2.24.51.0.1.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.24.51.0.1.ebuild,v 1.2 2014/01/06 18:29:21 vapier Exp $
-
-PATCHVER="1.1"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-#KEYWORDS="~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-	cd "${S}"
-	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.24.51.0.2.ebuild b/sys-devel/binutils/binutils-2.24.51.0.2.ebuild
deleted file mode 100644
index 029838a977..0000000000
--- a/sys-devel/binutils/binutils-2.24.51.0.2.ebuild
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.24.51.0.2.ebuild,v 1.2 2014/01/06 18:29:21 vapier Exp $
-
-PATCHVER="1.1"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-#KEYWORDS="~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-src_unpack() {
-	toolchain-binutils_src_unpack
-# bug #568636
-#	cd "${S}"
-#	epatch "${FILESDIR}"/${PN}-2.22-mint.patch
-#	epatch "${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO='echo makeinfo GNU texinfo 4.13'"
-	fi
-
-	case "${CTARGET}" in
-	*-interix*) EXTRA_ECONF="${EXTRA_ECONF} --without-gnu-ld --without-gnu-as" ;;
-	esac
-
-	toolchain-binutils_src_compile
-}
-
-src_install() {
-	toolchain-binutils_src_install
-
-	case "${CTARGET}" in
-    *-interix*)
-		ln -s /opt/gcc.3.3/bin/as "${ED}${BINPATH}"/as || die "Cannot create as symlink"
-		sed -e "s,@SCRIPTDIR@,${EPREFIX}${LIBPATH}/ldscripts," \
-			< "${FILESDIR}"/2.21-ldwrap-interix.sh \
-			> "${ED}${BINPATH}"/ld \
-			|| die "Cannot create ld wrapper"
-		chmod a+x "${ED}${BINPATH}"/ld
-
-		dodir "${LIBPATH}"/ldscripts
-
-		# yes, this is "i586-pc-interix3" for SFU 3.5, SUA 5.2 and SUA 6.0
-		# additionally insert the prefix as absolute top search dir...
-		for x in /opt/gcc.3.3/i586-pc-interix3/lib/ldscripts/i386pe_posix.*; do
-			sed -e 's, SEARCH_DIR("/usr/local/lib"); , SEARCH_DIR("/usr/lib/x86"); ,' \
-				-e "s,^\(SEARCH_DIR(\),SEARCH_DIR(\"${EPREFIX}/lib\"); SEARCH_DIR(\"${EPREFIX}/usr/lib\"); \1," \
-			< $x \
-			> "${ED}${LIBPATH}"/ldscripts/${x##*/} \
-			|| die "Cannot occupy ldscripts"
-		done
-		;;
-	esac
-}

diff --git a/sys-devel/binutils/binutils-2.25.1-r1.ebuild b/sys-devel/binutils/binutils-2.25.1-r1.ebuild
deleted file mode 100644
index a5eccdba37..0000000000
--- a/sys-devel/binutils/binutils-2.25.1-r1.ebuild
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="4"
-
-PATCHVER="1.1"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-PATCHES=(
-#	"${FILESDIR}"/${PN}-2.22-mint.patch
-#	"${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-	"${FILESDIR}"/${PN}-2.24-cygwin-nointl.patch
-)
-pkg_setup() {
-	[[ ${CHOST} == *-mint* ]] && die "mint patches require rebasing to ${P}" # 609274
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	toolchain-binutils_src_compile
-}

diff --git a/sys-devel/binutils/binutils-2.26.1.ebuild b/sys-devel/binutils/binutils-2.26.1.ebuild
deleted file mode 100644
index ad8fbaa706..0000000000
--- a/sys-devel/binutils/binutils-2.26.1.ebuild
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI="5"
-
-PATCHVER="1.0"
-ELF2FLT_VER=""
-inherit toolchain-binutils
-
-KEYWORDS="~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-PATCHES=(
-#	"${FILESDIR}"/${PN}-2.22-mint.patch
-#	"${FILESDIR}"/${PN}-2.19.50.0.1-mint.patch
-	"${FILESDIR}"/${PN}-2.24-cygwin-nointl.patch
-)
-pkg_setup() {
-	[[ ${CHOST} == *-mint* ]] && die "mint patches require rebasing to ${P}" # 609274
-}
-
-src_compile() {
-	if has noinfo "${FEATURES}" \
-	|| ! type -p makeinfo >/dev/null
-	then
-		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
-		export EXTRA_EMAKE="MAKEINFO=true"
-	fi
-
-	toolchain-binutils_src_compile
-}

diff --git a/sys-devel/binutils/files/2.18-bfd-alloca.patch b/sys-devel/binutils/files/2.18-bfd-alloca.patch
deleted file mode 100644
index 32d8b5941c..0000000000
--- a/sys-devel/binutils/files/2.18-bfd-alloca.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-bfd needs to declare alloca differently, see
-http://sourceware.org/bugzilla/show_bug.cgi?id=5146
-
---- bfd/configure.in.orig	2007-10-09 09:35:46.626269000 +0200
-+++ bfd/configure.in	2007-10-09 09:36:41.264676000 +0200
-@@ -159,7 +159,7 @@
- 
- BFD_CC_FOR_BUILD
- 
--AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h)
-+AC_CHECK_HEADERS(alloca.h stddef.h string.h strings.h stdlib.h time.h unistd.h)
- AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h)
- GCC_HEADER_STDINT(bfd_stdint.h)
- AC_HEADER_TIME
---- bfd/configure.orig	2007-10-09 09:02:42.293763000 +0200
-+++ bfd/configure	2007-10-09 09:04:01.331465000 +0200
-@@ -12574,7 +12574,7 @@
- 
- 
- 
--for ac_header in stddef.h string.h strings.h stdlib.h time.h unistd.h
-+for ac_header in alloca.h stddef.h string.h strings.h stdlib.h time.h unistd.h
- do
- as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
- if eval "test \"\${$as_ac_Header+set}\" = set"; then
---- bfd/config.in.orig	2007-10-09 09:13:33.604874000 +0200
-+++ bfd/config.in	2007-10-09 09:05:29.528913000 +0200
-@@ -4,6 +4,9 @@
-    language is requested. */
- #undef ENABLE_NLS
- 
-+/* Define to 1 if you have the <alloca.h> header file. */
-+#undef HAVE_ALLOCA_H
-+
- /* Define to 1 if you have the declaration of `basename', and to 0 if you
-    don't. */
- #undef HAVE_DECL_BASENAME
---- bfd/som.c.orig	2007-10-24 09:45:12.000000000 +0200
-+++ bfd/som.c	2007-10-24 09:47:32.000000000 +0200
-@@ -23,7 +23,6 @@
-    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-    02110-1301, USA.  */
- 
--#include "alloca-conf.h"
- #include "sysdep.h"
- #include "bfd.h"
- 
-@@ -38,6 +37,35 @@
- #include <machine/reg.h>
- #include <sys/file.h>
- 
-+/* This is the code recommended in the autoconf documentation, almost
-+   verbatim.  If it doesn't work for you, let me know, and notify
-+   djm@gnu.ai.mit.edu as well.  */
-+/* Added void* version for STDC case.  This is to be compatible with
-+   the declaration in bison.simple, used for m68k operand parsing.
-+   --KR 1995.08.08 */
-+/* Force void* decl for hpux.  This is what Bison uses.  --KR 1995.08.16 */
-+
-+#ifndef __GNUC__
-+# if HAVE_ALLOCA_H
-+#  include <alloca.h>
-+# else
-+#  ifdef _AIX
-+/* Indented so that pre-ansi C compilers will ignore it, rather than
-+   choke on it.  Some versions of AIX require this to be the first
-+   thing in the file.  */
-+ #pragma alloca
-+#  else
-+#   ifndef alloca /* predefined by HP cc +Olibcalls */
-+#    if !defined (__STDC__) && !defined (__hpux)
-+extern char *alloca ();
-+#    else
-+extern void *alloca ();
-+#    endif /* __STDC__, __hpux */
-+#   endif /* alloca */
-+#  endif /* _AIX */
-+# endif /* HAVE_ALLOCA_H */
-+#endif /* __GNUC__ */
-+
- static bfd_reloc_status_type hppa_som_reloc
-   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
- static bfd_boolean som_mkobject (bfd *);
---- bfd/elf64-hppa.c.orig	2007-10-24 09:45:28.000000000 +0200
-+++ bfd/elf64-hppa.c	2007-10-24 09:48:16.000000000 +0200
-@@ -19,7 +19,6 @@
-    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-    MA 02110-1301, USA.  */
- 
--#include "alloca-conf.h"
- #include "sysdep.h"
- #include "bfd.h"
- #include "libbfd.h"
-@@ -27,6 +26,36 @@
- #include "elf/hppa.h"
- #include "libhppa.h"
- #include "elf64-hppa.h"
-+
-+/* This is the code recommended in the autoconf documentation, almost
-+   verbatim.  If it doesn't work for you, let me know, and notify
-+   djm@gnu.ai.mit.edu as well.  */
-+/* Added void* version for STDC case.  This is to be compatible with
-+   the declaration in bison.simple, used for m68k operand parsing.
-+   --KR 1995.08.08 */
-+/* Force void* decl for hpux.  This is what Bison uses.  --KR 1995.08.16 */
-+
-+#ifndef __GNUC__
-+# if HAVE_ALLOCA_H
-+#  include <alloca.h>
-+# else
-+#  ifdef _AIX
-+/* Indented so that pre-ansi C compilers will ignore it, rather than
-+   choke on it.  Some versions of AIX require this to be the first
-+   thing in the file.  */
-+ #pragma alloca
-+#  else
-+#   ifndef alloca /* predefined by HP cc +Olibcalls */
-+#    if !defined (__STDC__) && !defined (__hpux)
-+extern char *alloca ();
-+#    else
-+extern void *alloca ();
-+#    endif /* __STDC__, __hpux */
-+#   endif /* alloca */
-+#  endif /* _AIX */
-+# endif /* HAVE_ALLOCA_H */
-+#endif /* __GNUC__ */
-+
- #define ARCH_SIZE	       64
- 
- #define PLT_ENTRY_SIZE 0x10

diff --git a/sys-devel/binutils/files/2.18-bfd-bufsz.patch b/sys-devel/binutils/files/2.18-bfd-bufsz.patch
deleted file mode 100644
index db0a0be254..0000000000
--- a/sys-devel/binutils/files/2.18-bfd-bufsz.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-'const int' is not const enough for arraysize before C99, see
-http://sourceware.org/bugzilla/show_bug.cgi?id=5160
-
---- bfd/elflink.c	2007-10-22 22:14:29.000000000 +0200
-+++ bfd/elflink.c	2007-10-22 22:36:09.000000000 +0200
-@@ -7387,19 +7387,18 @@
- 	     size_t                        locsymcount,
- 	     int                           signed_p)
- {
--  int           len;
--  int           symlen;
-+  size_t len;
-+  size_t symlen;
-   bfd_vma       a;
-   bfd_vma       b;
--  const int     bufsz = 4096;
--  char          symbuf [bufsz];
-+  char          symbuf [4096];
-   const char *  symend;
-   bfd_boolean   symbol_is_section = FALSE;
- 
-   len = strlen (sym);
-   symend = sym + len;
- 
--  if (len < 1 || len > bufsz)
-+  if (len < 1 || len > sizeof (symbuf))
-     {
-       bfd_set_error (bfd_error_invalid_operation);
-       return FALSE;
-@@ -7424,7 +7423,7 @@
-       symlen = strtol (sym, &sym, 10);
-       ++ sym; /* Skip the trailing ':'.  */
- 
--      if ((symend < sym) || ((symlen + 1) > bufsz))
-+      if ((symend < sym) || ((symlen + 1) > sizeof(symbuf)))
- 	{
- 	  bfd_set_error (bfd_error_invalid_operation);
- 	  return FALSE;

diff --git a/sys-devel/binutils/files/2.18-bfd-ia64elf.patch b/sys-devel/binutils/files/2.18-bfd-ia64elf.patch
deleted file mode 100644
index 5aa0aee548..0000000000
--- a/sys-devel/binutils/files/2.18-bfd-ia64elf.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-2007-12-14  H.J. Lu  <hongjiu.lu@intel.com>
-
-	PR binutils/5449
-	* elf.c (rewrite_elf_program_header): Don't adjust p_paddr if
-	p_paddr is set to 0.
-	(copy_private_bfd_data): Call rewrite_elf_program_header if
-	p_paddr is set to 0.
-
-	* elfcode.h (elf_swap_phdr_out): Set p_paddr to 0 if needed.
-
-	* elfxx-ia64.c (ELF_MAXPAGESIZE): Don't redefine it for HPUX.
-
---- binutils-2.18/bfd/elf.c.zero	2007-12-17 10:58:04.761792000 +0100
-+++ binutils-2.18/bfd/elf.c	2007-12-17 11:49:16.381795000 +0100
-@@ -5272,9 +5272,13 @@
-       matching_lma = 0;
-       suggested_lma = 0;
- 
--      for (j = 0, section = ibfd->sections;
-+      for (section = ibfd->sections;
- 	   section != NULL;
- 	   section = section->next)
-+	if (section == first_section)
-+	  break;
-+
-+      for (j = 0; section != NULL; section = section->next)
- 	{
- 	  if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed))
- 	    {
-@@ -5319,6 +5323,9 @@
- 	      else if (suggested_lma == 0)
- 		suggested_lma = output_section->lma;
- 	    }
-+
-+	      if (j == section_count)
-+		break;
- 	}
- 
-       BFD_ASSERT (j == section_count);
-@@ -5335,7 +5342,8 @@
- 	  *pointer_to_map = map;
- 	  pointer_to_map = &map->next;
- 
--	  if (matching_lma != map->p_paddr
-+	  if (!bed->want_p_paddr_set_to_zero
-+	      && matching_lma != map->p_paddr
- 	      && !map->includes_filehdr && !map->includes_phdrs)
- 	    /* There is some padding before the first section in the
- 	       segment.  So, we must account for that in the output
-@@ -5675,6 +5683,13 @@
-       asection *section, *osec;
-       unsigned int i, num_segments;
-       Elf_Internal_Shdr *this_hdr;
-+      const struct elf_backend_data *bed;
-+
-+      bed = get_elf_backend_data (ibfd);
-+
-+      /* Regenerate the segment map if p_paddr is set to 0.  */
-+      if (bed->want_p_paddr_set_to_zero)
-+	goto rewrite;
- 
-       /* Initialize the segment mark field.  */
-       for (section = obfd->sections; section != NULL;
---- binutils-2.18/bfd/elfcode.h.zero	2007-10-30 11:48:34.000000000 -0700
-+++ binutils-2.18/bfd/elfcode.h	2007-12-14 10:49:00.000000000 -0800
-@@ -370,11 +370,17 @@ elf_swap_phdr_out (bfd *abfd,
- 		   const Elf_Internal_Phdr *src,
- 		   Elf_External_Phdr *dst)
- {
-+  const struct elf_backend_data *bed;
-+  bfd_vma p_paddr;
-+
-+  bed = get_elf_backend_data (abfd);
-+  p_paddr = bed->want_p_paddr_set_to_zero ? 0 : src->p_paddr;
-+
-   /* note that all elements of dst are *arrays of unsigned char* already...  */
-   H_PUT_32 (abfd, src->p_type, dst->p_type);
-   H_PUT_WORD (abfd, src->p_offset, dst->p_offset);
-   H_PUT_WORD (abfd, src->p_vaddr, dst->p_vaddr);
--  H_PUT_WORD (abfd, src->p_paddr, dst->p_paddr);
-+  H_PUT_WORD (abfd, p_paddr, dst->p_paddr);
-   H_PUT_WORD (abfd, src->p_filesz, dst->p_filesz);
-   H_PUT_WORD (abfd, src->p_memsz, dst->p_memsz);
-   H_PUT_32 (abfd, src->p_flags, dst->p_flags);
---- binutils-2.18/bfd/elfxx-ia64.c.zero	2007-12-14 08:46:35.000000000 -0800
-+++ binutils-2.18/bfd/elfxx-ia64.c	2007-12-14 08:46:35.000000000 -0800
-@@ -5729,8 +5729,6 @@ elfNN_hpux_backend_symbol_processing (bf
- #undef  elf_backend_want_p_paddr_set_to_zero
- #define elf_backend_want_p_paddr_set_to_zero 1
- 
--#undef  ELF_MAXPAGESIZE
--#define ELF_MAXPAGESIZE                 0x1000  /* 4K */
- #undef ELF_COMMONPAGESIZE
- #undef ELF_OSABI
- #define ELF_OSABI			ELFOSABI_HPUX
-

diff --git a/sys-devel/binutils/files/2.18-gprof-fabs.patch b/sys-devel/binutils/files/2.18-gprof-fabs.patch
deleted file mode 100644
index cf45efd342..0000000000
--- a/sys-devel/binutils/files/2.18-gprof-fabs.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-gprof needs to check for where to get fabs() from, reported as
-http://sourceware.org/bugzilla/show_bug.cgi?id=5147
-
---- gprof/configure.in.orig	2007-10-09 09:22:17.289705000 +0200
-+++ gprof/configure.in	2007-10-09 09:24:26.745972000 +0200
-@@ -44,6 +44,9 @@
- 	    [Is the prototype for getopt in <unistd.h> in the expected format?])
- fi
- 
-+# Some systems have fabs only in -lm, not in -lc.
-+AC_SEARCH_LIBS(fabs, m)
-+
- AM_BINUTILS_WARNINGS
- 
- dnl Required by html and install-html
---- gprof/configure.orig	2007-10-09 09:22:11.089879000 +0200
-+++ gprof/configure	2007-10-09 09:25:54.513419000 +0200
-@@ -11073,6 +11073,133 @@
- 
- fi
- 
-+# Some systems have fabs only in -lm, not in -lc.
-+echo "$as_me:$LINENO: checking for library containing fabs" >&5
-+echo $ECHO_N "checking for library containing fabs... $ECHO_C" >&6
-+if test "${ac_cv_search_fabs+set}" = set; then
-+  echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+  ac_func_search_save_LIBS=$LIBS
-+ac_cv_search_fabs=no
-+cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h.  */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h.  */
-+
-+/* Override any gcc2 internal prototype to avoid an error.  */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+   builtin and then its argument prototype would still apply.  */
-+char fabs ();
-+int
-+main ()
-+{
-+fabs ();
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+  (eval $ac_link) 2>conftest.er1
-+  ac_status=$?
-+  grep -v '^ *+' conftest.er1 >conftest.err
-+  rm -f conftest.er1
-+  cat conftest.err >&5
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); } &&
-+	 { ac_try='test -z "$ac_c_werror_flag"
-+			 || test ! -s conftest.err'
-+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+  (eval $ac_try) 2>&5
-+  ac_status=$?
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); }; } &&
-+	 { ac_try='test -s conftest$ac_exeext'
-+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+  (eval $ac_try) 2>&5
-+  ac_status=$?
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); }; }; then
-+  ac_cv_search_fabs="none required"
-+else
-+  echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+      conftest$ac_exeext conftest.$ac_ext
-+if test "$ac_cv_search_fabs" = no; then
-+  for ac_lib in m; do
-+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-+    cat >conftest.$ac_ext <<_ACEOF
-+/* confdefs.h.  */
-+_ACEOF
-+cat confdefs.h >>conftest.$ac_ext
-+cat >>conftest.$ac_ext <<_ACEOF
-+/* end confdefs.h.  */
-+
-+/* Override any gcc2 internal prototype to avoid an error.  */
-+#ifdef __cplusplus
-+extern "C"
-+#endif
-+/* We use char because int might match the return type of a gcc2
-+   builtin and then its argument prototype would still apply.  */
-+char fabs ();
-+int
-+main ()
-+{
-+fabs ();
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+rm -f conftest.$ac_objext conftest$ac_exeext
-+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-+  (eval $ac_link) 2>conftest.er1
-+  ac_status=$?
-+  grep -v '^ *+' conftest.er1 >conftest.err
-+  rm -f conftest.er1
-+  cat conftest.err >&5
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); } &&
-+	 { ac_try='test -z "$ac_c_werror_flag"
-+			 || test ! -s conftest.err'
-+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+  (eval $ac_try) 2>&5
-+  ac_status=$?
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); }; } &&
-+	 { ac_try='test -s conftest$ac_exeext'
-+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-+  (eval $ac_try) 2>&5
-+  ac_status=$?
-+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); }; }; then
-+  ac_cv_search_fabs="-l$ac_lib"
-+break
-+else
-+  echo "$as_me: failed program was:" >&5
-+sed 's/^/| /' conftest.$ac_ext >&5
-+
-+fi
-+rm -f conftest.err conftest.$ac_objext \
-+      conftest$ac_exeext conftest.$ac_ext
-+  done
-+fi
-+LIBS=$ac_func_search_save_LIBS
-+fi
-+echo "$as_me:$LINENO: result: $ac_cv_search_fabs" >&5
-+echo "${ECHO_T}$ac_cv_search_fabs" >&6
-+if test "$ac_cv_search_fabs" != no; then
-+  test "$ac_cv_search_fabs" = "none required" || LIBS="$ac_cv_search_fabs $LIBS"
-+
-+fi
-+
- 
- GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
- 

diff --git a/sys-devel/binutils/files/2.18-ldwrap-interix.sh b/sys-devel/binutils/files/2.18-ldwrap-interix.sh
deleted file mode 100644
index 3c455f84e3..0000000000
--- a/sys-devel/binutils/files/2.18-ldwrap-interix.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env bash
-
-# Wrapper for interix to avoid /usr/local/*. This is done
-# by using our own linker scripts. These scripts are copied
-# over from interix' gcc 3.3 and modified to not include
-# /usr/local/lib for library search. Still we have to tell
-# ld to use those scripts....
-
-ScriptDir=@SCRIPTDIR@
-ScriptPlatform=i386pe_posix
-ScriptExt=x
-
-Opt_Ur=no
-Opt_r=no
-Opt_N=no
-Opt_n=no
-Opt_shared=no
-Opt_ldl="-ldl"
-Args=
-
-for arg in "$@"; do
-	case $arg in
-	-Ur)      Opt_Ur=yes ;;
-	-r)       Opt_r=yes ;;
-	-N)       Opt_N=yes ;;
-	-n)       Opt_n=yes ;;
-	--shared) Opt_shared=yes ;;
-    -Bstatic) Opt_ldl= ;;
-	esac
-
-	# manpages states '-soname', but '-h' seems to work better !?
-	OptArg=
-
-	case $arg in
-	-soname)  arg="-h" ;;
-	-soname=*) OptArg="${arg#-soname=}"; arg="-h" ;;
-	--version-script=*) continue ;; # ignore. this only make troubles!
-    -L/usr/lib/x86) continue ;; # fuck off, bloody bastard see below:
-		# gcc needs to know about /usr/lib/x86 to find startfiles, but
-		# knowing it, makes gcc add this path with -L on the linker
-		# command line. since the linker is a binutils-config extwrapper,
-		# it removes all -L${EPREFIX}/{lib,usr/lib} from the command line
-		# (and the linker itself adds them again later on). This makes us
-		# end up with /usr/lib/x86 up front of the prefix, making the linker
-		# find _WRONG_ libraries, resulting in damaged binaries and/or failed
-		# links.
-	esac
-
-	Args="$Args '$arg'"
-	[ -z "$OptArg" ] || Args="$Args '$OptArg'"
-done
-
-if [ $Opt_Ur = "yes" ]; then
-	ScriptExt=xu
-elif [ $Opt_r = "yes" ]; then
-	ScriptExt=xr
-elif [ $Opt_N = "yes" ]; then
-	ScriptExt=xbn
-elif [ $Opt_n = "yes" ]; then
-	ScriptExt=xn
-elif [ $Opt_shared = "yes" ]; then
-	ScriptExt=xs
-fi
-
-#
-# WARNING: --script is the last here intentionally, since all library paths given
-# in the file are added dependant to the position where the --script option appears
-# on the command line. this means that if not given last, libraries from /opt/gcc...
-# and /usr/lib will allways get linked in before any library from our prefix (which
-# we *definitly* don't want...
-#
-# There is some nasty redirection trick here, which enables this script to remove
-# dumb assertions from stderr without touching the rest.
-#
-exec 3>&1
-eval "/opt/gcc.3.3/bin/ld $Args $Opt_ldl --script '$ScriptDir/$ScriptPlatform.$ScriptExt'" 2>&1 >&3 3>&- \
-    | grep -v -E 'assertion fail .*/cofflink.c:5211' 3>&- 1>&2 2>/dev/null
-_st=${PIPESTATUS[0]}
-exec 3>&-
-
-exit ${_st}
-

diff --git a/sys-devel/binutils/files/2.18-solarisx86_64.patch b/sys-devel/binutils/files/2.18-solarisx86_64.patch
deleted file mode 100644
index a486283bc6..0000000000
--- a/sys-devel/binutils/files/2.18-solarisx86_64.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-* add recognition for x86_64-pc-solaris2*
-
---- bfd/config.bfd
-+++ bfd/config.bfd
-@@ -489,6 +489,13 @@
-     targ64_selvecs=bfd_elf64_x86_64_vec
-     want64=true
-     ;;
-+#ifdef BFD64
-+  x86_64-*-solaris2*)
-+    targ_defvec=bfd_elf32_i386_vec
-+    targ_selvecs="bfd_elf64_x86_64_vec i386coff_vec"
-+    want64=true
-+    ;;
-+#endif
-   i[3-7]86-*-kaos*)
-     targ_defvec=bfd_elf32_i386_vec
-     targ_selvecs=bfd_elf32_i386_vec
---- ld/configure.tgt
-+++ ld/configure.tgt
-@@ -206,6 +206,11 @@
-                         targ_extra_emuls="elf_i386 elf_x86_64"
- 			targ_extra_libpath=$targ_extra_emuls
-                         ;;
-+x86_64-*-solaris2*)
-+			targ_emul=elf_x86_64
-+			targ_extra_emuls="elf_i386 elf_i386_ldso"
-+			targ_extra_libpath=elf_i386
-+			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
- i[3-7]86-*-unixware)	targ_emul=elf_i386 ;;
- i[3-7]86-*-solaris*)	targ_emul=elf_i386_ldso
-                         targ_extra_emuls="elf_i386"

diff --git a/sys-devel/binutils/files/2.21-ldwrap-interix.sh b/sys-devel/binutils/files/2.21-ldwrap-interix.sh
deleted file mode 100644
index 44570f0d7f..0000000000
--- a/sys-devel/binutils/files/2.21-ldwrap-interix.sh
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env bash
-
-# Wrapper for interix to avoid /usr/local/*. This is done
-# by using our own linker scripts. These scripts are copied
-# over from interix' gcc 3.3 and modified to not include
-# /usr/local/lib for library search. Still we have to tell
-# ld to use those scripts....
-
-ScriptDir=@SCRIPTDIR@
-ScriptPlatform=i386pe_posix
-ScriptExt=x
-
-Opt_Ur=no
-Opt_r=no
-Opt_N=no
-Opt_n=no
-Opt_shared=no
-Opt_ldl="-ldl"
-Args=
-
-Opt_v_seen=no
-Opt_file_seen=no
-
-for arg in "$@"; do
-	case $arg in
-	-Ur)      Opt_Ur=yes ;;
-	-r)       Opt_r=yes ;;
-	-N)       Opt_N=yes ;;
-	-n)       Opt_n=yes ;;
-	--shared) Opt_shared=yes ;;
-    -Bstatic) Opt_ldl= ;;
-	-v)		  Opt_v_seen=yes ;;
-	*)		  [[ -e "$1" ]] && Opt_file_seen=yes ;;
-	esac
-
-	# manpages states '-soname', but '-h' seems to work better !?
-	OptArg=
-
-	case $arg in
-	-soname)  arg="-h" ;;
-	-soname=*) OptArg="${arg#-soname=}"; arg="-h" ;;
-	--version-script=*) continue ;; # ignore. this only make troubles!
-    -L/usr/lib/x86) continue ;; # fuck off, bloody bastard see below:
-		# gcc needs to know about /usr/lib/x86 to find startfiles, but
-		# knowing it, makes gcc add this path with -L on the linker
-		# command line. since the linker is a binutils-config extwrapper,
-		# it removes all -L${EPREFIX}/{lib,usr/lib} from the command line
-		# (and the linker itself adds them again later on). This makes us
-		# end up with /usr/lib/x86 up front of the prefix, making the linker
-		# find _WRONG_ libraries, resulting in damaged binaries and/or failed
-		# links.
-	esac
-
-	Args="$Args '$arg'"
-	[ -z "$OptArg" ] || Args="$Args '$OptArg'"
-done
-
-if [ $Opt_Ur = "yes" ]; then
-	ScriptExt=xu
-elif [ $Opt_r = "yes" ]; then
-	ScriptExt=xr
-elif [ $Opt_N = "yes" ]; then
-	ScriptExt=xbn
-elif [ $Opt_n = "yes" ]; then
-	ScriptExt=xn
-elif [ $Opt_shared = "yes" ]; then
-	ScriptExt=xs
-fi
-
-#
-# If just calling ld -v, we definitely DON'T want to add -ldl, as it makes the
-# linker crash ... :*(
-#
-[[ ${Opt_v_seen} == yes && ${Opt_file_seen} == no ]] && \
-	Opt_ldl=
-
-#
-# WARNING: --script is the last here intentionally, since all library paths given
-# in the file are added dependant to the position where the --script option appears
-# on the command line. this means that if not given last, libraries from /opt/gcc...
-# and /usr/lib will allways get linked in before any library from our prefix (which
-# we *definitly* don't want...
-#
-# There is some nasty redirection trick here, which enables this script to remove
-# dumb assertions from stderr without touching the rest.
-#
-exec 3>&1
-eval "/opt/gcc.3.3/bin/ld $Args $Opt_ldl --script '$ScriptDir/$ScriptPlatform.$ScriptExt'" 2>&1 >&3 3>&- \
-    | grep -v -E 'assertion fail .*/cofflink.c:5211' 3>&- 1>&2 2>/dev/null
-_st=${PIPESTATUS[0]}
-exec 3>&-
-
-exit ${_st}
-

diff --git a/sys-devel/binutils/files/binutils-2.16-gcc4.patch b/sys-devel/binutils/files/binutils-2.16-gcc4.patch
deleted file mode 100644
index 2308e667dd..0000000000
--- a/sys-devel/binutils/files/binutils-2.16-gcc4.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- bfd/aix5ppc-core.c
-+++ bfd/aix5ppc-core.c
-@@ -117,7 +117,7 @@
-     return return_value;
- 
-   memcpy (new_core_hdr, &core, sizeof (struct core_dumpxx));
--  core_hdr(abfd) = (char *)new_core_hdr;
-+  abfd->tdata.any = (char *)new_core_hdr;
- 
-   /* .stack section.  */
-   sec = bfd_make_section_anyway (abfd, ".stack");

diff --git a/sys-devel/binutils/files/binutils-2.16-solaris10.patch b/sys-devel/binutils/files/binutils-2.16-solaris10.patch
deleted file mode 100644
index 3689cf516c..0000000000
--- a/sys-devel/binutils/files/binutils-2.16-solaris10.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- bfd/elflink.c
-+++ bfd/elflink.c
-@@ -3683,11 +3683,12 @@
- 
- 	  /* If this is a hidden symbol, or if it is not version
- 	     1, we append the version name to the symbol name.
--	     However, we do not modify a non-hidden absolute
--	     symbol, because it might be the version symbol
--	     itself.  FIXME: What if it isn't?  */
-+	     However, we do not modify a non-hidden absolute symbol
-+	     if it is not a function, because it might be the version
-+	     symbol itself.  FIXME: What if it isn't?  */
- 	  if ((iver.vs_vers & VERSYM_HIDDEN) != 0
--	      || (vernum > 1 && ! bfd_is_abs_section (sec)))
-+	      || (vernum > 1 && (! bfd_is_abs_section (sec)
-+				 || ELF_ST_TYPE (isym->st_info) == STT_FUNC)))
- 	    {
- 	      const char *verstr;
- 	      size_t namelen, verlen, newlen;
---- ld/configure.tgt
-+++ ld/configure.tgt
-@@ -171,10 +171,12 @@
- i[3-7]86-*-sysv[45]*)	targ_emul=elf_i386 ;;
- i[3-7]86-*-solaris2*)	targ_emul=elf_i386_ldso
-                         targ_extra_emuls="elf_i386 elf_x86_64"
-+			targ_extra_libpath=$targ_extra_emuls
-                         ;;
- i[3-7]86-*-unixware)	targ_emul=elf_i386 ;;
- i[3-7]86-*-solaris*)	targ_emul=elf_i386_ldso
-                         targ_extra_emuls="elf_i386"
-+			targ_extra_libpath=$targ_extra_emuls
-                         ;;
- i[3-7]86-*-netbsdelf* | \
- i[3-7]86-*-netbsd*-gnu* | \

diff --git a/sys-devel/binutils/files/binutils-2.18.50.0.7-mint.patch b/sys-devel/binutils/files/binutils-2.18.50.0.7-mint.patch
deleted file mode 100644
index 127dcac736..0000000000
--- a/sys-devel/binutils/files/binutils-2.18.50.0.7-mint.patch
+++ /dev/null
@@ -1,2503 +0,0 @@
-diff -aurN binutils-2.18/bfd/Makefile.am binutils-2.18-mint-20080228/bfd/Makefile.am
---- binutils-2.18/bfd/Makefile.am	2007-08-28 22:20:14.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/Makefile.am	2008-02-28 09:46:59.109375000 +0100
-@@ -351,6 +351,7 @@
- 	pei-mips.lo \
- 	peigen.lo \
- 	ppcboot.lo \
-+	prg-mint.lo \
- 	reloc16.lo \
- 	riscix.lo \
- 	sparclinux.lo \
-@@ -529,6 +530,7 @@
- 	pe-mips.c \
- 	pei-mips.c \
- 	ppcboot.c \
-+	prg-mint.c \
- 	reloc16.c \
- 	riscix.c \
- 	sparclinux.c \
-@@ -1754,6 +1756,9 @@
-   $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
- ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
-   $(INCDIR)/hashtab.h
-+prg-mint.lo: prg-mint.c $(INCDIR)/aout/aout64.h \
-+  $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
-+  $(INCDIR)/bfdlink.h libaout.h aoutx.h aout-target.h
- reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
-   $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \
-   libcoff.h
-diff -aurN binutils-2.18/bfd/Makefile.in binutils-2.18-mint-20080228/bfd/Makefile.in
---- binutils-2.18/bfd/Makefile.in	2007-08-28 22:20:12.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/Makefile.in	2008-02-28 09:46:59.156250000 +0100
-@@ -601,6 +601,7 @@
- 	pei-mips.lo \
- 	peigen.lo \
- 	ppcboot.lo \
-+	prg-mint.lo \
- 	reloc16.lo \
- 	riscix.lo \
- 	sparclinux.lo \
-@@ -779,6 +780,7 @@
- 	pe-mips.c \
- 	pei-mips.c \
- 	ppcboot.c \
-+	prg-mint.c \
- 	reloc16.c \
- 	riscix.c \
- 	sparclinux.c \
-@@ -2334,6 +2336,9 @@
-   $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
- ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
-   $(INCDIR)/hashtab.h
-+prg-mint.lo: prg-mint.c $(INCDIR)/aout/aout64.h \
-+  $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
-+  $(INCDIR)/bfdlink.h libaout.h aoutx.h aout-target.h
- reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
-   $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \
-   libcoff.h
-diff -aurN binutils-2.18/bfd/acinclude.m4 binutils-2.18-mint-20080228/bfd/acinclude.m4
---- binutils-2.18/bfd/acinclude.m4	2007-08-06 21:59:13.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/acinclude.m4	2008-02-28 09:46:59.171875000 +0100
-@@ -3,7 +3,7 @@
- [AC_REQUIRE([AC_CANONICAL_TARGET])
- case "${host}" in
- changequote(,)dnl
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- changequote([,])dnl
-   AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
- esac])dnl
-diff -aurN binutils-2.18/bfd/aoutx.h binutils-2.18-mint-20080228/bfd/aoutx.h
---- binutils-2.18/bfd/aoutx.h	2007-08-06 21:59:13.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/aoutx.h	2008-02-28 09:46:59.218750000 +0100
-@@ -1832,6 +1832,11 @@
-   bfd_byte buffer[BYTES_IN_WORD];
-   bfd_size_type amt = BYTES_IN_WORD;
- 
-+  /* The MiNT backend writes past the string table.  It therefore has to
-+     know about the table size.  */
-+  obj_aout_external_string_size (abfd) = _bfd_stringtab_size (tab) +
-+    BYTES_IN_WORD;
-+
-   /* The string table starts with the size.  */
-   PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
-   if (bfd_bwrite ((void *) buffer, amt, abfd) != amt)
-diff -aurN binutils-2.18/bfd/bfd-in.h binutils-2.18-mint-20080228/bfd/bfd-in.h
---- binutils-2.18/bfd/bfd-in.h	2007-08-06 21:59:14.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/bfd-in.h	2008-02-28 09:46:59.250000000 +0100
-@@ -791,6 +791,12 @@
- extern bfd_boolean bfd_sparclinux_size_dynamic_sections
-   (bfd *, struct bfd_link_info *);
- 
-+/* MiNT executable support routines for the linker.  */
-+extern bfd_boolean bfd_m68kmint_set_extended_flags
-+  (bfd *, flagword);
-+extern bfd_boolean bfd_m68kmint_add_tpa_relocation_entry
-+  (bfd *abfd, bfd_vma address);
-+
- /* mmap hacks */
- 
- struct _bfd_window_internal;
-diff -aurN binutils-2.18/bfd/bfd-in2.h binutils-2.18-mint-20080228/bfd/bfd-in2.h
---- binutils-2.18/bfd/bfd-in2.h	2007-08-06 21:59:15.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/bfd-in2.h	2008-02-28 09:46:59.328125000 +0100
-@@ -798,6 +798,12 @@
- extern bfd_boolean bfd_sparclinux_size_dynamic_sections
-   (bfd *, struct bfd_link_info *);
- 
-+/* MiNT executable support routines for the linker.  */
-+extern bfd_boolean bfd_m68kmint_set_extended_flags
-+  (bfd *, flagword);
-+extern bfd_boolean bfd_m68kmint_add_tpa_relocation_entry
-+  (bfd *abfd, bfd_vma address);
-+
- /* mmap hacks */
- 
- struct _bfd_window_internal;
-diff -aurN binutils-2.18/bfd/config.bfd binutils-2.18-mint-20080228/bfd/config.bfd
---- binutils-2.18/bfd/config.bfd	2007-08-28 19:19:33.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/config.bfd	2008-02-28 09:46:59.375000000 +0100
-@@ -777,6 +777,11 @@
-     # targ_selvecs=m68kmach3_vec
-     # targ_cflags=-DSTAT_FOR_EXEC
-     ;;
-+  m68*-*-mint*)
-+    targ_defvec=aout0_big_vec
-+    targ_selvecs=m68kmint_prg_vec
-+    targ_underscore=yes
-+    ;;
-   m68*-hp*-netbsd*)
-     targ_defvec=m68k4knetbsd_vec
-     targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
-diff -aurN binutils-2.18/bfd/configure binutils-2.18-mint-20080228/bfd/configure
---- binutils-2.18/bfd/configure	2007-08-28 22:19:51.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/configure	2008-02-28 09:48:33.234375000 +0100
-@@ -16753,7 +16753,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- cat >>confdefs.h <<\_ACEOF
- #define USE_BINARY_FOPEN 1
-@@ -19222,6 +19222,7 @@
-     m68kcoff_vec)		tb="$tb coff-m68k.lo cofflink.lo" ;;
-     m68kcoffun_vec)		tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
-     m68klinux_vec)		tb="$tb m68klinux.lo aout32.lo" ;;
-+    m68kmint_prg_vec)		tb="$tb prg-mint.lo aout32.lo" ;;
-     m68knetbsd_vec)		tb="$tb m68knetbsd.lo aout32.lo" ;;
-     m68ksysvcoff_vec)		tb="$tb coff-svm68k.lo cofflink.lo" ;;
-     m88kbcs_vec)		tb="$tb coff-m88k.lo" ;;
-diff -aurN binutils-2.18/bfd/configure.in binutils-2.18-mint-20080228/bfd/configure.in
---- binutils-2.18/bfd/configure.in	2007-08-28 22:19:56.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/configure.in	2008-02-28 09:48:22.671875000 +0100
-@@ -800,6 +800,7 @@
-     m68kcoff_vec)		tb="$tb coff-m68k.lo cofflink.lo" ;;
-     m68kcoffun_vec)		tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
-     m68klinux_vec)		tb="$tb m68klinux.lo aout32.lo" ;;
-+    m68kmint_prg_vec)		tb="$tb prg-mint.lo aout32.lo" ;;
-     m68knetbsd_vec)		tb="$tb m68knetbsd.lo aout32.lo" ;;
-     m68ksysvcoff_vec)		tb="$tb coff-svm68k.lo cofflink.lo" ;;
-     m88kbcs_vec)		tb="$tb coff-m88k.lo" ;;
-diff -aurN binutils-2.18/bfd/libaout.h binutils-2.18-mint-20080228/bfd/libaout.h
---- binutils-2.18/bfd/libaout.h	2007-08-06 21:59:36.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/libaout.h	2008-02-28 09:47:00.031250000 +0100
-@@ -420,6 +420,10 @@
-      table, used when linking on SunOS.  This is indexed by the symbol
-      index.  */
-   bfd_vma *local_got_offsets;
-+
-+  /* A pointer for data used by aout extensions.  (Currently only used
-+     by MiNT executables (see prg-mint.c).  */
-+  void *ext;
- };
- 
- struct  aout_data_struct
-@@ -447,6 +451,7 @@
- #define obj_aout_string_window(bfd)        (adata (bfd).string_window)
- #define obj_aout_sym_hashes(bfd)           (adata (bfd).sym_hashes)
- #define obj_aout_dynamic_info(bfd)         (adata (bfd).dynamic_info)
-+#define obj_aout_ext(bfd)                  (adata (bfd).ext)
- 
- /* We take the address of the first element of an asymbol to ensure that the
-    macro is only ever applied to an asymbol.  */
-diff -aurN binutils-2.18/bfd/prg-mint.c binutils-2.18-mint-20080228/bfd/prg-mint.c
---- binutils-2.18/bfd/prg-mint.c	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.18-mint-20080228/bfd/prg-mint.c	2008-02-28 09:47:00.046875000 +0100
-@@ -0,0 +1,1718 @@
-+/* BFD backend for traditional MiNT executables.
-+   Copyright 1998, 2007 Free Software Foundation, Inc.
-+   Originally written by Guido Flohr (guido@freemint.de).
-+   Modified by Vincent Riviere (vincent.riviere@freesbee.fr).
-+
-+   This file is part of BFD, the Binary File Descriptor library.
-+   
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software
-+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-+   MA 02110-1301, USA.  */
-+
-+/* The format of executables on Atari is actually not a.out,  it is
-+   only chosen as an approach which comes close enough.  The layout of a
-+   program image on disk looked like this:
-+
-+   +-----------------+
-+   | 28 Bytes Header |
-+   +-----------------+
-+   | Text segment    |
-+   +-----------------+
-+   | Data segment    |
-+   +-----------------+
-+   | BSS	     |
-+   +-----------------+
-+   | Symbol table    |
-+   +-----------------+
-+   | TPA relocation  |
-+   +-----------------+
-+
-+   The 28 byte exec header used to look like this:
-+
-+   struct old_exec_header
-+   {
-+     bfd_byte a_magic[2];
-+     bfd_byte a_text[4];
-+     bfd_byte a_data[4];
-+     bfd_byte a_bss[4];
-+     bfd_byte a_syms[4];
-+     bfd_byte a_resvd[4];
-+     bfd_byte a_abs[2];
-+   };
-+
-+   The first two bytes (A_MAGIC) contained an assembler branch
-+   instruction to the beginning of the text segment.  Because the
-+   exec header had a fixed size and the text entry point was constant
-+   this assembler instruction also had a constant value (0x601a).
-+   In fact the operating system never really executed the branch
-+   instruction but used this value (0x601a) as a magic value.
-+
-+   TEXT, DATA and BSS were as one would expect them.  The symbol
-+   table wasn't.  Several different formats were in use, none of them
-+   very efficient, none of them powerful enough to support source
-+   level debugging.  I've changed that and the GNU symbol table will
-+   now be used instead (unless the --traditional-format option was
-+   given to the linker).
-+
-+   If the last member A_ABS of the exec header is zero the program
-+   image contains an additional table with relocation information
-+   at the end of the image.  The kernel can load program images at
-+   virtually any address in the address space.	In fact it will load
-+   it at the start of the biggest block of free memory.  This block
-+   is then called the Transient Program Area TPA and the image has
-+   to be relocated against the TPA at runtime.	The relocation info
-+   itself is in a simply way compressed:  It starts with a four-byte
-+   value, the first address within the image to be relocated.  Now
-+   following are one-byte offsets to the last address.	The special
-+   value of 1 (which is impossible as an offset) signifies that 254
-+   has to be added to the next offset.	The table is finished with
-+   a zero-byte.
-+
-+   I now simply extended the header from its old 28 bytes to 256
-+   bytes.  The first 28 bytes give home to a standard Atari header,
-+   the rest is for extensions.	The extension header starts with
-+   a ``real'' assembler instruction, a far jump to the text entry
-+   point.  The extension header gives home to a standard a.out
-+   exec header (currently NMAGIC or OMAGIC only) plus some extra
-+   more or less useful fields plus space to future extensions.
-+   For the OS the extension header will already belong to the text
-+   segment, for BFD backends the text segment is 228 (or 0xe4)
-+   bytes smaller than for the OS.  This explains for example the
-+   funny TEXT_START_ADDR 0xe4.
-+
-+   The TARGET_PAGE_SIZE is 2 which is only fake.  There is currently
-+   no such thing as memory paging on the Atari (and this is why
-+   ZMAGICs are disabled for now to allow for future enhancements).
-+
-+   If you think that this whole file looks quite like a big hack
-+   you're probably right.  But the results (mainly the output of
-+   the linker) seem to work and they allow to use up-to-date
-+   binutils on the Atari until a better executable format (maybe
-+   ELF) has been established for this machine.	*/
-+
-+#include "sysdep.h"
-+#include "bfd.h"
-+
-+#define N_HEADER_IN_TEXT(x) 0
-+#define BYTES_IN_WORD 4
-+#define ENTRY_CAN_BE_ZERO
-+#define N_SHARED_LIB(x) 0
-+#define TEXT_START_ADDR 0xe4
-+#define TARGET_PAGE_SIZE 2
-+#define TARGET_IS_BIG_ENDIAN_P
-+#define DEFAULT_ARCH bfd_arch_m68k
-+#define N_TXTADDR(x) TEXT_START_ADDR
-+
-+/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
-+   remove whitespace added here, and thus will fail to concatenate
-+   the tokens.  */
-+#define MY(OP) CONCAT2 (m68kmint_prg_,OP)
-+#define TARGETNAME "a.out-mintprg"
-+#define NAME(x,y) CONCAT3 (mintprg,_32_,y)
-+
-+/* The only location that the macro ZMAGIC_DISK_BLOCK_SIZE seems to
-+   be needed is in aout-target.h where the file position of the text
-+   segment is determined.  Our target page size of 2 is actually just a
-+   joke (no paging on Atari, we simply short-word-align sections) so
-+   we have to explicitely tell aout-target here.  Nonetheless, this
-+   doesn't seem clean to me.  Does aoutx.h (adjust_n_magic) has to
-+   be modified?  */
-+#define ZMAGIC_DISK_BLOCK_SIZE EXEC_BYTES_SIZE
-+
-+/* If --traditional-format was given to the linker an old-style DRI
-+   symbol table is written into the executable.  This is with respect
-+   to many old debugging tools or disassemblers which expect this format.
-+   Although created by the linker, these executables will not be recognized
-+   as a valid bfd input file.  It is too much effort to evaluate the
-+   symbols from such files.  */
-+#define _MINT_SYMBOL_FORMAT_GNU  0
-+#define _MINT_SYMBOL_FORMAT_DRI  1
-+
-+/* Forward declarations.  */
-+struct bfd_link_info;
-+struct reloc_std_external;
-+
-+/* Data structure that holds some private information for us.  */
-+struct mint_internal_info
-+{
-+  struct bfd_link_info *linkinfo;    /* Remembered from final_link.  */
-+  bfd_boolean	traditional_format;  /* Saved from link info.  */
-+  int		symbol_format;	     /* Format of the symbol table.  */
-+  void		*tparel; 	     /* Data for TPA relative relocation
-+					information.  */
-+  file_ptr	tparel_pos;	     /* File position of TPA relative
-+					relocation information.  */
-+  bfd_size_type tparel_size;	     /* Size of TPA relative relocation
-+					information.  */
-+  bfd_size_type symtab_size;	     /* Size of traditional symbol table.  */
-+
-+#define MINT_RELOC_CHUNKSIZE 0x1000
-+  bfd_vma	*relocs; 	     /* Array of address relocations.  */
-+  unsigned long relocs_used;	     /* Number of relocation entries
-+					already used up.  */
-+  unsigned long relocs_allocated;    /* Number of relocation entries
-+					allocated.  */
-+
-+  bfd_vma	stkpos; 	     /* File offset to value of _stksize.  */
-+
-+  flagword	prg_flags;	     /* Standard GEMDOS flags.	*/
-+
-+  bfd_boolean	reloc_error;	     /* True if an unhandled error during
-+					relocation occured.  */
-+};
-+
-+/* We have to do quite a lot of magic to make the Atari format
-+   for GEMDOS executables fit into the standard a.out format.
-+   We start with the original header.  */
-+#define external_exec mint_external_exec
-+struct mint_external_exec
-+{
-+  bfd_byte g_branch[2]; 	     /* 0x601a (or 0xdead for relocatable
-+					linker output).  */
-+  bfd_byte g_text[4];		     /* Length of text section.  */
-+  bfd_byte g_data[4];		     /* Length of data section.  */
-+  bfd_byte g_bss[4];		     /* Length of bss section.	*/
-+  bfd_byte g_syms[4];		     /* Length of symbol table.  */
-+  bfd_byte g_extmagic[4];	     /* Always 0x4d694e54
-+					(in ASCII: ``MiNT'').  */
-+  bfd_byte g_flags[4];		     /* Atari special flags.  */
-+  bfd_byte g_abs[2];		     /* Non-zero if absolute (no relocation
-+					info.  */
-+
-+  /* We extend this header now to provide the information that the
-+     binutils want to see.  Everything following will actually be part
-+     of the text segment (from MiNT's point of view).  As a
-+     consequence the text section has 228 bytes of redundancy.
-+
-+     The following eight bytes should be treated as opaque.
-+     If the word ``opaque'' always attracts your curiosity in
-+     typedefs and structs, here's the explanation:  These eight bytes
-+     are really two assembler instructions.  The first one moves
-+     the contents of e_entry into register d0, the second one
-+     jumps (pc-relative) to the entry point.  See swap_exec_header_out
-+     for details.  */
-+  bfd_byte g_jump_entry[8];
-+
-+  /* Now following a standard a.out header.  Note that the values
-+     may differ from the one given on top.  The traditional header
-+     contains the values that the OS wants to see, the values below
-+     are the values that make the binutils work.  */
-+  bfd_byte e_info[4];		     /* Magic number and stuff.  */
-+  bfd_byte e_text[4];		     /* Length of text section in bytes.  */
-+  bfd_byte e_data[4];		     /* Length of data section.  */
-+  bfd_byte e_bss[4];		     /* Length of standard symbol
-+					table.	*/
-+  bfd_byte e_syms[4];		     /* Length of symbol table.  */
-+  bfd_byte e_entry[4];		     /* Start address.	*/
-+  bfd_byte e_trsize[4]; 	     /* Length of text relocation
-+					info.  */
-+  bfd_byte e_drsize[4]; 	     /* Length of data relocation
-+					info.  */
-+
-+  bfd_byte g_tparel_pos[4];	     /* File position of TPA relative
-+					relocation info.  */
-+  bfd_byte g_tparel_size[4];	     /* Length of TPA relative relocation
-+					info.  */
-+
-+  /* This is for extensions.  */
-+  bfd_byte g_stkpos[4]; 	     /* If stacksize is hardcoded into
-+					the executable you will find it
-+					at file offset g_stkpos.  If
-+					not this is NULL.  */
-+
-+  bfd_byte g_symbol_format[4];	     /* Format of the symbol table.  See
-+					definitions for _MINT_SYMBOL_FORMAT*
-+					above.	*/
-+
-+  /* Pad with zeros.  */
-+  bfd_byte g_pad0[172];
-+};
-+
-+#define EXEC_BYTES_SIZE 256
-+
-+/* Code indicating object file or impure executable.  */
-+#define OMAGIC 0407
-+/* Code indicating pure executable.  */
-+#define NMAGIC 0410
-+/* Code indicating demand-paged executable.  */
-+#define ZMAGIC 0413
-+
-+#ifndef N_BADMAG
-+#define N_BADMAG(x)	  (N_MAGIC(x) != OMAGIC		\
-+			   && N_MAGIC(x) != NMAGIC	\
-+			   && N_MAGIC(x) != ZMAGIC)
-+#endif
-+
-+/* For DRI symbol table format.  */
-+struct dri_symbol
-+{
-+  bfd_byte a_name[8];	  /* Symbol name */
-+  bfd_byte a_type[2];	  /* Type flag, i.e. A_TEXT etc; see below.  */
-+  bfd_byte a_value[4];	  /* value of this symbol (or sdb offset).  */
-+};
-+#define DRI_SYMBOL_SIZE 14
-+
-+/* Simple values for a_type.  */
-+#define A_UNDF	0
-+#define A_BSS	0x0100
-+#define A_TEXT	0x0200
-+#define A_DATA	0x0400
-+#define A_EXT	0x0800	      /* External.  */
-+#define A_EQREG 0x1000	      /* Equated register.  */
-+#define A_GLOBL 0x2000	      /* Global.  */
-+#define A_EQU	0x4000	      /* Equated.  */
-+#define A_DEF	0x8000	      /* Defined.  */
-+#define A_LNAM	0x0048	      /* GST compatible long name.  */
-+			      /* File symbols ala aln.	*/
-+#define A_TFILE 0x0280	      /* Text file corresponding to object module.  */
-+#define A_TFARC 0x02C0	      /* Text file archive.  Unfortunately this
-+				 conflicts with the bits in A_LNAM.  */
-+
-+static bfd_reloc_status_type
-+m68kmint_prg_final_link_relocate (reloc_howto_type *howto,
-+				  bfd *input_bfd,
-+				  asection *input_section,
-+				  bfd_byte *contents,
-+				  bfd_vma address,
-+				  bfd_vma value,
-+				  bfd_vma addend,
-+				  struct reloc_std_external *rel);
-+
-+/* This is a hack.  We have to retrieve the symbol name.  But
-+   to do achieve this with reasonable effort we need an extra
-+   parameter.	*/
-+#define MY_final_link_relocate(howto, input_bfd, input_section, contents,	\
-+			       address, value, addend)				\
-+m68kmint_prg_final_link_relocate (howto, input_bfd, input_section, contents,	\
-+				  address, value, addend,			\
-+				  (struct reloc_std_external *) rel)
-+
-+/* aoutx.h requires definitions for BMAGIC and QMAGIC.	Other
-+   implementations have either chosen OMAGIC or zero for BMAGIC if
-+   not available.  We try it with 0777 which is hopefully impossible. */
-+#define BMAGIC 0777
-+#define QMAGIC 0314
-+
-+#include "aoutx.h"
-+
-+/* libaout doesn't use NAME for these ...  */
-+
-+#define MY_get_section_contents aout_32_get_section_contents
-+
-+/* The following variables and functions
-+   will be provided by aout-target.h.  */
-+
-+static const bfd_target *
-+m68kmint_prg_callback (bfd *abfd);
-+
-+static void
-+MY_final_link_callback (bfd *abfd,
-+			file_ptr *ptreloff,
-+			file_ptr *pdreloff,
-+			file_ptr *psymoff);
-+
-+extern const bfd_target m68kmint_prg_vec;
-+
-+/* Finish up the reading of an a.out file header.  */
-+
-+#define MY_object_p m68kmint_prg_object_p
-+
-+static const bfd_target *
-+m68kmint_prg_object_p (bfd *abfd)
-+{
-+  struct external_exec exec_bytes;	/* Raw exec header from file.  */
-+  struct internal_exec exec;		/* Cleaned-up exec header.  */
-+  const bfd_target *target;
-+  bfd_size_type amt = EXEC_BYTES_SIZE;
-+  struct mint_internal_info *myinfo;
-+  bfd_boolean is_executable = TRUE;
-+
-+  if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
-+    {
-+      if (bfd_get_error () != bfd_error_system_call)
-+	bfd_set_error (bfd_error_wrong_format);
-+      return 0;
-+    }
-+
-+  /* Instead of byte-swapping we compare bytes.  */
-+  if (exec_bytes.g_branch[0] == 0xde
-+      && exec_bytes.g_branch[1] == 0xad)
-+    {
-+      /* This is the result of an invalid objcopy operation.  */
-+      is_executable = FALSE;
-+    }
-+  else if (exec_bytes.g_branch[0] != 0x60
-+	   || exec_bytes.g_branch[1] != 0x1a)
-+    {
-+      bfd_set_error (bfd_error_wrong_format);
-+      return 0;
-+    }
-+
-+  if (exec_bytes.g_branch[0] != 0x60
-+      || exec_bytes.g_branch[1] != 0x1a
-+      || exec_bytes.g_extmagic[0] != 'M'
-+      || exec_bytes.g_extmagic[1] != 'i'
-+      || exec_bytes.g_extmagic[2] != 'N'
-+      || exec_bytes.g_extmagic[3] != 'T'
-+      || exec_bytes.g_symbol_format[0] != 0
-+      || exec_bytes.g_symbol_format[1] != 0
-+      || exec_bytes.g_symbol_format[2] != 0
-+      || exec_bytes.g_symbol_format[3] != 0)
-+    {
-+      bfd_set_error (bfd_error_wrong_format);
-+      return 0;
-+    }
-+
-+#ifdef SWAP_MAGIC
-+  exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
-+#else
-+  exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
-+#endif
-+
-+  if (N_BADMAG (exec))
-+    return 0;
-+
-+#ifdef MACHTYPE_OK
-+  if (!(MACHTYPE_OK (N_MACHTYPE (exec))))
-+    return 0;
-+#endif
-+
-+  NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
-+
-+#ifdef SWAP_MAGIC
-+  /* Swap_exec_header_in read in a_info with the wrong byte order.  */
-+  exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
-+#endif
-+
-+  target = NAME (aout, some_aout_object_p) (abfd, &exec, m68kmint_prg_callback);
-+
-+  myinfo = bfd_zalloc (abfd, sizeof (struct mint_internal_info));
-+
-+  if (myinfo == NULL)
-+    {
-+      /* Error is already set to "out of memory".  */
-+      return 0;
-+    }
-+
-+  obj_aout_ext (abfd) = myinfo;
-+
-+  /* Now get the missing information.  */
-+  myinfo->tparel_pos = GET_WORD (abfd, exec_bytes.g_tparel_pos);
-+  myinfo->tparel_size = GET_WORD (abfd, exec_bytes.g_tparel_size);
-+
-+  /* FIXME:  Currently we always read the TPA relative relocation
-+     information.  This is suboptimal because often times there
-+     is no need for it.  Read it only if need be!  Maybe this should
-+     also depend on abfd->cacheable?  */
-+  if (myinfo->tparel_size == 0)
-+    myinfo->tparel = bfd_zalloc (abfd, 4);
-+  else
-+    myinfo->tparel = bfd_alloc (abfd, myinfo->tparel_size);
-+
-+  if (myinfo->tparel == NULL)
-+    return 0;
-+
-+  if (myinfo->tparel_size == 0)
-+    {
-+      myinfo->tparel_size = 4;
-+    }
-+  else
-+    {
-+      /* Read the information from the bfd.  */
-+      if (bfd_seek (abfd, myinfo->tparel_pos, SEEK_SET) != 0
-+	  || (bfd_bread (myinfo->tparel, myinfo->tparel_size, abfd)
-+	      != myinfo->tparel_size))
-+	{
-+	  return 0;
-+	}
-+    }
-+
-+  myinfo->stkpos = GET_WORD (abfd, exec_bytes.g_stkpos);
-+  myinfo->prg_flags = GET_WORD (abfd, exec_bytes.g_flags);
-+
-+  /* We don't support other formats for the symbol table actively.  */
-+  myinfo->symbol_format = _MINT_SYMBOL_FORMAT_GNU;
-+
-+  return target;
-+}
-+
-+/* Free all information we have cached for this BFD.  We can always
-+   read it again later if we need it.  */
-+
-+#define MY_bfd_free_cached_info m68kmint_prg_bfd_free_cached_info
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_free_cached_info (bfd *abfd)
-+{
-+  if (obj_aout_ext (abfd) != NULL)
-+    {
-+      struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+      if (myinfo != NULL)
-+	{
-+	  if (myinfo->relocs != NULL)
-+	    {
-+	      free (myinfo->relocs);
-+	      myinfo->relocs = NULL;
-+	    }
-+	}
-+    }
-+
-+  return NAME (aout, bfd_free_cached_info) (abfd);
-+}
-+
-+/* Write a DRI symbol with TYPE and VALUE.  If the NAME of the
-+   symbol exceeds 8 characters write a long symbol.  If it
-+   exceeds 22 characters truncate the name.  */
-+
-+static int
-+write_dri_symbol (bfd *abfd, const char *name, int type, bfd_vma value)
-+{
-+  struct dri_symbol sym;
-+  char *ptr = (char*)sym.a_name;
-+  const char *str = name;
-+  char more_name[DRI_SYMBOL_SIZE];
-+  int i = sizeof (sym.a_name);
-+  int written_bytes = 0;
-+
-+  bfd_put_16 (abfd, type, sym.a_type);
-+  bfd_put_32 (abfd, value, sym.a_value);
-+
-+  while (--i >= 0 && ('\0' != (*ptr++ = *str)))
-+    str++;
-+
-+  /* If i >= 0 then *str == '\0' and if i == 0 there is nothing to fill.  */
-+  if (i > 0)
-+    {	/* We are done - fill it with 0.  */
-+      do
-+	*ptr++ = '\0';
-+      while (--i > 0);
-+    }
-+  else if (*str)
-+    {	/* If more to write.  */
-+      type |= A_LNAM;
-+      bfd_put_16 (abfd, type, sym.a_type);
-+      i = sizeof sym;
-+    }
-+
-+  if (bfd_bwrite (&sym, DRI_SYMBOL_SIZE, abfd) != DRI_SYMBOL_SIZE)
-+    return -1;
-+  written_bytes += DRI_SYMBOL_SIZE;
-+
-+  if (i > 0)
-+    {
-+      ptr = more_name;
-+      i = sizeof more_name;
-+      while (--i >= 0 && ('\0' != (*ptr++ = *str)))
-+	str++;
-+
-+      if (bfd_bwrite (more_name, sizeof more_name, abfd)
-+	  != sizeof more_name)
-+	return -1;
-+      written_bytes += sizeof more_name;
-+    }
-+
-+  return written_bytes;
-+}
-+
-+/* Emit a traditional DRI symbol table while linking.
-+   Most of this code come from aout_link_write_symbols() in aoutx.h.  */
-+
-+static bfd_boolean
-+link_write_traditional_syms (bfd *abfd, struct bfd_link_info *info)
-+{
-+  bfd			     *input_bfd;
-+  enum bfd_link_strip	     strip = info->strip;
-+  enum bfd_link_discard      discard = info->discard;
-+  struct mint_internal_info  *myinfo = obj_aout_ext (abfd);
-+  bfd			     *last_archive = NULL;
-+
-+  /* Position file pointer.  */
-+  if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
-+    return FALSE;
-+
-+  myinfo->symtab_size = 0;
-+
-+  for (input_bfd = info->input_bfds; input_bfd != NULL; input_bfd = input_bfd->link_next)
-+    {
-+      bfd_size_type sym_count = obj_aout_external_sym_count (input_bfd);
-+      char *strings = obj_aout_external_strings (input_bfd);
-+      struct external_nlist *sym = obj_aout_external_syms (input_bfd);
-+      struct external_nlist *sym_end = sym + sym_count;
-+      struct aout_link_hash_entry **sym_hash = obj_aout_sym_hashes (input_bfd);
-+      bfd_boolean pass = FALSE;
-+      bfd_boolean skip = FALSE;
-+      bfd_boolean skip_next = FALSE;
-+      int written_bytes;
-+      int a_type;
-+      bfd_boolean write_archive_name = FALSE;
-+      bfd_vma val = 0;
-+
-+      /* First write out a symbol for the archive if we do not
-+	 strip these symbols and if it differs from the last
-+	 one.  */
-+      if (input_bfd->my_archive != last_archive
-+	  && input_bfd->my_archive != NULL)
-+	{
-+	  write_archive_name = TRUE;
-+	  last_archive = input_bfd->my_archive;
-+	}
-+
-+      if (write_archive_name
-+	  && strip != strip_all
-+	  && (strip != strip_some
-+	      || bfd_hash_lookup (info->keep_hash,
-+				  input_bfd->my_archive->filename,
-+				  FALSE, FALSE) != NULL)
-+	  && discard != discard_all)
-+	{
-+	  val = bfd_get_section_vma (abfd,
-+				     obj_textsec (input_bfd)->output_section)
-+	    + obj_textsec (input_bfd)->output_offset;
-+
-+	  written_bytes = write_dri_symbol (abfd,
-+					    input_bfd->my_archive->filename,
-+					    A_TFILE, val);
-+
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+	  else
-+	    myinfo->symtab_size += written_bytes;
-+	}
-+
-+      /* Now write out a symbol for the object file if we do not
-+	 strip these symbols.  */
-+      if (strip != strip_all
-+	  && (strip != strip_some
-+	      || bfd_hash_lookup (info->keep_hash, input_bfd->filename,
-+				  FALSE, FALSE) != NULL)
-+	  && discard != discard_all)
-+	{
-+	  val = bfd_get_section_vma (abfd,
-+				     obj_textsec (input_bfd)->output_section)
-+	    + obj_textsec (input_bfd)->output_offset;
-+
-+	  written_bytes = write_dri_symbol (abfd, input_bfd->filename,
-+					    A_TFILE, val);
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+	  else
-+	    myinfo->symtab_size += written_bytes;
-+	}
-+
-+      /* Now we have a problem.  All symbols that we see have already
-+	 been marked written (because we write them a second time
-+	 here.	If we would do it the clean way we would have
-+	 to traverse the entire symbol map and reset the written
-+	 flag.	We hack here instead...  */
-+#define mark_written(h) (* (int *) &h->written = (int) TRUE + 1)
-+#define is_written(h) ((int) h->written == (int) TRUE + 1)
-+      for (; sym < sym_end; sym++, sym_hash++)
-+	{
-+	  const char *name;
-+	  int type;
-+	  struct aout_link_hash_entry *h;
-+	  asection *symsec;
-+	  val = 0;
-+
-+	  type = H_GET_8 (input_bfd, sym->e_type);
-+	  name = strings + GET_WORD (input_bfd, sym->e_strx);
-+
-+	  h = NULL;
-+
-+	  if (pass)
-+	    {
-+	      /* Pass this symbol through.  It is the target of an
-+	      indirect or warning symbol.  */
-+	      val = GET_WORD (input_bfd, sym->e_value);
-+	      pass = FALSE;
-+	    }
-+	  else if (skip_next)
-+	    {
-+	      /* Skip this symbol, which is the target of an indirect
-+		 symbol that we have changed to no longer be an indirect
-+		 symbol.  */
-+	      skip_next = FALSE;
-+	      continue;
-+	    }
-+	  else
-+	    {
-+	      struct aout_link_hash_entry *hresolve = *sym_hash;
-+
-+	      /* We have saved the hash table entry for this symbol, if
-+		 there is one.	Note that we could just look it up again
-+		 in the hash table, provided we first check that it is an
-+		 external symbol. */
-+	      h = *sym_hash;
-+
-+	      /* Use the name from the hash table, in case the symbol was
-+		 wrapped.  */
-+	    if (h != NULL
-+		&& h->root.type != bfd_link_hash_warning)
-+		name = h->root.root.string;
-+
-+	      /* If this is an indirect or warning symbol, then change
-+		 hresolve to the base symbol.  */
-+	      hresolve = h;
-+	      if (h != (struct aout_link_hash_entry *) NULL
-+		  && (h->root.type == bfd_link_hash_indirect
-+		      || h->root.type == bfd_link_hash_warning))
-+		{
-+		  hresolve = (struct aout_link_hash_entry*) h->root.u.i.link;
-+		  while (hresolve->root.type == bfd_link_hash_indirect
-+			 || hresolve->root.type == bfd_link_hash_warning)
-+		    hresolve = ((struct aout_link_hash_entry*)
-+				hresolve->root.u.i.link);
-+		}
-+
-+	      /* If the symbol has already been written out skip it.  */
-+	      if (h != NULL
-+		  && is_written (h))
-+		{
-+		  if ((type & N_TYPE) == N_INDR
-+		      || type == N_WARNING)
-+		    skip_next = TRUE;
-+		  continue;
-+		}
-+
-+	      /* See if we are stripping this symbol.  */
-+	      skip = FALSE;
-+
-+	      /* Skip all debugger symbols.  No way to output them in
-+		 DRI format.  This will also reduce a lot of headaches.  */
-+	      if ((type & N_STAB) != 0)
-+		skip = TRUE;
-+
-+	      switch (strip)
-+		{
-+		case strip_none:
-+		case strip_debugger:
-+		  break;
-+		case strip_some:
-+		  if (bfd_hash_lookup (info->keep_hash, name, FALSE, FALSE)
-+		      == NULL)
-+		    skip = TRUE;
-+		  break;
-+		case strip_all:
-+		  skip = TRUE;
-+		  break;
-+		}
-+
-+	      if (skip)
-+		{
-+		  if (h != NULL)
-+		    mark_written (h);
-+		  continue;
-+		}
-+
-+	      /* Get the value of the symbol.  */
-+	      if ((type & N_TYPE) == N_TEXT
-+		  || type == N_WEAKT)
-+		symsec = obj_textsec (input_bfd);
-+	      else if ((type & N_TYPE) == N_DATA
-+		       || type == N_WEAKD)
-+		symsec = obj_datasec (input_bfd);
-+	      else if ((type & N_TYPE) == N_BSS
-+		       || type == N_WEAKB)
-+		symsec = obj_bsssec (input_bfd);
-+	      else if ((type & N_TYPE) == N_ABS
-+		       || type == N_WEAKA)
-+		symsec = bfd_abs_section_ptr;
-+	      else if (((type & N_TYPE) == N_INDR
-+			&& (hresolve == NULL
-+			    || (hresolve->root.type != bfd_link_hash_defined
-+				&& hresolve->root.type != bfd_link_hash_defweak
-+				&& hresolve->root.type != bfd_link_hash_common)))
-+		       || type == N_WARNING)
-+		{
-+		  /* Pass the next symbol through unchanged.  The
-+		     condition above for indirect symbols is so that if
-+		     the indirect symbol was defined, we output it with
-+		     the correct definition so the debugger will
-+		     understand it.  */
-+		  pass = TRUE;
-+		  val = GET_WORD (input_bfd, sym->e_value);
-+		  symsec = NULL;
-+		}
-+	      else
-+		{
-+		  /* If we get here with an indirect symbol, it means that
-+		     we are outputting it with a real definition.  In such
-+		     a case we do not want to output the next symbol,
-+		     which is the target of the indirection.  */
-+		  if ((type & N_TYPE) == N_INDR)
-+		    skip_next = TRUE;
-+
-+		  symsec = NULL;
-+
-+		  /* We need to get the value from the hash table.  We use
-+		     hresolve so that if we have defined an indirect
-+		     symbol we output the final definition.  */
-+		  if (h == NULL)
-+		    {
-+		      switch (type & N_TYPE)
-+			{
-+			case N_SETT:
-+			  symsec = obj_textsec (input_bfd);
-+			  break;
-+			case N_SETD:
-+			  symsec = obj_datasec (input_bfd);
-+			  break;
-+			case N_SETB:
-+			  symsec = obj_bsssec (input_bfd);
-+			  break;
-+			case N_SETA:
-+			  symsec = bfd_abs_section_ptr;
-+			  break;
-+			default:
-+			  val = 0;
-+			  break;
-+			}
-+		    }
-+		  else if (hresolve->root.type == bfd_link_hash_defined
-+			   || hresolve->root.type == bfd_link_hash_defweak)
-+		    {
-+		      asection *input_section;
-+		      asection *output_section;
-+
-+		      /* This case usually means a common symbol which was
-+			 turned into a defined symbol.	*/
-+		      input_section = hresolve->root.u.def.section;
-+		      output_section = input_section->output_section;
-+		      BFD_ASSERT (bfd_is_abs_section (output_section)
-+				  || output_section->owner == abfd);
-+
-+		      /* The following reference to the output section VMA
-+			 is commented out because DRI symbols are relative
-+			 to the beginning of the section.  */
-+		      val = (hresolve->root.u.def.value
-+			     /*+ bfd_get_section_vma (abfd, output_section)*/
-+			     + input_section->output_offset);
-+
-+		      /* TEXT symbols values must be adjusted
-+			 by adding the size of the extended header.  */
-+		      if (output_section == obj_textsec (abfd))
-+			val += TEXT_START_ADDR;
-+
-+		      /* Get the correct type based on the section.  If
-+			 this is a constructed set, force it to be
-+			 globally visible.  */
-+		      if (type == N_SETT
-+			  || type == N_SETD
-+			  || type == N_SETB
-+			  || type == N_SETA)
-+			type |= N_EXT;
-+
-+		      type &=~ N_TYPE;
-+
-+		      if (output_section == obj_textsec (abfd))
-+			type |= N_TEXT;
-+		      else if (output_section == obj_datasec (abfd))
-+			type |= N_DATA;
-+		      else if (output_section == obj_bsssec (abfd))
-+			type |= N_BSS;
-+		      else
-+			type |= N_ABS;
-+		    }
-+		  else if (hresolve->root.type == bfd_link_hash_common)
-+		    val = hresolve->root.u.c.size;
-+		  else if (hresolve->root.type == bfd_link_hash_undefweak)
-+		    {
-+		      val = 0;
-+		      type = N_UNDF;
-+		    }
-+		  else
-+		    val = 0;
-+		}
-+	      if (symsec != NULL)
-+		{
-+		  /* The following reference to the output section VMA
-+		     is commented out because DRI symbols are relative
-+		     to the beginning of the section.  */
-+		  val = (/*symsec->output_section->vma
-+			 +*/ symsec->output_offset
-+			 + (GET_WORD (input_bfd, sym->e_value)
-+			 - symsec->vma));
-+
-+		  /* TEXT symbols values must be adjusted
-+		     by adding the size of the extended header.  */
-+		  if (symsec == obj_textsec (input_bfd))
-+		    val += TEXT_START_ADDR;
-+		}
-+
-+	      /* If this is a global symbol set the written flag, and if
-+		 it is a local symbol see if we should discard it.  */
-+	      if (h != NULL)
-+		{
-+		  mark_written (h);
-+		}
-+	      else if ((type & N_TYPE) != N_SETT
-+		       && (type & N_TYPE) != N_SETD
-+		       && (type & N_TYPE) != N_SETB
-+		       && (type & N_TYPE) != N_SETA)
-+		{
-+		  switch (discard)
-+		    {
-+		    case discard_none:
-+		    case discard_sec_merge:
-+		      break;
-+		    case discard_l:
-+		      if (bfd_is_local_label_name (input_bfd, name))
-+			skip = TRUE;
-+		      break;
-+		    default:
-+		    case discard_all:
-+		      skip = TRUE;
-+		      break;
-+		    }
-+		  if (skip)
-+		    {
-+		      pass = FALSE;
-+		      continue;
-+		    }
-+		}
-+	    }
-+
-+	  /* Now find the nearest type in DRI format.  */
-+	  switch (type)
-+	    {
-+	    case N_ABS:
-+	    case N_ABS | N_EXT:
-+	    case N_SETA:
-+	    case N_SETA | N_EXT:
-+	    case N_WEAKA:
-+	      a_type = A_EQU | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_TEXT:
-+	    case N_TEXT | N_EXT:
-+	    case N_SETT:
-+	    case N_SETT | N_EXT:
-+	    case N_WEAKT:
-+	      a_type = A_TEXT | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_DATA:
-+	    case N_DATA | N_EXT:
-+	    case N_SETD:
-+	    case N_SETD | N_EXT:
-+	    case N_WEAKD:
-+	      a_type = A_DATA | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_BSS:
-+	    case N_BSS | N_EXT:
-+	    case N_SETB:
-+	    case N_SETB | N_EXT:
-+	    case N_WEAKB:
-+	      a_type = A_BSS | A_DEF | A_GLOBL;
-+	      break;
-+	    default:
-+	      continue;
-+	    }
-+
-+	  written_bytes = write_dri_symbol (abfd, name, a_type, val);
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+
-+	  myinfo->symtab_size += written_bytes;
-+	}
-+    }
-+
-+  obj_aout_external_string_size (abfd) = 0;
-+  return TRUE;
-+}
-+
-+/* This is used for qsort to sort addresses
-+   for the TPA relocation table.  */
-+
-+static int
-+vma_cmp (const void *v1, const void *v2)
-+{
-+  return (int) ((*((bfd_vma *) v1)) - (*((bfd_vma *) v2)));
-+}
-+
-+/* Alloc and fill the TPA relocation table.  */
-+
-+static bfd_boolean
-+fill_tparel (bfd *abfd)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  unsigned long i;
-+  bfd_size_type bytes;
-+  unsigned char *ptr;
-+
-+  /* Sort the relocation info.	*/
-+  if (myinfo->relocs != NULL)
-+    qsort (myinfo->relocs, myinfo->relocs_used, sizeof (bfd_vma),
-+	   vma_cmp);
-+
-+  /* Now calculate the number of bytes we need.  The relocation info
-+     is encoded as follows:  The first entry is a 32-bit value
-+     denoting the first offset to relocate.  All following entries
-+     are relative to the preceding one.  For relative offsets of
-+     more than 254 bytes a value of 1 is used.	The OS will then
-+     add 254 bytes to the current offset.  The list is then terminated
-+     with the byte 0.  */
-+  bytes = 4; /* First entry is a long.  */
-+  for (i = 1; i < myinfo->relocs_used; i++)
-+    {
-+      unsigned long diff = myinfo->relocs[i] - myinfo->relocs[i - 1];
-+      BFD_ASSERT(diff > 0);
-+      bytes += (diff + 253) / 254;
-+    }
-+  /* Last entry is (bfd_byte) 0 if there are some relocations.  */
-+  if (myinfo->relocs_used > 0)
-+    bytes++;
-+
-+  myinfo->tparel_size = bytes;
-+  myinfo->tparel = bfd_alloc (abfd, bytes);
-+  if (myinfo->tparel == NULL)
-+    return FALSE;
-+
-+  /* Now fill the array.  */
-+  ptr = (bfd_byte*) myinfo->tparel;
-+  if (myinfo->relocs != NULL)
-+    bfd_put_32 (abfd, myinfo->relocs[0], ptr);
-+  else
-+    bfd_put_32 (abfd, 0, ptr);
-+  ptr += 4;
-+
-+  for (i = 1; i < myinfo->relocs_used; i++)
-+    {
-+      unsigned long diff = myinfo->relocs[i] - myinfo->relocs[i - 1];
-+      while (diff > 254)
-+	{
-+	  *ptr++ = 1;
-+	  diff -= 254;
-+	}
-+      *ptr++ = (bfd_byte) diff;
-+    }
-+  
-+  if (myinfo->relocs_used > 0)
-+    *ptr = 0;
-+
-+  return TRUE;
-+}
-+
-+/* Final link routine.	We need to use a call back to get the correct
-+   offsets in the output file.	And we need to malloc some internal
-+   buffers.  */
-+
-+#define MY_bfd_final_link m68kmint_prg_bfd_final_link
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  struct bfd_link_hash_table *hash = info->hash;
-+  enum bfd_link_strip original_strip = info->strip;
-+
-+  if (myinfo == NULL)
-+    myinfo = bfd_zalloc (abfd, sizeof (struct mint_internal_info));
-+
-+  if (myinfo == NULL)
-+    {
-+      /* The internal function bfd_zalloc has already set the error
-+	 state to "out of memory".  */
-+      return FALSE;
-+    }
-+
-+  obj_aout_ext (abfd) = myinfo;
-+
-+  myinfo->linkinfo = info;
-+
-+  /* Make sure that for now we never write zmagics.  */
-+  abfd->flags &= ~D_PAGED;
-+
-+  /* Find the __stksize symbol.  This symbol is used for a MiNT
-+     special kludge.  The libc defines this symbol in an object file
-+     initialized to a default value to make sure it is defined in
-+     every output file.  The start-up code in crtinit() then simply
-+     sets the stacksize accordingly.  In your programs (if they need
-+     an unusual stacksize) you can then simply code:
-+
-+	   long _stksize = 0x2000;
-+
-+     This will create a program stack of 2k.  Since MiNT cannot detect
-+     a stack overflow this is the only way to prevent program crashes
-+     caused by a stack that is too small.
-+
-+     The ancient linker ignored this feature, the ancient strip
-+     program paid heed to it.  By default, strip never stripped this
-+     special symbol from the binary.
-+
-+     Another program called ``printstk'' and its colleague ``fixstk''
-+     could be used to either print the current value of the stacksize
-+     or to modify it without recompiling and rebuilding.  These
-+     programs traversed the symbol table and then took the appropriate
-+     measures if the symbol was found.
-+
-+     Here we do a different approach.  Since we already expanded the
-+     standard executable header we now hardcode the address (as a file
-+     offset) that the __stksize symbol points to into the header.  We
-+     can now let strip safely remove the entry from the symbol table
-+     and we're not dependent on a special format of the symbol table.
-+     Because the address is kept in the header we will always be able
-+     to manipulate the stacksize value later.  */
-+  if (hash != NULL)
-+    {
-+      struct aout_link_hash_entry *h =
-+	aout_link_hash_lookup (aout_hash_table (info), "__stksize",
-+			       FALSE, FALSE, FALSE);
-+      asection *sec;
-+
-+      if (h != NULL)
-+	{
-+	  switch (h->root.type)
-+	    {
-+	    case bfd_link_hash_defined:
-+	    case bfd_link_hash_defweak:
-+	      sec = h->root.u.def.section->output_section;
-+	      BFD_ASSERT (bfd_is_abs_section (sec)
-+			  || sec->owner == abfd);
-+
-+	      myinfo->stkpos = (h->root.u.def.value + sec->vma
-+				+ h->root.u.def.section->output_offset
-+				+ 0x1c);
-+	      break;
-+	    case bfd_link_hash_common:
-+	      myinfo->stkpos = h->root.u.c.size + 0x1c;
-+	      break;
-+	    default:  /* Ignore other types.  */
-+	      break;
-+	    }
-+	}
-+    }
-+
-+  if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
-+    {
-+      if (info->relocatable)
-+	{
-+	  _bfd_error_handler ("warning: traditional format not supported for relocatable output");
-+	}
-+      else
-+	{
-+	  myinfo->traditional_format = TRUE;
-+	  myinfo->symbol_format = _MINT_SYMBOL_FORMAT_DRI;
-+	}
-+    }
-+
-+  /* Unconditionally unset the traditional flag.  The only effect in
-+     the a.out code is to disable string hashing (with respect to
-+     SunOS gdx).  This is not necessary for us.  */
-+
-+  abfd->flags &= ~BFD_TRADITIONAL_FORMAT;
-+
-+  /* Do not write GNU symbols in traditional format.  */
-+  if (myinfo->traditional_format)
-+    info->strip = strip_all;
-+
-+  if (NAME(aout,final_link) (abfd, info, MY_final_link_callback)
-+      != TRUE)
-+    return FALSE;
-+
-+  if (myinfo->reloc_error)
-+    return FALSE;
-+
-+  /* Restore the strip status for the traditional symbols.  */
-+  info->strip = original_strip;
-+
-+  if (myinfo->traditional_format
-+      && link_write_traditional_syms (abfd, info) != TRUE)
-+    return FALSE;
-+
-+  if (fill_tparel (abfd) != TRUE)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Copy backend specific data from one object module to another.  */
-+
-+#define MY_bfd_copy_private_bfd_data m68kmint_prg_bfd_copy_private_bfd_data
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_copy_private_bfd_data (bfd *input_bfd, bfd *output_bfd)
-+{
-+  /* Our routine only makes sense if both the input and the output
-+     bfd are MiNT program files.  FIXME:  It is not absolutely clear
-+     to me if this function is a method of the input or the output
-+     bfd.  One part of the following AND relation is not redundant,
-+     but which one?  */
-+  if (input_bfd->xvec == &m68kmint_prg_vec && output_bfd->xvec == &m68kmint_prg_vec)
-+    {
-+      struct mint_internal_info *myinfo_in = obj_aout_ext (input_bfd);
-+      struct mint_internal_info *myinfo_out = obj_aout_ext (output_bfd);
-+
-+      BFD_ASSERT (myinfo_in != NULL);
-+
-+      if (myinfo_out == NULL)
-+	{
-+	  myinfo_out = bfd_zalloc (output_bfd, sizeof (struct mint_internal_info));
-+
-+	  if (myinfo_out == NULL)
-+	    {
-+	      /* The internal function bfd_zalloc has already set the error
-+		 state to "out of memory".  */
-+	      return FALSE;
-+	    }
-+
-+	  memcpy (myinfo_out, myinfo_in, sizeof (struct mint_internal_info));
-+	  myinfo_out->tparel = NULL;
-+	  obj_aout_ext (output_bfd) = myinfo_out;
-+	}
-+
-+      if (myinfo_out->tparel != NULL)
-+	free (myinfo_out->tparel);
-+
-+      if (myinfo_in->tparel != NULL)
-+      {
-+	if (bfd_seek (input_bfd, myinfo_in->tparel_pos, SEEK_SET) != 0)
-+	  return FALSE;
-+
-+	if (bfd_bread (myinfo_in->tparel, myinfo_in->tparel_size, input_bfd)
-+	    != myinfo_in->tparel_size)
-+	  return FALSE;
-+      }
-+      myinfo_out->tparel = bfd_alloc (output_bfd, myinfo_out->tparel_size);
-+      if (myinfo_out->tparel == NULL)
-+	return FALSE;
-+
-+      memcpy (myinfo_out->tparel, myinfo_in->tparel,
-+	      myinfo_out->tparel_size);
-+    }
-+  else if (input_bfd->xvec != &m68kmint_prg_vec)
-+    {
-+      /* Can this ever happen?	FIXME!	*/
-+      _bfd_error_handler ("error: the input file ``%s'' contains no", input_bfd->filename);
-+      _bfd_error_handler ("TPA-relative relocation info.");
-+
-+      /* We will invalidate the output file so that no attempt is
-+	 made to actually run the image.  Maybe we should return
-+	 FALSE instead but it is possible that some curious soul has
-+	 tried to objcopy onto our format for research reasons.  */
-+      _bfd_error_handler ("Will mark output file ``%s''");
-+      _bfd_error_handler ("as non-executable.");
-+      output_bfd->flags &= (~EXEC_P);
-+    }
-+
-+  return TRUE; /*_bfd_generic_bfd_copy_private_bfd_data (input_bfd, output_bfd);*/
-+}
-+
-+/* Find out the symbol name.  */
-+
-+static const char *
-+find_symbol_name (reloc_howto_type *howto, bfd *input_bfd,
-+		  bfd_byte *location, struct reloc_std_external *rel)
-+{
-+  struct external_nlist *syms = obj_aout_external_syms (input_bfd);
-+  char *strings = obj_aout_external_strings (input_bfd);
-+  struct aout_link_hash_entry **sym_hashes
-+    = obj_aout_sym_hashes (input_bfd);
-+  struct aout_link_hash_entry *h = NULL;
-+  const char *name;
-+  bfd_size_type r_index;
-+  int r_extern;
-+
-+  if (bfd_get_reloc_size (howto) != 4)
-+    return "(not a symbol)";
-+
-+  /* The input bfd is always big-endian.  There is no need to
-+     call bfd_header_big_endian (input_bfd).  */
-+  r_index  = ((rel->r_index[0] << 16)
-+	      | (rel->r_index[1] << 8)
-+	      | (rel->r_index[2]));
-+  r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
-+
-+  if (sym_hashes != NULL)
-+    h = sym_hashes[r_index];
-+
-+  if (!r_extern)
-+    {
-+      bfd_size_type i;
-+      bfd_vma wanted_value = bfd_get_32 (input_bfd, location);
-+
-+      name = NULL;
-+      for (i = 0; i < obj_aout_external_sym_count (input_bfd); i++)
-+	{
-+	  bfd_vma this_value = bfd_get_32 (input_bfd, syms[i].e_value);
-+
-+	  if (this_value == wanted_value)
-+	    {
-+	      bfd_byte symtype = bfd_get_8 (input_bfd, syms[i].e_type);
-+
-+	      /* Skip debug symbols and the like.  */
-+	      if ((symtype & N_STAB) != 0)
-+		continue;
-+
-+	      /* This is dirty but preferable to a plethoria of
-+		 single comparisons.  */
-+	      if (symtype <= (N_BSS | N_EXT)
-+		  || (symtype >= N_WEAKU && symtype <= N_COMM))
-+		{
-+		  name = strings + GET_WORD (input_bfd, syms[i].e_strx);
-+		  break;
-+		}
-+	    }
-+	}
-+
-+      /* FIXME:  If the relocation is against a section there is
-+	 probably a symbol for that section floating around somewhere
-+	 in the bfd jungle.  */
-+      if (name == NULL)
-+	{
-+	  switch ((r_index & N_TYPE) & ~N_EXT)
-+	    {
-+	    case N_TEXT:
-+	      name = "text section";
-+	      break;
-+	    case N_DATA:
-+	      name = "data section";
-+	      break;
-+	    case N_BSS:
-+	      name = "bss section";
-+	      break;
-+	    case N_ABS:
-+	      name = "absolute section";
-+	      break;
-+	    default:
-+	      name = "unknown section";
-+	      break;
-+	    }
-+	}
-+    }
-+  else if (h != NULL)
-+    name = h->root.root.string;
-+  else if (r_index >= obj_aout_external_sym_count (input_bfd))
-+    name = "(unknown symbol)";	/* Shouldn't happen.  */
-+  else
-+    name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
-+
-+  return name;
-+}
-+
-+/* This relocation routine is used by some of the backend linkers.
-+   They do not construct asymbol or arelent structures, so there is no
-+   reason for them to use bfd_perform_relocation.  Also,
-+   bfd_perform_relocation is so hacked up it is easier to write a new
-+   function than to try to deal with it.
-+
-+   This routine does a final relocation.  Whether it is useful for a
-+   relocatable link depends upon how the object format defines
-+   relocations.
-+
-+   FIXME: This routine ignores any special_function in the HOWTO,
-+   since the existing special_function values have been written for
-+   bfd_perform_relocation.
-+
-+   HOWTO is the reloc howto information.
-+   INPUT_BFD is the BFD which the reloc applies to.
-+   INPUT_SECTION is the section which the reloc applies to.
-+   CONTENTS is the contents of the section.
-+   ADDRESS is the address of the reloc within INPUT_SECTION.
-+   VALUE is the value of the symbol the reloc refers to.
-+   ADDEND is the addend of the reloc.  */
-+
-+/* The additional parameter REL is specific to this backend.
-+   This function is derived from _bfd_final_link_relocate()
-+   found in reloc.c. It adds additional checking for dangerous
-+   relocations in MiNT sharable text sections, then it records
-+   the relocated offset in myinfo->relocs[] for further processing.  */
-+
-+static bfd_reloc_status_type
-+m68kmint_prg_final_link_relocate (reloc_howto_type *howto,
-+				  bfd *input_bfd,
-+				  asection *input_section,
-+				  bfd_byte *contents,
-+				  bfd_vma address,
-+				  bfd_vma value,
-+				  bfd_vma addend,
-+				  struct reloc_std_external *rel)
-+{
-+  bfd_vma relocation;
-+  bfd *output_bfd = input_section->output_section->owner;
-+  struct mint_internal_info *myinfo = obj_aout_ext (output_bfd);
-+  bfd_reloc_status_type retval;
-+  int r_index;
-+  int r_extern;
-+  bfd_boolean need_tpa_relocation;
-+
-+  /* The input bfd is always big-endian.  There is no need to
-+     call bfd_header_big_endian (input_bfd).  */
-+  r_index  = ((rel->r_index[0] << 16)
-+	      | (rel->r_index[1] << 8)
-+	      | (rel->r_index[2]));
-+  r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
-+
-+#define _MINT_F_SHTEXT 0x800
-+
-+  /* Sanity check the address.  */
-+  if (address > bfd_get_section_limit (input_bfd, input_section))
-+    return bfd_reloc_outofrange;
-+
-+  /* This function assumes that we are dealing with a basic relocation
-+     against a symbol.  We want to compute the value of the symbol to
-+     relocate to.  This is just VALUE, the value of the symbol, plus
-+     ADDEND, any addend associated with the reloc.  */
-+  relocation = value + addend;
-+
-+  /* Check for dangerous relocations in images with a sharable
-+     text section.  */
-+  if ((myinfo->prg_flags & _MINT_F_SHTEXT) != 0
-+      && bfd_get_reloc_size (howto) == 4)
-+    {
-+      bfd_boolean error_found = FALSE;
-+      const char *name = NULL;
-+
-+      if (input_section == obj_textsec (input_bfd))
-+	{
-+	  if (!r_extern)
-+	    {
-+	      /* This is a relocation against another section.	Only
-+		 relocations against the text section are allowed.  */
-+	      if (r_index != N_TEXT && r_index != (N_TEXT | N_EXT))
-+		error_found = TRUE;
-+	    }
-+	  else if (relocation > (input_section->output_section->vma
-+			    + input_section->output_section->size))
-+	    {
-+	      error_found = TRUE;
-+	    }
-+	  else if (relocation == (input_section->output_section->vma
-+				  + input_section->output_section->size))
-+	    {
-+	      name = find_symbol_name (howto, input_bfd,
-+						    contents + address,
-+						    rel);
-+	      if (strcmp (name, "_etext") == 0)
-+		error_found = FALSE;
-+	    }
-+	}
-+
-+      if (error_found)
-+	{
-+	  const struct bfd_link_callbacks *callbacks
-+	    = myinfo->linkinfo->callbacks;
-+
-+	  myinfo->reloc_error = TRUE;
-+
-+	  if (callbacks->reloc_dangerous != NULL)
-+	    {
-+	      if (name == NULL)
-+		name = find_symbol_name (howto, input_bfd,
-+						      contents + address,
-+						      rel);
-+
-+	      callbacks->reloc_dangerous (myinfo->linkinfo, name,
-+					  input_bfd,
-+					  input_section, address);
-+	    }
-+	}
-+    }
-+
-+  /* If the relocation is PC relative, we want to set RELOCATION to
-+     the distance between the symbol (currently in RELOCATION) and the
-+     location we are relocating.  Some targets (e.g., i386-aout)
-+     arrange for the contents of the section to be the negative of the
-+     offset of the location within the section; for such targets
-+     pcrel_offset is FALSE.  Other targets (e.g., m88kbcs or ELF)
-+     simply leave the contents of the section as zero; for such
-+     targets pcrel_offset is TRUE.  If pcrel_offset is FALSE we do not
-+     need to subtract out the offset of the location within the
-+     section (which is just ADDRESS).  */
-+  if (howto->pc_relative)
-+    {
-+      relocation -= (input_section->output_section->vma
-+		     + input_section->output_offset);
-+      if (howto->pcrel_offset)
-+	relocation -= address;
-+    }
-+
-+  retval = _bfd_relocate_contents (howto, input_bfd, relocation,
-+				   contents + address);
-+
-+  /* The symbol has to be relocated again iff the length of the relocation
-+     is 2 words and it is not pc relative.  */
-+  need_tpa_relocation = FALSE;
-+  if (!howto->pc_relative && bfd_get_reloc_size (howto) == 4)
-+    {
-+      if (r_extern)
-+	{
-+	  struct aout_link_hash_entry **sym_hashes = obj_aout_sym_hashes (input_bfd);
-+	  struct aout_link_hash_entry *h = sym_hashes[r_index];
-+	  asection *output_section = h->root.u.def.section->output_section;
-+
-+	  /* Do not relocate absolute symbols.  */
-+	  if (output_section == obj_textsec (output_bfd)
-+	      || output_section == obj_datasec (output_bfd)
-+	      || output_section == obj_bsssec (output_bfd))
-+	    {
-+	      need_tpa_relocation = TRUE;
-+	    }
-+	}
-+      else
-+	{
-+	  need_tpa_relocation = TRUE;
-+	}
-+    }
-+
-+  /* Here we add the TPA relocation entries for the address references
-+     located inside the input sections. Note that if some references
-+     to addresses are generated using data statements in the linker
-+     script, they will not be relocated here because they do not
-+     belong to any input section.  */
-+  if (need_tpa_relocation)
-+    {
-+      bfd_vma tpa_address = input_section->output_section->vma
-+	+ input_section->output_offset + address;
-+
-+      if (!bfd_m68kmint_add_tpa_relocation_entry(output_bfd, tpa_address))
-+	return bfd_reloc_other;
-+    }
-+
-+  return retval;
-+}
-+
-+/* Write out the TPA relocation table.  */
-+
-+static bfd_boolean
-+write_tparel (bfd *abfd, struct internal_exec *execp)
-+{
-+  struct mint_internal_info* myinfo = obj_aout_ext (abfd);
-+
-+  if (myinfo->symtab_size == 0)
-+    myinfo->tparel_pos = N_STROFF (*execp)
-+      + obj_aout_external_string_size (abfd);
-+  else
-+    myinfo->tparel_pos = N_SYMOFF (*execp)
-+      + myinfo->symtab_size;
-+
-+  if (bfd_seek (abfd, myinfo->tparel_pos, SEEK_SET) != 0)
-+    return FALSE;
-+
-+  if (bfd_bwrite (myinfo->tparel, myinfo->tparel_size, abfd)
-+      != myinfo->tparel_size)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Write the full exec header.
-+   This function must be called last to ensure that we have all the
-+   information needed to fill the MiNT-specific header fields.  */
-+
-+static bfd_boolean
-+write_exec_header (bfd *abfd, struct internal_exec *execp, struct external_exec *exec_bytes)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+
-+  if ((abfd->flags & EXEC_P) == 0)
-+    bfd_h_put_16 (abfd, 0xdead, exec_bytes->g_branch);
-+  else
-+    bfd_h_put_16 (abfd, 0x601a, exec_bytes->g_branch);
-+
-+  /* The OS will load our extension header fields into the text segment.  */
-+  PUT_WORD (abfd, execp->a_text + EXEC_BYTES_SIZE - 28,
-+	    exec_bytes->g_text);
-+  PUT_WORD (abfd, execp->a_data, exec_bytes->g_data);
-+  PUT_WORD (abfd, execp->a_bss, exec_bytes->g_bss);
-+
-+  /* The OS' notion of the size of the symbol table is another than
-+     the bfd library's.  We have to fill in the size of the table
-+     itself plus the size of the string table but only if we have not written
-+     a traditional symbol table.  If we have written a traditional symbol
-+     table we know the size.  */
-+  if (myinfo->symtab_size != 0)
-+    PUT_WORD (abfd, myinfo->symtab_size, exec_bytes->g_syms);
-+  else
-+    PUT_WORD (abfd, myinfo->tparel_pos - N_SYMOFF (*execp),
-+	      exec_bytes->g_syms);
-+  bfd_h_put_32 (abfd, 0x4d694e54, exec_bytes->g_extmagic);
-+  bfd_h_put_32 (abfd, myinfo->prg_flags, exec_bytes->g_flags);
-+  bfd_h_put_16 (abfd, 0, exec_bytes->g_abs);
-+
-+  /* Generate the jump instruction to the entry point.	In m68k
-+     assembler mnemnonics it looks more or less like this:
-+
-+       move.l  exec_bytes->e_entry(pc),d0
-+       jmp     -6(pc,d0.l)
-+
-+     Sorry for the wrong syntax.  As a real assembler addict I
-+     never actually use an assembler.  I edit my binaries manually
-+     with a hex editor, looks much cooler and it strengthens your
-+     abstraction abilities.  */
-+
-+  exec_bytes->g_jump_entry[0] = 0x20;
-+  exec_bytes->g_jump_entry[1] = 0x3a;
-+  exec_bytes->g_jump_entry[2] = 0x00;
-+  exec_bytes->g_jump_entry[3] = 0x1a;
-+  exec_bytes->g_jump_entry[4] = 0x4e;
-+  exec_bytes->g_jump_entry[5] = 0xfb;
-+  exec_bytes->g_jump_entry[6] = 0x08;
-+  exec_bytes->g_jump_entry[7] = 0xfa;
-+
-+  bfd_h_put_32 (abfd, myinfo->tparel_pos, exec_bytes->g_tparel_pos);
-+  bfd_h_put_32 (abfd, myinfo->tparel_size, exec_bytes->g_tparel_size);
-+
-+  PUT_WORD (abfd, myinfo->stkpos, exec_bytes->g_stkpos);
-+  PUT_WORD (abfd, myinfo->symbol_format, exec_bytes->g_symbol_format);
-+
-+  memset (&exec_bytes->g_pad0, 0, sizeof (exec_bytes->g_pad0));
-+
-+  /* The standard stuff.  */
-+  NAME(aout,swap_exec_header_out) (abfd, execp, exec_bytes);
-+  if (myinfo->symbol_format != _MINT_SYMBOL_FORMAT_GNU)
-+    PUT_WORD (abfd, 0, exec_bytes->e_syms);
-+
-+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
-+    return FALSE;
-+
-+  if (bfd_bwrite (exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
-+      != EXEC_BYTES_SIZE)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Write an object file.
-+   Section contents have already been written.  We write the
-+   file header, symbols, and relocation.  */
-+
-+#define MY_write_object_contents m68kmint_prg_write_object_contents
-+
-+static bfd_boolean
-+m68kmint_prg_write_object_contents (bfd *abfd)
-+{
-+  struct external_exec exec_bytes;
-+  struct internal_exec *execp = exec_hdr (abfd);
-+  bfd_size_type text_size;
-+  file_ptr text_end;
-+
-+  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-+
-+  /* Most of the following code come from the WRITE_HEADERS macro
-+     found in libaout.h.  */
-+
-+  if (adata(abfd).magic == undecided_magic)
-+    NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end);
-+
-+  execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE;
-+  execp->a_entry = bfd_get_start_address (abfd);
-+
-+  execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *
-+		     obj_reloc_entry_size (abfd));
-+  execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *
-+		     obj_reloc_entry_size (abfd));
-+
-+  /* Now write out reloc info, followed by syms and strings.  */
-+
-+  if (bfd_get_outsymbols (abfd) != NULL
-+      && bfd_get_symcount (abfd) != 0)
-+    {
-+      if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)
-+        return FALSE;
-+
-+      if (! NAME (aout, write_syms) (abfd))
-+        return FALSE;
-+    }
-+
-+  if (write_tparel (abfd, execp) != TRUE)
-+    return FALSE;
-+
-+  if (write_exec_header (abfd, execp, &exec_bytes) != TRUE)
-+    return FALSE;
-+
-+  if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0)
-+    return FALSE;
-+  if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd)))
-+    return FALSE;
-+
-+  if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0)
-+    return FALSE;
-+  if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+#include "aout-target.h"
-+
-+/* Set the executable flags.
-+   It is called by the linker emulation script.  */
-+
-+bfd_boolean
-+bfd_m68kmint_set_extended_flags (bfd *abfd, flagword prg_flags)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+
-+  BFD_ASSERT(abfd != NULL && abfd->xvec == &m68kmint_prg_vec);
-+
-+  if (myinfo == NULL)
-+    myinfo = bfd_zalloc (abfd, sizeof (struct mint_internal_info));
-+
-+  if (myinfo == NULL)
-+    {
-+      /* The internal function bfd_zalloc has already set the error
-+	 state to "out of memory".  */
-+      return FALSE;
-+    }
-+
-+  obj_aout_ext (abfd) = myinfo;
-+
-+  myinfo->prg_flags = prg_flags;
-+
-+  return TRUE;
-+}
-+
-+/* Add a TPA relocation entry.
-+   It is called by BFD when linking the input sections, and by the
-+   linker when it generates a reference to an address (in particular,
-+   when building the constructors list).  */
-+
-+bfd_boolean
-+bfd_m68kmint_add_tpa_relocation_entry (bfd *abfd, bfd_vma address)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  BFD_ASSERT(abfd != NULL && abfd->xvec == &m68kmint_prg_vec);
-+
-+  /* Ensure that myinfo is set up.  */
-+  myinfo = obj_aout_ext (abfd);
-+  if (myinfo == NULL)
-+    {
-+      myinfo = bfd_zalloc (abfd, sizeof (struct mint_internal_info));
-+      if (myinfo == NULL)
-+	return FALSE;
-+
-+      obj_aout_ext (abfd) = myinfo;
-+    }
-+
-+  /* Enlarge the buffer if necessary.  */
-+  if (myinfo->relocs_used * sizeof (bfd_vma) >= myinfo->relocs_allocated)
-+    {
-+      bfd_vma *newbuf;
-+      myinfo->relocs_allocated += MINT_RELOC_CHUNKSIZE;
-+      newbuf = bfd_realloc (myinfo->relocs, myinfo->relocs_allocated);
-+      if (newbuf == NULL)
-+	return FALSE;
-+
-+      myinfo->relocs = newbuf;
-+    }
-+
-+  /* The TPA relative relocation actually just adds the address of
-+     the text segment (i. e. beginning of the executable in memory)
-+     to the addresses at the specified locations.  This allows an
-+     executable to be loaded everywhere in the address space without
-+     memory management.  */
-+  myinfo->relocs[myinfo->relocs_used++] = address;
-+
-+  return TRUE;
-+}
-diff -aurN binutils-2.18/bfd/targets.c binutils-2.18-mint-20080228/bfd/targets.c
---- binutils-2.18/bfd/targets.c	2007-08-06 21:59:42.000000000 +0200
-+++ binutils-2.18-mint-20080228/bfd/targets.c	2008-02-28 09:47:00.062500000 +0100
-@@ -731,6 +731,7 @@
- extern const bfd_target m68kcoff_vec;
- extern const bfd_target m68kcoffun_vec;
- extern const bfd_target m68klinux_vec;
-+extern const bfd_target m68kmint_prg_vec;
- extern const bfd_target m68knetbsd_vec;
- extern const bfd_target m68ksysvcoff_vec;
- extern const bfd_target m88kbcs_vec;
-diff -aurN binutils-2.18/binutils/configure binutils-2.18-mint-20080228/binutils/configure
---- binutils-2.18/binutils/configure	2007-08-06 22:29:42.000000000 +0200
-+++ binutils-2.18-mint-20080228/binutils/configure	2008-02-28 09:47:00.312500000 +0100
-@@ -13459,7 +13459,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- cat >>confdefs.h <<\_ACEOF
- #define USE_BINARY_FOPEN 1
-diff -aurN binutils-2.18/binutils/dlltool.c binutils-2.18-mint-20080228/binutils/dlltool.c
---- binutils-2.18/binutils/dlltool.c	2007-08-06 21:55:10.000000000 +0200
-+++ binutils-2.18-mint-20080228/binutils/dlltool.c	2008-02-28 09:47:00.328125000 +0100
-@@ -3520,7 +3520,7 @@
-       if (*cp == '-')
- 	dash = cp;
-       if (
--#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__)
-+#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__) || defined(__MINT__)
- 	  *cp == ':' || *cp == '\\' ||
- #endif
- 	  *cp == '/')
-diff -aurN binutils-2.18/binutils/dllwrap.c binutils-2.18-mint-20080228/binutils/dllwrap.c
---- binutils-2.18/binutils/dllwrap.c	2007-08-06 21:55:10.000000000 +0200
-+++ binutils-2.18-mint-20080228/binutils/dllwrap.c	2008-02-28 09:47:00.328125000 +0100
-@@ -251,7 +251,7 @@
- 	dash = cp;
- 
-       if (
--#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__)
-+#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__) || defined(__MINT__)
- 	  *cp == ':' || *cp == '\\' ||
- #endif
- 	  *cp == '/')
-diff -aurN binutils-2.18/binutils/resrc.c binutils-2.18-mint-20080228/binutils/resrc.c
---- binutils-2.18/binutils/resrc.c	2007-08-06 21:56:14.000000000 +0200
-+++ binutils-2.18-mint-20080228/binutils/resrc.c	2008-02-28 09:47:00.328125000 +0100
-@@ -396,7 +396,7 @@
-     *space = 0;
- 
-   if (
--#if defined (__DJGPP__) || defined (__CYGWIN__) || defined (_WIN32)
-+#if defined (__DJGPP__) || defined (__CYGWIN__) || defined (_WIN32) || defined (__MINT__)
-       strchr (cmd, '\\') ||
- #endif
-       strchr (cmd, '/'))
-@@ -507,7 +507,7 @@
- 	  if (*cp == '-')
- 	    dash = cp;
- 	  if (
--#if defined (__DJGPP__) || defined (__CYGWIN__) || defined(_WIN32)
-+#if defined (__DJGPP__) || defined (__CYGWIN__) || defined(_WIN32) || defined (__MINT__)
- 	      *cp == ':' || *cp == '\\' ||
- #endif
- 	      *cp == '/')
-diff -aurN binutils-2.18/gas/config/tc-m68k.c binutils-2.18-mint-20080228/gas/config/tc-m68k.c
---- binutils-2.18/gas/config/tc-m68k.c	2007-08-06 22:00:00.000000000 +0200
-+++ binutils-2.18-mint-20080228/gas/config/tc-m68k.c	2008-02-28 09:47:00.781250000 +0100
-@@ -799,7 +799,7 @@
-   {"even", s_even, 0},
-   {"skip", s_space, 0},
-   {"proc", s_proc, 0},
--#if defined (TE_SUN3) || defined (OBJ_ELF)
-+#if defined (TE_SUN3) || defined (TE_MINT) || defined (OBJ_ELF)
-   {"align", s_align_bytes, 0},
- #endif
- #ifdef OBJ_ELF
-diff -aurN binutils-2.18/gas/config/te-mint.h binutils-2.18-mint-20080228/gas/config/te-mint.h
---- binutils-2.18/gas/config/te-mint.h	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.18-mint-20080228/gas/config/te-mint.h	2008-02-28 09:47:00.781250000 +0100
-@@ -0,0 +1,30 @@
-+/* Copyright 2008 Free Software Foundation, Inc.
-+
-+   This file is part of GAS, the GNU Assembler.
-+
-+   GAS is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as
-+   published by the Free Software Foundation; either version 3,
-+   or (at your option) any later version.
-+
-+   GAS is distributed in the hope that it will be useful, but
-+   WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-+   the GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with GAS; see the file COPYING.  If not, write to the Free
-+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
-+   02110-1301, USA.  */
-+
-+#define TE_MINT
-+
-+#define LOCAL_LABELS_DOLLAR 1
-+#define LOCAL_LABELS_FB 1
-+
-+/* These define interfaces.  */
-+#ifdef   OBJ_HEADER
-+#include OBJ_HEADER
-+#else
-+#include "obj-format.h"
-+#endif
-diff -aurN binutils-2.18/gas/configure.tgt binutils-2.18-mint-20080228/gas/configure.tgt
---- binutils-2.18/gas/configure.tgt	2007-08-28 19:19:36.000000000 +0200
-+++ binutils-2.18-mint-20080228/gas/configure.tgt	2008-02-28 09:47:00.796875000 +0100
-@@ -254,6 +254,7 @@
-   m68k-*-linux-*)			fmt=elf em=linux ;;
-   m68k-*-uclinux*)			fmt=elf ;;
-   m68k-*-gnu*)				fmt=elf ;;
-+  m68k-*-mint*)				fmt=aout em=mint bfd_gas=yes ;;
-   m68k-*-netbsdelf*)			fmt=elf em=nbsd ;;
-   m68k-*-netbsd*)			fmt=aout em=nbsd bfd_gas=yes ;;
-   m68k-*-openbsd*)			fmt=aout em=nbsd bfd_gas=yes ;;
-diff -aurN binutils-2.18/include/filenames.h binutils-2.18-mint-20080228/include/filenames.h
---- binutils-2.18/include/filenames.h	2007-03-29 23:03:43.000000000 +0200
-+++ binutils-2.18-mint-20080228/include/filenames.h	2008-02-28 09:47:00.796875000 +0100
-@@ -26,7 +26,7 @@
- #ifndef FILENAMES_H
- #define FILENAMES_H
- 
--#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
-+#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) || defined (__MINT__)
- 
- #ifndef HAVE_DOS_BASED_FILE_SYSTEM
- #define HAVE_DOS_BASED_FILE_SYSTEM 1
-diff -aurN binutils-2.18/include/getopt.h binutils-2.18-mint-20080228/include/getopt.h
---- binutils-2.18/include/getopt.h	2005-05-10 12:21:08.000000000 +0200
-+++ binutils-2.18-mint-20080228/include/getopt.h	2008-02-28 09:47:00.812500000 +0100
-@@ -106,7 +106,7 @@
-    to find the declaration so provide a fully prototyped one.  If it
-    is 1, we found it so don't provide any declaration at all.  */
- #if !HAVE_DECL_GETOPT
--#if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT)
-+#if defined (__GNU_LIBRARY__) || defined (__MINT__) || defined (HAVE_DECL_GETOPT)
- /* Many other libraries have conflicting prototypes for getopt, with
-    differences in the consts, in unistd.h.  To avoid compilation
-    errors, only prototype getopt for the GNU C library.  */
-diff -aurN binutils-2.18/ld/Makefile.am binutils-2.18-mint-20080228/ld/Makefile.am
---- binutils-2.18/ld/Makefile.am	2007-08-06 22:00:17.000000000 +0200
-+++ binutils-2.18-mint-20080228/ld/Makefile.am	2008-02-28 09:47:00.843750000 +0100
-@@ -266,6 +266,7 @@
- 	em68kelf.o \
- 	em68kelfnbsd.o \
- 	em68klinux.o \
-+	em68kmint.o \
- 	em68knbsd.o \
- 	em68kpsos.o \
- 	em88kbcs.o \
-@@ -1194,6 +1195,10 @@
- em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \
-   $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68klinux "$(tdir_m68klinux)"
-+em68kmint.c: $(srcdir)/emulparams/m68kmint.sh \
-+  $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/mint.em \
-+  $(srcdir)/scripttempl/m68kmint.sc ${GEN_DEPENDS}
-+	${GENSCRIPTS} m68kmint "$(tdir_m68kmint)"
- em68knbsd.c:	$(srcdir)/emulparams/m68knbsd.sh \
-   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)"
-diff -aurN binutils-2.18/ld/Makefile.in binutils-2.18-mint-20080228/ld/Makefile.in
---- binutils-2.18/ld/Makefile.in	2007-08-06 22:29:54.000000000 +0200
-+++ binutils-2.18-mint-20080228/ld/Makefile.in	2008-02-28 09:47:00.859375000 +0100
-@@ -513,6 +513,7 @@
- 	em68kelf.o \
- 	em68kelfnbsd.o \
- 	em68klinux.o \
-+	em68kmint.o \
- 	em68knbsd.o \
- 	em68kpsos.o \
- 	em88kbcs.o \
-@@ -2020,6 +2021,10 @@
- em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \
-   $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68klinux "$(tdir_m68klinux)"
-+em68kmint.c: $(srcdir)/emulparams/m68kmint.sh \
-+  $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/mint.em \
-+  $(srcdir)/scripttempl/m68kmint.sc ${GEN_DEPENDS}
-+	${GENSCRIPTS} m68kmint "$(tdir_m68kmint)"
- em68knbsd.c:	$(srcdir)/emulparams/m68knbsd.sh \
-   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)"
-diff -aurN binutils-2.18/ld/configure binutils-2.18-mint-20080228/ld/configure
---- binutils-2.18/ld/configure	2007-08-12 20:53:33.000000000 +0200
-+++ binutils-2.18-mint-20080228/ld/configure	2008-02-28 09:47:01.203125000 +0100
-@@ -11885,7 +11885,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- cat >>confdefs.h <<\_ACEOF
- #define USE_BINARY_FOPEN 1
-diff -aurN binutils-2.18/ld/configure.tgt binutils-2.18-mint-20080228/ld/configure.tgt
---- binutils-2.18/ld/configure.tgt	2007-08-28 19:19:42.000000000 +0200
-+++ binutils-2.18-mint-20080228/ld/configure.tgt	2008-02-28 09:47:01.203125000 +0100
-@@ -326,6 +326,7 @@
- 			tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` ;;
- m68k-*-uclinux*)	targ_emul=m68kelf ;;
- m68*-*-gnu*)		targ_emul=m68kelf ;;
-+m68*-*-mint*)		targ_emul=m68kmint ;;
- m68*-*-netbsd*4k*)	targ_emul=m68k4knbsd
- 			targ_extra_emuls="m68knbsd m68kelfnbsd" ;;
- m68*-*-netbsdelf*)	targ_emul=m68kelfnbsd
-diff -aurN binutils-2.18/ld/emulparams/m68kmint.sh binutils-2.18-mint-20080228/ld/emulparams/m68kmint.sh
---- binutils-2.18/ld/emulparams/m68kmint.sh	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.18-mint-20080228/ld/emulparams/m68kmint.sh	2008-02-28 09:47:01.218750000 +0100
-@@ -0,0 +1,5 @@
-+SCRIPT_NAME=m68kmint
-+OUTPUT_FORMAT="a.out-mintprg"
-+TEXT_START_ADDR=0xe4
-+ARCH=m68k
-+EXTRA_EM_FILE=mint
-diff -aurN binutils-2.18/ld/emultempl/generic.em binutils-2.18-mint-20080228/ld/emultempl/generic.em
---- binutils-2.18/ld/emultempl/generic.em	2007-08-06 22:00:22.000000000 +0200
-+++ binutils-2.18-mint-20080228/ld/emultempl/generic.em	2008-02-28 09:47:01.218750000 +0100
-@@ -138,8 +138,8 @@
-   ${LDEMUL_PLACE_ORPHAN-NULL},
-   ${LDEMUL_SET_SYMBOLS-NULL},
-   ${LDEMUL_PARSE_ARGS-NULL},
--  NULL,	/* add_options */
--  NULL,	/* handle_option */
-+  ${LDEMUL_ADD_OPTIONS-NULL},
-+  ${LDEMUL_HANDLE_OPTION-NULL},
-   ${LDEMUL_UNRECOGNIZED_FILE-NULL},
-   ${LDEMUL_LIST_OPTIONS-NULL},
-   ${LDEMUL_RECOGNIZED_FILE-NULL},
-diff -aurN binutils-2.18/ld/emultempl/mint.em binutils-2.18-mint-20080228/ld/emultempl/mint.em
---- binutils-2.18/ld/emultempl/mint.em	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.18-mint-20080228/ld/emultempl/mint.em	2008-02-28 09:47:01.234375000 +0100
-@@ -0,0 +1,294 @@
-+# This shell script emits a C file. -*- C -*-
-+#   Copyright 2006, 2007 Free Software Foundation, Inc.
-+#
-+# This file is part of the GNU Binutils.
-+#
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-+# MA 02110-1301, USA.
-+#
-+
-+# This file is sourced from generic.em
-+#
-+fragment <<EOF
-+
-+#include "ldgram.h"
-+
-+/* Standard GEMDOS program flags.  */
-+#define _MINT_F_FASTLOAD      0x01    /* Don't clear heap.  */
-+#define _MINT_F_ALTLOAD       0x02    /* OK to load in alternate RAM.  */
-+#define _MINT_F_ALTALLOC      0x04    /* OK to malloc from alt. RAM.  */
-+#define _MINT_F_BESTFIT       0x08    /* Load with optimal heap size.  */
-+/* The memory flags are mutually exclusive.  */
-+#define _MINT_F_MEMPROTECTION 0xf0    /* Masks out protection bits.  */
-+#define _MINT_F_MEMPRIVATE    0x00    /* Memory is private.  */
-+#define _MINT_F_MEMGLOBAL     0x10    /* Read/write access to mem allowed.  */
-+#define _MINT_F_MEMSUPER      0x20    /* Only supervisor access allowed.  */
-+#define _MINT_F_MEMREADABLE   0x30    /* Any read access OK.  */
-+#define _MINT_F_SHTEXT        0x800   /* Program's text may be shared */
-+
-+/* Option flags.  */
-+static flagword prg_flags = (_MINT_F_FASTLOAD | _MINT_F_ALTLOAD
-+			     | _MINT_F_ALTALLOC | _MINT_F_MEMPRIVATE);
-+
-+/* MiNT format extra command line options.  */
-+
-+/* Used for setting flags in the MiNT header.  */
-+#define OPTION_FASTLOAD (300)
-+#define OPTION_NO_FASTLOAD (OPTION_FASTLOAD + 1)
-+#define OPTION_FASTRAM (OPTION_NO_FASTLOAD + 1)
-+#define OPTION_NO_FASTRAM (OPTION_FASTRAM + 1)
-+#define OPTION_FASTALLOC (OPTION_NO_FASTRAM + 1)
-+#define OPTION_NO_FASTALLOC (OPTION_FASTALLOC + 1)
-+#define OPTION_BESTFIT (OPTION_NO_FASTALLOC + 1)
-+#define OPTION_NO_BESTFIT (OPTION_BESTFIT + 1)
-+#define OPTION_BASEREL (OPTION_NO_BESTFIT + 1)
-+#define OPTION_NO_BASEREL (OPTION_BASEREL + 1)
-+#define OPTION_MEM_PRIVATE (OPTION_NO_BASEREL + 1)
-+#define OPTION_MEM_GLOBAL (OPTION_MEM_PRIVATE + 1)
-+#define OPTION_MEM_SUPER (OPTION_MEM_GLOBAL + 1)
-+#define OPTION_MEM_READONLY (OPTION_MEM_SUPER + 1)
-+#define OPTION_PRG_FLAGS (OPTION_MEM_READONLY + 1)
-+
-+static void
-+gld${EMULATION_NAME}_add_options
-+  (int ns ATTRIBUTE_UNUSED, char **shortopts ATTRIBUTE_UNUSED, int nl,
-+    struct option **longopts, int nrl ATTRIBUTE_UNUSED,
-+    struct option **really_longopts ATTRIBUTE_UNUSED)
-+{
-+  static const struct option xtra_long[] = {
-+    {"mfastload", no_argument, NULL, OPTION_FASTLOAD},
-+    {"mno-fastload", no_argument, NULL, OPTION_NO_FASTLOAD},
-+    {"mfastram", no_argument, NULL, OPTION_FASTRAM},
-+    {"mno-fastram", no_argument, NULL, OPTION_NO_FASTRAM},
-+    {"maltram", no_argument, NULL, OPTION_FASTRAM},
-+    {"mno-altram", no_argument, NULL, OPTION_NO_FASTRAM},
-+    {"mfastalloc", no_argument, NULL, OPTION_FASTALLOC},
-+    {"mno-fastalloc", no_argument, NULL, OPTION_NO_FASTALLOC},
-+    {"maltalloc", no_argument, NULL, OPTION_FASTALLOC},
-+    {"mno-altalloc", no_argument, NULL, OPTION_NO_FASTALLOC},
-+    {"mbest-fit", no_argument, NULL, OPTION_BESTFIT},
-+    {"mno-best-fit", no_argument, NULL, OPTION_NO_BESTFIT},
-+    {"mbaserel", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-baserel", no_argument, NULL, OPTION_NO_BASEREL},
-+    {"mshared-text", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-shared-text", no_argument, NULL, OPTION_NO_BASEREL},
-+    {"msharable-text", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-sharable-text", no_argument, NULL, OPTION_NO_BASEREL},
-+    /* Memory protection bits.  */
-+    {"mprivate-memory", no_argument, NULL, OPTION_MEM_PRIVATE },
-+    {"mglobal-memory", no_argument, NULL, OPTION_MEM_GLOBAL},
-+    {"msuper-memory", no_argument, NULL, OPTION_MEM_SUPER},
-+    {"mreadable-memory", no_argument, NULL, OPTION_MEM_READONLY},
-+    {"mreadonly-memory", no_argument, NULL, OPTION_MEM_READONLY},
-+    {"mprg-flags", required_argument, NULL, OPTION_PRG_FLAGS},
-+    {NULL, no_argument, NULL, 0}
-+  };
-+
-+  *longopts = (struct option *)
-+    xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
-+  memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
-+}
-+
-+static bfd_boolean
-+gld${EMULATION_NAME}_handle_option (int optc)
-+{
-+  switch (optc)
-+    {
-+    default:
-+      return FALSE;
-+
-+    case OPTION_FASTLOAD:
-+      prg_flags |= _MINT_F_FASTLOAD;
-+      break;
-+
-+    case OPTION_NO_FASTLOAD:
-+      prg_flags &= ~_MINT_F_FASTLOAD;
-+      break;
-+
-+    case OPTION_FASTRAM:
-+      prg_flags |= _MINT_F_ALTLOAD;
-+      break;
-+
-+    case OPTION_NO_FASTRAM:
-+      prg_flags &= ~_MINT_F_ALTLOAD;
-+      break;
-+
-+    case OPTION_FASTALLOC:
-+      prg_flags |= _MINT_F_ALTALLOC;
-+      break;
-+
-+    case OPTION_NO_FASTALLOC:
-+      prg_flags &= ~_MINT_F_ALTALLOC;
-+      break;
-+
-+    case OPTION_BESTFIT:
-+      prg_flags |= _MINT_F_BESTFIT;
-+      break;
-+
-+    case OPTION_NO_BESTFIT:
-+      prg_flags &= ~_MINT_F_BESTFIT;
-+      break;
-+
-+    case OPTION_BASEREL:
-+      prg_flags |= _MINT_F_SHTEXT;
-+      break;
-+
-+    case OPTION_NO_BASEREL:
-+      prg_flags &= ~_MINT_F_SHTEXT;
-+      break;
-+
-+    case OPTION_MEM_PRIVATE:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      break;
-+
-+    case OPTION_MEM_GLOBAL:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMPRIVATE;
-+      break;
-+
-+    case OPTION_MEM_SUPER:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMSUPER;
-+      break;
-+
-+    case OPTION_MEM_READONLY:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMREADABLE;
-+      break;
-+
-+    case OPTION_PRG_FLAGS:
-+      {
-+	char* tail;
-+	unsigned long flag_value = strtoul (optarg, &tail, 0);
-+	if (*tail != '\0')
-+	  {
-+	    einfo (_("%P: warning: ignoring invalid program flags %s\n"), optarg);
-+	  }
-+	else
-+	  {
-+	    prg_flags = flag_value;
-+	  }
-+	  break;
-+      }
-+    }
-+  return TRUE;
-+}
-+
-+/* This callback is called when ld is invoked
-+   with the --help and --target-help options.  */
-+
-+static void
-+gld_${EMULATION_NAME}_list_options (FILE *file)
-+{
-+  fprintf (file, _("  --m[no-]fastload            Enable/Disable not cleaning the heap on startup\n"));
-+  fprintf (file, _("  --m[no-]altram, --m[no-]fastram\n"));
-+  fprintf (file, _("                              Enable/Disable loading into alternate RAM\n"));
-+  fprintf (file, _("  --m[no-]altalloc, --m[no-]fastalloc\n"));
-+  fprintf (file, _("                              Enable/Disable malloc from alternate RAM\n"));
-+  fprintf (file, _("  --m[no-]best-fit            Enable/Disable loading with optimal heap size\n"));
-+  fprintf (file, _("  --m[no-]sharable-text, --m[no-]shared-text, --m[no-]baserel\n"));
-+  fprintf (file, _("                              Enable/Disable sharing the text segment\n"));
-+  fprintf (file, "\n");
-+  fprintf (file, _("The following memory options are mutually exclusive:\n"));
-+  fprintf (file, _("  --mprivate-memory           Process memory is not accessible\n"));
-+  fprintf (file, _("  --mglobal-memory            Process memory is readable and writable\n"));
-+  fprintf (file, _("  --msuper-memory             Process memory is accessible in supervisor mode\n"));
-+  fprintf (file, _("  --mreadonly-memory, --mreadable-memory\n"));
-+  fprintf (file, _("                              Process memory is readable but not writable\n"));
-+  fprintf (file, "\n");
-+  fprintf (file, _("  --mprg-flags <value>        Set all the flags with an integer raw value\n"));
-+}
-+
-+/* This callback is called by lang_for_each_statement. It checks that the
-+   output sections speficied in the linker script are compatible with the MiNT
-+   executable format.  */
-+
-+static void
-+gld${EMULATION_NAME}_check_output_sections (lang_statement_union_type *s)
-+{
-+  if (s->header.type == lang_output_section_statement_enum)
-+    {
-+      lang_output_section_statement_type *oss = &s->output_section_statement;
-+
-+      ASSERT(oss->processed_vma);
-+
-+      if (strcmp(oss->bfd_section->name, ".text") == 0 && oss->bfd_section->vma != ${TEXT_START_ADDR})
-+	einfo ("%F%P: the VMA of section %A must be 0x%V, but actual value is 0x%V\n",
-+	  oss->bfd_section, ${TEXT_START_ADDR}, oss->bfd_section->vma);
-+      else if (strcmp(oss->bfd_section->name, ".data") == 0 && oss->addr_tree != NULL)
-+	einfo ("%F%P: the VMA of section %A must not be specified\n",
-+	  oss->bfd_section);
-+      else if (strcmp(oss->bfd_section->name, ".bss") == 0 && oss->addr_tree != NULL)
-+	einfo ("%F%P: the VMA of section %A must not be specified\n",
-+	  oss->bfd_section);
-+    }
-+}
-+
-+/* This callback is called by lang_for_each_statement. It looks for the data
-+   statements of type REL generated by the linker, and adds a TPA relocation
-+   entry for them. This is used by the CONSTRUCTORS list.  */
-+
-+static void
-+gld${EMULATION_NAME}_add_tpa_relocs (lang_statement_union_type *s)
-+{
-+  if (s->header.type == lang_data_statement_enum)
-+    {
-+      lang_data_statement_type *ds = &s->data_statement;
-+
-+      if (ds->exp->type.node_code == REL)
-+	{
-+	  if (ds->type == LONG)
-+	    {
-+	      bfd_vma tpa_address = ds->output_section->vma + ds->output_offset;
-+	      if (!bfd_m68kmint_add_tpa_relocation_entry(link_info.output_bfd, tpa_address))
-+		einfo (_("%F%P:%B: unable to add a relocation entry\n"), link_info.output_bfd);
-+	    }
-+	    else
-+	    {
-+	      einfo (_("%F%P:%B: invalid size for TPA relocation entry in section %A, offset 0x%V\n"),
-+		link_info.output_bfd, ds->output_section, ds->output_offset);
-+	    }
-+	}
-+    }
-+}
-+
-+/* Final emulation specific call.  */
-+
-+static void
-+gld${EMULATION_NAME}_finish (void)
-+{
-+  /* Do nothing if we are not generating a MiNT executable (ex: binary).  */
-+  if (strcmp (bfd_get_target (link_info.output_bfd), "${OUTPUT_FORMAT}") != 0)
-+    return;
-+
-+  /* Check the output sections.  */
-+  lang_for_each_statement (gld${EMULATION_NAME}_check_output_sections);
-+
-+  /* Set the MiNT executable header flags.  */
-+  if (!bfd_m68kmint_set_extended_flags (link_info.output_bfd, prg_flags))
-+    einfo (_("%F%P:%B: unable to set the header flags\n"), link_info.output_bfd);
-+
-+  /* Generate TPA relocation entries for the data statements.  */
-+  lang_for_each_statement (gld${EMULATION_NAME}_add_tpa_relocs);
-+}
-+
-+EOF
-+
-+# Put these extra routines in ld_${EMULATION_NAME}_emulation
-+#
-+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
-+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
-+LDEMUL_LIST_OPTIONS=gld_${EMULATION_NAME}_list_options
-+LDEMUL_FINISH=gld${EMULATION_NAME}_finish
-diff -aurN binutils-2.18/ld/scripttempl/m68kmint.sc binutils-2.18-mint-20080228/ld/scripttempl/m68kmint.sc
---- binutils-2.18/ld/scripttempl/m68kmint.sc	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.18-mint-20080228/ld/scripttempl/m68kmint.sc	2008-02-28 09:47:01.250000000 +0100
-@@ -0,0 +1,31 @@
-+cat <<EOF
-+OUTPUT_FORMAT("${OUTPUT_FORMAT}")
-+${RELOCATING+${LIB_SEARCH_DIRS}}
-+SECTIONS
-+{
-+  /* The VMA of the .text segment is ${TEXT_START_ADDR} instead of 0
-+     because the extended MiNT header is just before.  */
-+  .text ${TEXT_START_ADDR} :
-+  {
-+    CREATE_OBJECT_SYMBOLS
-+    *(.text)
-+    ${CONSTRUCTING+CONSTRUCTORS}
-+    ${RELOCATING+_etext = .;}
-+    ${RELOCATING+__etext = .;}
-+  }
-+  .data :
-+  {
-+    *(.data)
-+    ${RELOCATING+_edata = .;}
-+    ${RELOCATING+__edata = .;}
-+  }
-+  .bss :
-+  {
-+    ${RELOCATING+__bss_start = .;}
-+    *(.bss)
-+    *(COMMON)
-+    ${RELOCATING+_end = .;}
-+    ${RELOCATING+__end = .;}
-+  }
-+}
-+EOF
-diff -aurN binutils-2.18/libiberty/hex.c binutils-2.18-mint-20080228/libiberty/hex.c
---- binutils-2.18/libiberty/hex.c	2007-01-31 21:25:23.000000000 +0100
-+++ binutils-2.18-mint-20080228/libiberty/hex.c	2008-02-28 09:47:01.265625000 +0100
-@@ -24,7 +24,7 @@
- #include "libiberty.h"
- #include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
- 
--#if EOF != -1
-+#if !(EOF == -1)	/* gcc 2.95.3 has bug in '!=' operator for negative constants */
-  #error "hex.c requires EOF == -1"
- #endif
- 
-diff -aurN binutils-2.18/libiberty/safe-ctype.c binutils-2.18-mint-20080228/libiberty/safe-ctype.c
---- binutils-2.18/libiberty/safe-ctype.c	2005-05-10 17:33:33.000000000 +0200
-+++ binutils-2.18-mint-20080228/libiberty/safe-ctype.c	2008-02-28 09:47:01.281250000 +0100
-@@ -119,7 +119,7 @@
- #include <safe-ctype.h>
- #include <stdio.h>  /* for EOF */
- 
--#if EOF != -1
-+#if !(EOF == -1)	/* gcc 2.95.3 has bug in '!=' operator for negative constants */
-  #error "<safe-ctype.h> requires EOF == -1"
- #endif
- 

diff --git a/sys-devel/binutils/files/binutils-2.18.50.0.7-mint2.patch b/sys-devel/binutils/files/binutils-2.18.50.0.7-mint2.patch
deleted file mode 100644
index 0e83571515..0000000000
--- a/sys-devel/binutils/files/binutils-2.18.50.0.7-mint2.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-diff -aurN binutils-2.18.50.0.5/bfd/configure binutils-2.18.50.0.5.mint/bfd/configure
---- binutils-2.18.50.0.5/bfd/configure	Wed Apr  2 11:51:30 2008
-+++ binutils-2.18.50.0.5.mint/bfd/configure	Wed Apr  2 12:11:16 2008
-@@ -6925,7 +6925,7 @@
-       # Instead, we relocate shared libraries at runtime.
-       ;;
- 
--    msdosdjgpp*)
-+    msdosdjgpp* | mint*)
-       # Just because we use GCC doesn't mean we suddenly get shared libraries
-       # on systems that don't support them.
-       lt_prog_compiler_can_build_shared=no
-diff -aurN binutils-2.18.50.0.5/binutils/configure binutils-2.18.50.0.5.mint/binutils/configure
---- binutils-2.18.50.0.5/binutils/configure	Wed Apr  2 11:51:34 2008
-+++ binutils-2.18.50.0.5.mint/binutils/configure	Wed Apr  2 12:09:40 2008
-@@ -6755,7 +6755,7 @@
-       # Instead, we relocate shared libraries at runtime.
-       ;;
- 
--    msdosdjgpp*)
-+    msdosdjgpp* | mint*)
-       # Just because we use GCC doesn't mean we suddenly get shared libraries
-       # on systems that don't support them.
-       lt_prog_compiler_can_build_shared=no
-diff -aurN binutils-2.18.50.0.5/gas/configure binutils-2.18.50.0.5.mint/gas/configure
---- binutils-2.18.50.0.5/gas/configure	Fri Mar 14 19:23:02 2008
-+++ binutils-2.18.50.0.5.mint/gas/configure	Wed Apr  2 12:12:36 2008
-@@ -6753,7 +6753,7 @@
-       # Instead, we relocate shared libraries at runtime.
-       ;;
- 
--    msdosdjgpp*)
-+    msdosdjgpp* | mint*)
-       # Just because we use GCC doesn't mean we suddenly get shared libraries
-       # on systems that don't support them.
-       lt_prog_compiler_can_build_shared=no
-diff -aurN binutils-2.18.50.0.5/gprof/configure binutils-2.18.50.0.5.mint/gprof/configure
---- binutils-2.18.50.0.5/gprof/configure	Fri Mar 14 19:23:02 2008
-+++ binutils-2.18.50.0.5.mint/gprof/configure	Wed Apr  2 12:10:04 2008
-@@ -6833,7 +6833,7 @@
-       # Instead, we relocate shared libraries at runtime.
-       ;;
- 
--    msdosdjgpp*)
-+    msdosdjgpp* | mint*)
-       # Just because we use GCC doesn't mean we suddenly get shared libraries
-       # on systems that don't support them.
-       lt_prog_compiler_can_build_shared=no
-diff -aurN binutils-2.18.50.0.5/ld/configure binutils-2.18.50.0.5.mint/ld/configure
---- binutils-2.18.50.0.5/ld/configure	Wed Apr  2 11:51:44 2008
-+++ binutils-2.18.50.0.5.mint/ld/configure	Wed Apr  2 12:16:22 2008
-@@ -6987,7 +6987,7 @@
-       # Instead, we relocate shared libraries at runtime.
-       ;;
- 
--    msdosdjgpp*)
-+    msdosdjgpp* | mint*)
-       # Just because we use GCC doesn't mean we suddenly get shared libraries
-       # on systems that don't support them.
-       lt_prog_compiler_can_build_shared=no
-diff -aurN binutils-2.18.50.0.5/libiberty/configure binutils-2.18.50.0.5.mint/libiberty/configure
---- binutils-2.18.50.0.5/libiberty/configure	Wed Aug  1 14:11:52 2007
-+++ binutils-2.18.50.0.5.mint/libiberty/configure	Wed Apr  2 12:08:36 2008
-@@ -3715,6 +3715,7 @@
-   frag=
-   case "${host}" in
-     *-*-cygwin*)	;;
-+    *-*-mint*)		;;
-     alpha*-*-linux*)	PICFLAG=-fPIC ;;
-     arm*-*-*)		PICFLAG=-fPIC ;;
-     hppa*-*-*)		PICFLAG=-fPIC ;;
-diff -aurN binutils-2.18.50.0.5/libiberty/configure.ac binutils-2.18.50.0.5.mint/libiberty/configure.ac
---- binutils-2.18.50.0.5/libiberty/configure.ac	Wed Aug  1 14:11:52 2007
-+++ binutils-2.18.50.0.5.mint/libiberty/configure.ac	Wed Apr  2 12:08:12 2008
-@@ -203,6 +203,7 @@
-   frag=
-   case "${host}" in
-     *-*-cygwin*)	;;
-+    *-*-mint*)		;;
-     alpha*-*-linux*)	PICFLAG=-fPIC ;;
-     arm*-*-*)		PICFLAG=-fPIC ;;
-     hppa*-*-*)		PICFLAG=-fPIC ;;
-diff -aurN binutils-2.18.50.0.5/opcodes/configure binutils-2.18.50.0.5.mint/opcodes/configure
---- binutils-2.18.50.0.5/opcodes/configure	Fri Mar 14 19:23:02 2008
-+++ binutils-2.18.50.0.5.mint/opcodes/configure	Wed Apr  2 12:15:24 2008
-@@ -6921,7 +6921,7 @@
-       # Instead, we relocate shared libraries at runtime.
-       ;;
- 
--    msdosdjgpp*)
-+    msdosdjgpp* | mint*)
-       # Just because we use GCC doesn't mean we suddenly get shared libraries
-       # on systems that don't support them.
-       lt_prog_compiler_can_build_shared=no

diff --git a/sys-devel/binutils/files/binutils-2.18.50.0.9-reloc.patch b/sys-devel/binutils/files/binutils-2.18.50.0.9-reloc.patch
deleted file mode 100644
index f839798c85..0000000000
--- a/sys-devel/binutils/files/binutils-2.18.50.0.9-reloc.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/write.c.diff?cvsroot=src&r1=1.118&r2=1.119
-
-===================================================================
-RCS file: /cvs/src/src/gas/write.c,v
-retrieving revision 1.118
-retrieving revision 1.119
-diff -u -r1.118 -r1.119
---- src/gas/write.c	2008/08/20 13:43:32	1.118
-+++ src/gas/write.c	2008/09/15 13:53:17	1.119
-@@ -1090,8 +1090,8 @@
-       && (sym = *reloc->sym_ptr_ptr) != NULL
-       && (sym->flags & BSF_KEEP) == 0
-       && ((sym->flags & BSF_SECTION_SYM) == 0
--	  || !EMIT_SECTION_SYMBOLS
--	  || !bfd_is_abs_section (sym->section)))
-+	  || (EMIT_SECTION_SYMBOLS
-+	      && !bfd_is_abs_section (sym->section))))
-     as_bad_where (file, line, _("redefined symbol cannot be used on reloc"));
- 
-   s = bfd_install_relocation (stdoutput, reloc,

diff --git a/sys-devel/binutils/files/binutils-2.18.50.0.9-solaris-eh-frame.patch b/sys-devel/binutils/files/binutils-2.18.50.0.9-solaris-eh-frame.patch
deleted file mode 100644
index ad7a74af19..0000000000
--- a/sys-devel/binutils/files/binutils-2.18.50.0.9-solaris-eh-frame.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From binutils-return-56479-listarch-binutils=sources dot redhat dot com at sourceware dot org Thu Sep 25 17:25:25 2008
-Return-Path: <binutils-return-56479-listarch-binutils=sources dot redhat dot com at sourceware dot org>
-Delivered-To: listarch-binutils at sources dot redhat dot com
-Received: (qmail 10710 invoked by alias); 25 Sep 2008 17:25:25 -0000
-Received: (qmail 10674 invoked by uid 22791); 25 Sep 2008 17:25:24 -0000
-X-Spam-Check-By: sourceware.org
-Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210)     by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 25 Sep 2008 17:24:27 +0000
-Received: from localhost (localhost [127.0.0.1]) 	by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 0FCD4290020; 	Thu, 25 Sep 2008 19:24:24 +0200 (CEST)
-Received: from mel.act-europe.fr ([127.0.0.1]) 	by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) 	with ESMTP id z8OGQ06LgFhb; Thu, 25 Sep 2008 19:24:21 +0200 (CEST)
-Received: from [192.168.1.3] (88-122-74-61.rev.libertysurf.net [88.122.74.61]) 	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) 	(No client certificate requested) 	by mel.act-europe.fr (Postfix) with ESMTP id 33DFA290011 	for <binutils@sourceware.org>; Thu, 25 Sep 2008 19:24:21 +0200 (CEST)
-From: Eric Botcazou <ebotcazou at adacore dot com>
-To: binutils at sourceware dot org
-Subject: [PATCH] Fix EH frame problem on Solaris
-Date: Thu, 25 Sep 2008 19:25:16 +0200
-User-Agent: KMail/1.9.6 (enterprise 20070904.708012)
-MIME-Version: 1.0
-Content-Type: Multipart/Mixed;   boundary="Boundary-00=_8l82Iz/Ftp2txSB"
-Message-Id: <200809251925.16322.ebotcazou@adacore.com>
-Mailing-List: contact binutils-help at sourceware dot org; run by ezmlm
-Precedence: bulk
-List-Id: <binutils.sourceware.org>
-List-Subscribe: <mailto:binutils-subscribe at sourceware dot org>
-List-Archive: <http://sourceware.org/ml/binutils/>
-List-Post: <mailto:binutils at sourceware dot org>
-List-Help: <mailto:binutils-help at sourceware dot org>, <http://sourceware dot org/ml/#faqs>
-Sender: binutils-owner at sourceware dot org
-Delivered-To: mailing list binutils at sourceware dot org
-
-
---Boundary-00=_8l82Iz/Ftp2txSB
-Content-Type: text/plain;
-  charset="us-ascii"
-Content-Transfer-Encoding: 7bit
-Content-Disposition: inline
-
-Hi,
-
-EH is broken with GCC mainline on Solaris (both SPARC and x86) if you use the 
-combination GCC + GAS + Sun ld: FDEs from libgcc_eh.a are not found in the 
-final executable by the unwinder; therefore it immediately aborts.
-
-The problem is that the Sun linker doesn't merge read-only and read-write 
-sections into a single read-write section.  This was working fine when GCC 
-was emitting the EH frame itself because GCC features a configure check, 
-namely HAVE_LD_RO_RW_SECTION_MIXING, that forces the section to be writable
-if it fails.  Now GAS is emitting the EH frame, sometimes read-only and 
-sometimes read-write depending on the relocations, and this breaks.
-
-Fixed by defining DWARF2_EH_FRAME_READ_ONLY to 0 on Solaris, tested both on 
-SPARC and x86.  OK for mainline and 2.19 branch?
-
-
-2008-09-25  Eric Botcazou  <ebotcazou@adacore.com>
-
-gas/
-	* Makefile.am (TARG_ENV_HFILES): Add config/te-solaris.h.
-	* Makefile.in (TARG_ENV_HFILES): Likewise.
-	* configure.tgt (Solaris targets): Set em=solaris.
-	* config/te-solaris.h: New file.
-
-
--- 
-Eric Botcazou
-
---Boundary-00=_8l82Iz/Ftp2txSB
-Content-Type: text/x-diff;
-  charset="us-ascii";
-  name="p.diff"
-Content-Transfer-Encoding: 7bit
-Content-Disposition: attachment;
-	filename="p.diff"
-
-? config/te-solaris.h
-Index: Makefile.am
-===================================================================
-RCS file: /cvs/src/src/gas/Makefile.am,v
-retrieving revision 1.159.2.1
-diff -u -r1.159.2.1 Makefile.am
---- Makefile.am	9 Sep 2008 08:02:18 -0000	1.159.2.1
-+++ Makefile.am	25 Sep 2008 14:48:03 -0000
-@@ -406,6 +406,7 @@
- 	config/te-pe.h \
- 	config/te-psos.h \
- 	config/te-riscix.h \
-+	config/te-solaris.h \
- 	config/te-sparcaout.h \
- 	config/te-sun3.h \
- 	config/te-svr4.h \
-Index: Makefile.in
-===================================================================
-RCS file: /cvs/src/src/gas/Makefile.in,v
-retrieving revision 1.177.2.1
-diff -u -r1.177.2.1 Makefile.in
---- Makefile.in	9 Sep 2008 08:02:18 -0000	1.177.2.1
-+++ Makefile.in	25 Sep 2008 14:48:03 -0000
-@@ -653,6 +653,7 @@
- 	config/te-pe.h \
- 	config/te-psos.h \
- 	config/te-riscix.h \
-+	config/te-solaris.h \
- 	config/te-sparcaout.h \
- 	config/te-sun3.h \
- 	config/te-svr4.h \
-Index: configure.tgt
-===================================================================
-RCS file: /cvs/src/src/gas/configure.tgt,v
-retrieving revision 1.41
-diff -u -r1.41 configure.tgt
---- configure.tgt	7 Jul 2008 16:43:06 -0000	1.41
-+++ configure.tgt	25 Sep 2008 14:48:03 -0000
-@@ -198,7 +198,7 @@
-   i386-*-linux-*)			fmt=elf em=linux ;;
-   i386-*-lynxos*)			fmt=elf em=lynx ;;
-   i386-*-sysv[45]*)			fmt=elf ;;
--  i386-*-solaris*)			fmt=elf ;;
-+  i386-*-solaris*)			fmt=elf em=solaris ;;
-   i386-*-freebsdaout*)			fmt=aout em=386bsd ;;
-   i386-*-freebsd[12].*)			fmt=aout em=386bsd ;;
-   i386-*-freebsd[12])			fmt=aout em=386bsd ;;
-@@ -322,7 +322,7 @@
-   ppc-*-*n*bsd* | ppc-*-elf*)		fmt=elf ;;
-   ppc-*-eabi* | ppc-*-sysv4*)		fmt=elf ;;
-   ppc-*-linux-*)			fmt=elf em=linux ;;
--  ppc-*-solaris*)			fmt=elf ;;
-+  ppc-*-solaris*)			fmt=elf em=solaris ;;
-   ppc-*-rtems*)				fmt=elf ;;
-   ppc-*-macos*)				fmt=coff em=macos ;;
-   ppc-*-nto*)				fmt=elf ;;
-@@ -362,7 +362,7 @@
-   sparc-fujitsu-none)			fmt=aout ;;
-   sparc-*-elf)				fmt=elf ;;
-   sparc-*-sysv4*)			fmt=elf ;;
--  sparc-*-solaris*)			fmt=elf ;;
-+  sparc-*-solaris*)			fmt=elf em=solaris ;;
-   sparc-*-netbsdelf*)			fmt=elf em=nbsd ;;
-   sparc-*-netbsd*)
-     case ${cpu} in
-@@ -408,7 +408,8 @@
-   *-*-generic)				fmt=generic ;;
-   *-*-xray | *-*-hms)			fmt=coff ;;
-   *-*-sim)				fmt=coff ;;
--  *-*-elf | *-*-sysv4* | *-*-solaris*)	fmt=elf ;;
-+  *-*-elf | *-*-sysv4*)			fmt=elf ;;
-+  *-*-solaris*)				fmt=elf em=solaris ;;
-   *-*-aros*)				fmt=elf em=linux ;;
-   *-*-vxworks* | *-*-windiss)		fmt=elf em=vxworks ;;
-   *-*-netware)				fmt=elf em=netware ;;
---- /dev/null	2007-09-21 21:12:45.000000000 +0200
-+++ config/te-solaris.h	2008-09-25 12:18:57.000000000 +0200
-@@ -0,0 +1,30 @@
-+/* Copyright 2008 Free Software Foundation, Inc.
-+
-+   This file is part of GAS, the GNU Assembler.
-+
-+   GAS is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as
-+   published by the Free Software Foundation; either version 3,
-+   or (at your option) any later version.
-+
-+   GAS is distributed in the hope that it will be useful, but
-+   WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-+   the GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with GAS; see the file COPYING.  If not, write to the Free
-+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
-+   02110-1301, USA.  */
-+
-+#define TE_SOLARIS
-+
-+#define LOCAL_LABELS_DOLLAR 1
-+#define LOCAL_LABELS_FB 1
-+
-+/* The Sun linker doesn't merge read-only and read-write sections into
-+   a single read-write section so we must force all EH frame sections
-+   to be read-write.  */
-+#define DWARF2_EH_FRAME_READ_ONLY 0
-+
-+#include "obj-format.h"
-
---Boundary-00=_8l82Iz/Ftp2txSB--
-

diff --git a/sys-devel/binutils/files/binutils-2.19.1-hppa-hpux.patch b/sys-devel/binutils/files/binutils-2.19.1-hppa-hpux.patch
deleted file mode 100644
index 8b67f27e48..0000000000
--- a/sys-devel/binutils/files/binutils-2.19.1-hppa-hpux.patch
+++ /dev/null
@@ -1,444 +0,0 @@
---- ./bfd/configure.orig	2009-06-10 15:13:14.000000000 +0200
-+++ ./bfd/configure	2009-06-10 15:14:58.000000000 +0200
-@@ -8373,20 +8373,20 @@
- 
-     hpux10*)
-       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
--	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-       else
--	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-+	archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
-+	hardcode_libdir_flag_spec_ld='+b $libdir'
-       fi
-       if test "$with_gnu_ld" = no; then
- 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
--	hardcode_libdir_flag_spec_ld='+b $libdir'
- 	hardcode_libdir_separator=:
- 	hardcode_direct=yes
- 	hardcode_direct_absolute=yes
- 	export_dynamic_flag_spec='${wl}-E'
- 	# hardcode_minus_L: Not really in the search PATH,
- 	# but as the default location of the library.
--	hardcode_minus_L=yes
-+	hardcode_minus_L=no
-       fi
-       ;;
- 
-@@ -8400,7 +8400,7 @@
- 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       else
-@@ -8412,7 +8412,7 @@
- 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       fi
-@@ -8423,7 +8423,6 @@
- 	case $host_cpu in
- 	hppa*64*|ia64*)
- 	  hardcode_direct=no
--	  hardcode_shlibpath_var=no
- 	  ;;
- 	*)
- 	  hardcode_direct=yes
-@@ -8432,7 +8431,7 @@
- 
- 	  # hardcode_minus_L: Not really in the search PATH,
- 	  # but as the default location of the library.
--	  hardcode_minus_L=yes
-+	  hardcode_minus_L=no
- 	  ;;
- 	esac
-       fi
-@@ -9307,6 +9306,9 @@
-     ;;
-   *)
-     shrext_cmds='.sl'
-+    case $host_os in hpux9*) ;;
-+    *) hardcode_into_libs=yes ;;
-+    esac
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=SHLIB_PATH
-     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
---- ./gas/configure.orig	2009-06-10 11:10:54.000000000 +0200
-+++ ./gas/configure	2009-06-10 11:38:05.000000000 +0200
-@@ -8202,20 +8202,20 @@
- 
-     hpux10*)
-       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
--	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-       else
--	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-+	archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
-+	hardcode_libdir_flag_spec_ld='+b $libdir'
-       fi
-       if test "$with_gnu_ld" = no; then
- 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
--	hardcode_libdir_flag_spec_ld='+b $libdir'
- 	hardcode_libdir_separator=:
- 	hardcode_direct=yes
- 	hardcode_direct_absolute=yes
- 	export_dynamic_flag_spec='${wl}-E'
- 	# hardcode_minus_L: Not really in the search PATH,
- 	# but as the default location of the library.
--	hardcode_minus_L=yes
-+	hardcode_minus_L=no
-       fi
-       ;;
- 
-@@ -8229,7 +8229,7 @@
- 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       else
-@@ -8241,7 +8241,7 @@
- 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       fi
-@@ -8252,7 +8252,6 @@
- 	case $host_cpu in
- 	hppa*64*|ia64*)
- 	  hardcode_direct=no
--	  hardcode_shlibpath_var=no
- 	  ;;
- 	*)
- 	  hardcode_direct=yes
-@@ -8261,7 +8260,7 @@
- 
- 	  # hardcode_minus_L: Not really in the search PATH,
- 	  # but as the default location of the library.
--	  hardcode_minus_L=yes
-+	  hardcode_minus_L=no
- 	  ;;
- 	esac
-       fi
-@@ -9136,6 +9135,9 @@
-     ;;
-   *)
-     shrext_cmds='.sl'
-+    case $host_os in hpux9*) ;;
-+    *) hardcode_into_libs=yes ;;
-+    esac
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=SHLIB_PATH
-     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
---- ./opcodes/configure.orig	2009-06-10 11:10:54.000000000 +0200
-+++ ./opcodes/configure	2009-06-10 11:39:06.000000000 +0200
-@@ -8369,12 +8369,12 @@
- 
-     hpux10*)
-       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
--	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-       else
--	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-+	archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
-+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-       fi
-       if test "$with_gnu_ld" = no; then
--	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- 	hardcode_libdir_flag_spec_ld='+b $libdir'
- 	hardcode_libdir_separator=:
- 	hardcode_direct=yes
-@@ -8382,7 +8382,7 @@
- 	export_dynamic_flag_spec='${wl}-E'
- 	# hardcode_minus_L: Not really in the search PATH,
- 	# but as the default location of the library.
--	hardcode_minus_L=yes
-+	hardcode_minus_L=no
-       fi
-       ;;
- 
-@@ -8396,7 +8396,7 @@
- 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       else
-@@ -8408,7 +8408,7 @@
- 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       fi
-@@ -8419,7 +8419,6 @@
- 	case $host_cpu in
- 	hppa*64*|ia64*)
- 	  hardcode_direct=no
--	  hardcode_shlibpath_var=no
- 	  ;;
- 	*)
- 	  hardcode_direct=yes
-@@ -8428,7 +8427,7 @@
- 
- 	  # hardcode_minus_L: Not really in the search PATH,
- 	  # but as the default location of the library.
--	  hardcode_minus_L=yes
-+	  hardcode_minus_L=no
- 	  ;;
- 	esac
-       fi
-@@ -9303,6 +9302,9 @@
-     ;;
-   *)
-     shrext_cmds='.sl'
-+    case $host_os in hpux9*) ;;
-+    *) hardcode_into_libs=yes ;;
-+    esac
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=SHLIB_PATH
-     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
---- ./ld/configure.orig	2009-06-10 11:10:54.000000000 +0200
-+++ ./ld/configure	2009-06-10 11:40:23.000000000 +0200
-@@ -8493,20 +8493,20 @@
- 
-     hpux10*)
-       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
--	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-       else
--	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-+	archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
-+	hardcode_libdir_flag_spec_ld='+b $libdir'
-       fi
-       if test "$with_gnu_ld" = no; then
- 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
--	hardcode_libdir_flag_spec_ld='+b $libdir'
- 	hardcode_libdir_separator=:
- 	hardcode_direct=yes
- 	hardcode_direct_absolute=yes
- 	export_dynamic_flag_spec='${wl}-E'
- 	# hardcode_minus_L: Not really in the search PATH,
- 	# but as the default location of the library.
--	hardcode_minus_L=yes
-+	hardcode_minus_L=no
-       fi
-       ;;
- 
-@@ -8520,7 +8520,7 @@
- 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       else
-@@ -8532,7 +8532,7 @@
- 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       fi
-@@ -8552,7 +8552,7 @@
- 
- 	  # hardcode_minus_L: Not really in the search PATH,
- 	  # but as the default location of the library.
--	  hardcode_minus_L=yes
-+	  hardcode_minus_L=no
- 	  ;;
- 	esac
-       fi
-@@ -9427,6 +9427,9 @@
-     ;;
-   *)
-     shrext_cmds='.sl'
-+    case $host_os in hpux9*) ;;
-+    *) hardcode_into_libs=yes ;;
-+    esac
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=SHLIB_PATH
-     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
---- ./gprof/configure.orig	2009-06-10 11:10:54.000000000 +0200
-+++ ./gprof/configure	2009-06-10 11:41:47.000000000 +0200
-@@ -8293,20 +8293,20 @@
- 
-     hpux10*)
-       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
--	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-       else
--	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-+	archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
-+	hardcode_libdir_flag_spec_ld='+b $libdir'
-       fi
-       if test "$with_gnu_ld" = no; then
- 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
--	hardcode_libdir_flag_spec_ld='+b $libdir'
- 	hardcode_libdir_separator=:
- 	hardcode_direct=yes
- 	hardcode_direct_absolute=yes
- 	export_dynamic_flag_spec='${wl}-E'
- 	# hardcode_minus_L: Not really in the search PATH,
- 	# but as the default location of the library.
--	hardcode_minus_L=yes
-+	hardcode_minus_L=no
-       fi
-       ;;
- 
-@@ -8320,7 +8320,7 @@
- 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       else
-@@ -8332,7 +8332,7 @@
- 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       fi
-@@ -8343,7 +8343,6 @@
- 	case $host_cpu in
- 	hppa*64*|ia64*)
- 	  hardcode_direct=no
--	  hardcode_shlibpath_var=no
- 	  ;;
- 	*)
- 	  hardcode_direct=yes
-@@ -8352,7 +8351,7 @@
- 
- 	  # hardcode_minus_L: Not really in the search PATH,
- 	  # but as the default location of the library.
--	  hardcode_minus_L=yes
-+	  hardcode_minus_L=no
- 	  ;;
- 	esac
-       fi
-@@ -9227,6 +9226,9 @@
-     ;;
-   *)
-     shrext_cmds='.sl'
-+    case $host_os in hpux9*) ;;
-+    *) hardcode_into_libs=yes ;;
-+    esac
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=SHLIB_PATH
-     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
---- ./binutils/configure.orig	2009-06-10 11:10:54.000000000 +0200
-+++ ./binutils/configure	2009-06-10 11:25:22.000000000 +0200
-@@ -8204,20 +8204,20 @@
- 
-     hpux10*)
-       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
--	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-       else
--	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-+	archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
-+	hardcode_libdir_flag_spec_ld='+b $libdir'
-       fi
-       if test "$with_gnu_ld" = no; then
- 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
--	hardcode_libdir_flag_spec_ld='+b $libdir'
- 	hardcode_libdir_separator=:
- 	hardcode_direct=yes
- 	hardcode_direct_absolute=yes
- 	export_dynamic_flag_spec='${wl}-E'
- 	# hardcode_minus_L: Not really in the search PATH,
- 	# but as the default location of the library.
--	hardcode_minus_L=yes
-+	hardcode_minus_L=no
-       fi
-       ;;
- 
-@@ -8231,7 +8231,7 @@
- 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       else
-@@ -8243,7 +8243,7 @@
- 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	*)
--	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- 	  ;;
- 	esac
-       fi
-@@ -8254,7 +8254,6 @@
- 	case $host_cpu in
- 	hppa*64*|ia64*)
- 	  hardcode_direct=no
--	  hardcode_shlibpath_var=no
- 	  ;;
- 	*)
- 	  hardcode_direct=yes
-@@ -8263,7 +8262,7 @@
- 
- 	  # hardcode_minus_L: Not really in the search PATH,
- 	  # but as the default location of the library.
--	  hardcode_minus_L=yes
-+	  hardcode_minus_L=no
- 	  ;;
- 	esac
-       fi
-@@ -9138,6 +9137,9 @@
-     ;;
-   *)
-     shrext_cmds='.sl'
-+    case $host_os in hpux9*) ;;
-+    *) hardcode_into_libs=yes ;;
-+    esac
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=SHLIB_PATH
-     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
---- ./config.rpath.orig	2009-06-10 12:16:47.000000000 +0200
-+++ ./config.rpath	2009-06-10 12:17:36.000000000 +0200
-@@ -320,7 +320,7 @@
-             hardcode_direct=no
-             # hardcode_minus_L: Not really in the search PATH,
-             # but as the default location of the library.
--            hardcode_minus_L=yes
-+            hardcode_minus_L=no
-             ;;
-           *)
-             hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-@@ -328,7 +328,7 @@
-             hardcode_direct=yes
-             # hardcode_minus_L: Not really in the search PATH,
-             # but as the default location of the library.
--            hardcode_minus_L=yes
-+            hardcode_minus_L=no
-             ;;
-         esac
-       fi

diff --git a/sys-devel/binutils/files/binutils-2.19.1-hpux.patch b/sys-devel/binutils/files/binutils-2.19.1-hpux.patch
deleted file mode 100644
index 89e50dff37..0000000000
--- a/sys-devel/binutils/files/binutils-2.19.1-hpux.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-http://sourceware.org/ml/binutils/2008-11/msg00310.html
---- bfd/hpux-core.c.orig	2009-06-09 17:00:47.000000000 +0200
-+++ bfd/hpux-core.c	2009-06-09 17:00:56.000000000 +0200
-@@ -66,7 +66,6 @@
- #ifdef HPUX_CORE
- #include <machine/reg.h>
- #endif
--#include <sys/user.h>		/* After a.out.h  */
- #include <sys/file.h>
- 
- /* Kludge: There's no explicit mechanism provided by sys/core.h to
---- opcodes/configure.orig	2009-06-10 15:55:06.000000000 +0200
-+++ opcodes/configure	2009-06-10 15:55:31.000000000 +0200
-@@ -11757,7 +11757,7 @@
-     *)
-       case "$host_vendor" in
-         hp)
--          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl"
-+          SHARED_LIBADD="../bfd/libbfd.la"
- 	  ;;
- 	*)
-           SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so"

diff --git a/sys-devel/binutils/files/binutils-2.19.1-parallel.patch b/sys-devel/binutils/files/binutils-2.19.1-parallel.patch
deleted file mode 100644
index f529f9d820..0000000000
--- a/sys-devel/binutils/files/binutils-2.19.1-parallel.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-chew is built multiple times in parallel, which may result in:
-   mv chew.1234 chew: text file busy
---- bfd/doc/Makefile.in.orig	2009-06-09 17:01:42.000000000 +0200
-+++ bfd/doc/Makefile.in	2009-06-09 17:01:51.000000000 +0200
-@@ -12,6 +12,7 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
- 
-+.NOTPARALLEL:
- @SET_MAKE@
- srcdir = @srcdir@
- top_srcdir = @top_srcdir@

diff --git a/sys-devel/binutils/files/binutils-2.20.51.0.1-linux-x86-on-amd64.patch b/sys-devel/binutils/files/binutils-2.20.51.0.1-linux-x86-on-amd64.patch
deleted file mode 100644
index 4a2097b8fb..0000000000
--- a/sys-devel/binutils/files/binutils-2.20.51.0.1-linux-x86-on-amd64.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-allow building plain x86-linux-ld for x86_64-linux host
-with 32bit in /lib32 and 64bit in /lib.
---- ld/emulparams/elf_i386.sh.orig	2009-09-17 15:22:55.485863095 +0200
-+++ ld/emulparams/elf_i386.sh	2009-09-17 15:23:57.944566323 +0200
-@@ -17,7 +17,7 @@
- # In Gentoo, we install 32bit libs into /lib32 in an
- # ABI setup with amd64/x86
- case "$target" in
--  x86_64*-linux*)
-+  x86_64*-linux*|i[34567]86*-linux*)
-     case "$EMULATION_NAME" in
-       *i386*) LIBPATH_SUFFIX=32  ;;
-     esac

diff --git a/sys-devel/binutils/files/binutils-2.21.51.0.6-mint.patch b/sys-devel/binutils/files/binutils-2.21.51.0.6-mint.patch
deleted file mode 100644
index 515243fda6..0000000000
--- a/sys-devel/binutils/files/binutils-2.21.51.0.6-mint.patch
+++ /dev/null
@@ -1,2775 +0,0 @@
-http://bugs.gentoo.org/show_bug.cgi?id=353410
-
-diff -aurN binutils-2.21/bfd/Makefile.am binutils-2.21-mint-20110206/bfd/Makefile.am
---- binutils-2.21/bfd/Makefile.am	2010-12-08 09:37:33.000000000 +0100
-+++ binutils-2.21-mint-20110206/bfd/Makefile.am	2011-02-06 16:27:48.500000000 +0100
-@@ -379,6 +379,7 @@
- 	peigen.lo \
- 	plugin.lo \
- 	ppcboot.lo \
-+	prg-mint.lo \
- 	reloc16.lo \
- 	riscix.lo \
- 	som.lo \
-@@ -559,6 +560,7 @@
- 	pei-sh.c \
- 	plugin.c \
- 	ppcboot.c \
-+	prg-mint.c \
- 	reloc16.c \
- 	riscix.c \
- 	som.c \
-diff -aurN binutils-2.21/bfd/Makefile.in binutils-2.21-mint-20110206/bfd/Makefile.in
---- binutils-2.21/bfd/Makefile.in	2010-12-08 09:37:36.000000000 +0100
-+++ binutils-2.21-mint-20110206/bfd/Makefile.in	2011-02-06 16:27:48.515625000 +0100
-@@ -679,6 +679,7 @@
- 	peigen.lo \
- 	plugin.lo \
- 	ppcboot.lo \
-+	prg-mint.lo \
- 	reloc16.lo \
- 	riscix.lo \
- 	som.lo \
-@@ -859,6 +860,7 @@
- 	pei-sh.c \
- 	plugin.c \
- 	ppcboot.c \
-+	prg-mint.c \
- 	reloc16.c \
- 	riscix.c \
- 	som.c \
-diff -aurN binutils-2.21/bfd/acinclude.m4 binutils-2.21-mint-20110206/bfd/acinclude.m4
---- binutils-2.21/bfd/acinclude.m4	2009-11-24 23:47:19.000000000 +0100
-+++ binutils-2.21-mint-20110206/bfd/acinclude.m4	2011-02-06 16:27:48.531250000 +0100
-@@ -5,7 +5,7 @@
- [AC_REQUIRE([AC_CANONICAL_TARGET])
- case "${host}" in
- changequote(,)dnl
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- changequote([,])dnl
-   AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
- esac])dnl
-diff -aurN binutils-2.21/bfd/aoutx.h binutils-2.21-mint-20110206/bfd/aoutx.h
---- binutils-2.21/bfd/aoutx.h	2010-10-14 03:31:26.000000000 +0200
-+++ binutils-2.21-mint-20110206/bfd/aoutx.h	2011-02-06 16:27:48.546875000 +0100
-@@ -1841,6 +1841,11 @@
-   bfd_byte buffer[BYTES_IN_WORD];
-   bfd_size_type amt = BYTES_IN_WORD;
- 
-+  /* The MiNT backend writes past the string table.  It therefore has to
-+     know about the table size.  */
-+  obj_aout_external_string_size (abfd) = _bfd_stringtab_size (tab) +
-+    BYTES_IN_WORD;
-+
-   /* The string table starts with the size.  */
-   PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
-   if (bfd_bwrite ((void *) buffer, amt, abfd) != amt)
-@@ -4210,10 +4215,17 @@
- 		return FALSE;
- 	    }
- 
-+#ifdef MY_final_link_relocate_rel
-+	  r = MY_final_link_relocate_rel (howto,
-+					  input_bfd, input_section,
-+					  contents, r_addr, relocation,
-+					  (bfd_vma) 0, rel);
-+#else
- 	  r = MY_final_link_relocate (howto,
- 				      input_bfd, input_section,
- 				      contents, r_addr, relocation,
- 				      (bfd_vma) 0);
-+#endif
- 	}
- 
-       if (r != bfd_reloc_ok)
-diff -aurN binutils-2.21/bfd/bfd-in.h binutils-2.21-mint-20110206/bfd/bfd-in.h
---- binutils-2.21/bfd/bfd-in.h	2010-04-21 18:32:26.000000000 +0200
-+++ binutils-2.21-mint-20110206/bfd/bfd-in.h	2011-02-06 16:27:48.546875000 +0100
-@@ -738,6 +738,15 @@
- extern bfd_boolean bfd_sparclinux_size_dynamic_sections
-   (bfd *, struct bfd_link_info *);
- 
-+/* MiNT executable support routines for the linker.  */
-+
-+extern bfd_boolean bfd_m68kmint_set_extended_flags
-+  (bfd *, flagword);
-+extern bfd_boolean bfd_m68kmint_set_stack_size
-+  (bfd *, bfd_signed_vma);
-+extern bfd_boolean bfd_m68kmint_add_tpa_relocation_entry
-+  (bfd *, bfd_vma);
-+
- /* mmap hacks */
- 
- struct _bfd_window_internal;
-diff -aurN binutils-2.21/bfd/bfd-in2.h binutils-2.21-mint-20110206/bfd/bfd-in2.h
---- binutils-2.21/bfd/bfd-in2.h	2010-11-03 03:31:02.000000000 +0100
-+++ binutils-2.21-mint-20110206/bfd/bfd-in2.h	2011-02-06 16:27:48.562500000 +0100
-@@ -745,6 +745,15 @@
- extern bfd_boolean bfd_sparclinux_size_dynamic_sections
-   (bfd *, struct bfd_link_info *);
- 
-+/* MiNT executable support routines for the linker.  */
-+
-+extern bfd_boolean bfd_m68kmint_set_extended_flags
-+  (bfd *, flagword);
-+extern bfd_boolean bfd_m68kmint_set_stack_size
-+  (bfd *, bfd_signed_vma);
-+extern bfd_boolean bfd_m68kmint_add_tpa_relocation_entry
-+  (bfd *, bfd_vma);
-+
- /* mmap hacks */
- 
- struct _bfd_window_internal;
-diff -aurN binutils-2.21/bfd/config.bfd binutils-2.21-mint-20110206/bfd/config.bfd
---- binutils-2.21/bfd/config.bfd	2010-12-01 12:03:10.000000000 +0100
-+++ binutils-2.21-mint-20110206/bfd/config.bfd	2011-02-06 16:27:48.578125000 +0100
-@@ -823,6 +823,11 @@
-     # targ_selvecs=m68kmach3_vec
-     # targ_cflags=-DSTAT_FOR_EXEC
-     ;;
-+  m68*-*-mint*)
-+    targ_defvec=aout0_big_vec
-+    targ_selvecs=m68kmint_prg_vec
-+    targ_underscore=yes
-+    ;;
-   m68*-hp*-netbsd*)
-     targ_defvec=m68k4knetbsd_vec
-     targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
-diff -aurN binutils-2.21/bfd/configure binutils-2.21-mint-20110206/bfd/configure
---- binutils-2.21/bfd/configure	2010-12-08 09:37:34.000000000 +0100
-+++ binutils-2.21-mint-20110206/bfd/configure	2011-02-06 16:29:39.593750000 +0100
-@@ -13631,7 +13631,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
-  ;;
-@@ -15238,6 +15238,7 @@
-     m68kcoff_vec)		tb="$tb coff-m68k.lo cofflink.lo" ;;
-     m68kcoffun_vec)		tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
-     m68klinux_vec)		tb="$tb m68klinux.lo aout32.lo" ;;
-+    m68kmint_prg_vec)		tb="$tb prg-mint.lo aout32.lo" ;;
-     m68knetbsd_vec)		tb="$tb m68knetbsd.lo aout32.lo" ;;
-     m68ksysvcoff_vec)		tb="$tb coff-svm68k.lo cofflink.lo" ;;
-     m88kbcs_vec)		tb="$tb coff-m88k.lo" ;;
-diff -aurN binutils-2.21/bfd/configure.in binutils-2.21-mint-20110206/bfd/configure.in
---- binutils-2.21/bfd/configure.in	2010-12-08 09:37:33.000000000 +0100
-+++ binutils-2.21-mint-20110206/bfd/configure.in	2011-02-06 16:29:56.250000000 +0100
-@@ -873,6 +873,7 @@
-     m68kcoff_vec)		tb="$tb coff-m68k.lo cofflink.lo" ;;
-     m68kcoffun_vec)		tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
-     m68klinux_vec)		tb="$tb m68klinux.lo aout32.lo" ;;
-+    m68kmint_prg_vec)		tb="$tb prg-mint.lo aout32.lo" ;;
-     m68knetbsd_vec)		tb="$tb m68knetbsd.lo aout32.lo" ;;
-     m68ksysvcoff_vec)		tb="$tb coff-svm68k.lo cofflink.lo" ;;
-     m88kbcs_vec)		tb="$tb coff-m88k.lo" ;;
-diff -aurN binutils-2.21/bfd/libaout.h binutils-2.21-mint-20110206/bfd/libaout.h
---- binutils-2.21/bfd/libaout.h	2009-09-09 23:38:58.000000000 +0200
-+++ binutils-2.21-mint-20110206/bfd/libaout.h	2011-02-06 16:27:49.484375000 +0100
-@@ -422,6 +422,10 @@
-      table, used when linking on SunOS.  This is indexed by the symbol
-      index.  */
-   bfd_vma *local_got_offsets;
-+
-+  /* A pointer for data used by aout extensions.  (Currently only used
-+     by MiNT executables (see prg-mint.c).  */
-+  void *ext;
- };
- 
- struct  aout_data_struct
-@@ -449,6 +453,7 @@
- #define obj_aout_string_window(bfd)        (adata (bfd).string_window)
- #define obj_aout_sym_hashes(bfd)           (adata (bfd).sym_hashes)
- #define obj_aout_dynamic_info(bfd)         (adata (bfd).dynamic_info)
-+#define obj_aout_ext(bfd)                  (adata (bfd).ext)
- 
- /* We take the address of the first element of an asymbol to ensure that the
-    macro is only ever applied to an asymbol.  */
-diff -aurN binutils-2.21/bfd/prg-mint.c binutils-2.21-mint-20110206/bfd/prg-mint.c
---- binutils-2.21/bfd/prg-mint.c	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.21-mint-20110206/bfd/prg-mint.c	2011-02-06 16:27:49.500000000 +0100
-@@ -0,0 +1,1732 @@
-+/* BFD backend for traditional MiNT executables.
-+   Copyright 1998, 2007, 2008, 2009 Free Software Foundation, Inc.
-+   Originally written by Guido Flohr (guido@freemint.de).
-+   Modified by Vincent Riviere (vincent.riviere@freesbee.fr).
-+
-+   This file is part of BFD, the Binary File Descriptor library.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software
-+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-+   MA 02110-1301, USA.  */
-+
-+/* The format of executables on Atari is actually not a.out,  it is
-+   only chosen as an approach which comes close enough.  The layout of a
-+   program image on disk looked like this:
-+
-+   +-----------------+
-+   | 28 Bytes Header |
-+   +-----------------+
-+   | Text segment    |
-+   +-----------------+
-+   | Data segment    |
-+   +-----------------+
-+   | BSS	     |
-+   +-----------------+
-+   | Symbol table    |
-+   +-----------------+
-+   | TPA relocation  |
-+   +-----------------+
-+
-+   The 28 byte exec header used to look like this:
-+
-+   struct old_exec_header
-+   {
-+     bfd_byte a_magic[2];
-+     bfd_byte a_text[4];
-+     bfd_byte a_data[4];
-+     bfd_byte a_bss[4];
-+     bfd_byte a_syms[4];
-+     bfd_byte a_resvd[4];
-+     bfd_byte a_abs[2];
-+   };
-+
-+   The first two bytes (A_MAGIC) contained an assembler branch
-+   instruction to the beginning of the text segment.  Because the
-+   exec header had a fixed size and the text entry point was constant
-+   this assembler instruction also had a constant value (0x601a).
-+   In fact the operating system never really executed the branch
-+   instruction but used this value (0x601a) as a magic value.
-+
-+   TEXT, DATA and BSS were as one would expect them.  The symbol
-+   table wasn't.  Several different formats were in use, none of them
-+   very efficient, none of them powerful enough to support source
-+   level debugging.  I've changed that and the GNU symbol table will
-+   now be used instead (unless the --traditional-format option was
-+   given to the linker).
-+
-+   If the last member A_ABS of the exec header is zero the program
-+   image contains an additional table with relocation information
-+   at the end of the image.  The kernel can load program images at
-+   virtually any address in the address space.  In fact it will load
-+   it at the start of the biggest block of free memory.  This block
-+   is then called the Transient Program Area TPA and the image has
-+   to be relocated against the TPA at runtime.  The relocation info
-+   itself is in a simply way compressed:  It starts with a four-byte
-+   value, the first address within the image to be relocated.  Now
-+   following are one-byte offsets to the last address.  The special
-+   value of 1 (which is impossible as an offset) signifies that 254
-+   has to be added to the next offset.  The table is finished with
-+   a zero-byte.
-+
-+   I now simply extended the header from its old 28 bytes to 256
-+   bytes.  The first 28 bytes give home to a standard Atari header,
-+   the rest is for extensions.  The extension header starts with
-+   a ``real'' assembler instruction, a far jump to the text entry
-+   point.  The extension header gives home to a standard a.out
-+   exec header (currently NMAGIC) plus some extra
-+   more or less useful fields plus space to future extensions.
-+   For the OS the extension header will already belong to the text
-+   segment, for BFD backends the text segment is 228 (or 0xe4)
-+   bytes smaller than for the OS.  This explains for example the
-+   funny TEXT_START_ADDR 0xe4.
-+
-+   The TARGET_PAGE_SIZE is 2 which is only fake.  There is currently
-+   no such thing as memory paging on the Atari (and this is why
-+   ZMAGICs are disabled for now to allow for future enhancements).
-+
-+   If you think that this whole file looks quite like a big hack
-+   you're probably right.  But the results (mainly the output of
-+   the linker) seem to work and they allow to use up-to-date
-+   binutils on the Atari until a better executable format (maybe
-+   ELF) has been established for this machine.  */
-+
-+#include "sysdep.h"
-+#include "bfd.h"
-+
-+#define N_HEADER_IN_TEXT(x) 0
-+#define BYTES_IN_WORD 4
-+#define ENTRY_CAN_BE_ZERO
-+#define N_SHARED_LIB(x) 0
-+#define TEXT_START_ADDR 0xe4
-+#define TARGET_PAGE_SIZE 2
-+#define TARGET_IS_BIG_ENDIAN_P
-+#define DEFAULT_ARCH bfd_arch_m68k
-+#define N_TXTADDR(x) TEXT_START_ADDR
-+
-+/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
-+   remove whitespace added here, and thus will fail to concatenate
-+   the tokens.  */
-+#define MY(OP) CONCAT2 (m68kmint_prg_,OP)
-+#define TARGETNAME "a.out-mintprg"
-+#define NAME(x,y) CONCAT3 (mintprg,_32_,y)
-+
-+/* We have to do quite a lot of magic to make the Atari format
-+   for GEMDOS executables fit into the standard a.out format.
-+   We start with the original header.  */
-+#define external_exec mint_external_exec
-+struct mint_external_exec
-+{
-+  bfd_byte g_branch[2]; 	     /* 0x601a.  */
-+  bfd_byte g_text[4];		     /* Length of text section.  */
-+  bfd_byte g_data[4];		     /* Length of data section.  */
-+  bfd_byte g_bss[4];		     /* Length of bss section.  */
-+  bfd_byte g_syms[4];		     /* Length of symbol table.  */
-+  bfd_byte g_extmagic[4];	     /* Always 0x4d694e54
-+					(in ASCII: ``MiNT'').  */
-+  bfd_byte g_flags[4];		     /* Atari special flags.  */
-+  bfd_byte g_abs[2];		     /* Non-zero if absolute (no relocation
-+					info.  */
-+
-+  /* We extend this header now to provide the information that the
-+     binutils want to see.  Everything following will actually be part
-+     of the text segment (from MiNT's point of view).  As a
-+     consequence the text section has 228 bytes of redundancy.
-+
-+     The following eight bytes should be treated as opaque.
-+     If the word ``opaque'' always attracts your curiosity in
-+     typedefs and structs, here's the explanation:  These eight bytes
-+     are really two assembler instructions.  The first one moves
-+     the contents of e_entry into register d0, the second one
-+     jumps (pc-relative) to the entry point.  See swap_exec_header_out
-+     for details.  */
-+  bfd_byte g_jump_entry[8];
-+
-+  /* Now following a standard a.out header.  Note that the values
-+     may differ from the one given on top.  The traditional header
-+     contains the values that the OS wants to see, the values below
-+     are the values that make the binutils work.  */
-+  bfd_byte e_info[4];		     /* Magic number and stuff.  */
-+  bfd_byte e_text[4];		     /* Length of text section in bytes.  */
-+  bfd_byte e_data[4];		     /* Length of data section.  */
-+  bfd_byte e_bss[4];		     /* Length of standard symbol
-+					table.  */
-+  bfd_byte e_syms[4];		     /* Length of symbol table.  */
-+  bfd_byte e_entry[4];		     /* Start address.  */
-+  bfd_byte e_trsize[4]; 	     /* Length of text relocation
-+					info.  */
-+  bfd_byte e_drsize[4]; 	     /* Length of data relocation
-+					info.  */
-+
-+  bfd_byte g_tparel_pos[4];	     /* File position of TPA relative
-+					relocation info.  */
-+  bfd_byte g_tparel_size[4];	     /* Length of TPA relative relocation
-+					info.  */
-+
-+  /* This is for extensions.  */
-+  bfd_byte g_stkpos[4]; 	     /* If stacksize is hardcoded into
-+					the executable you will find it
-+					at file offset g_stkpos.  If
-+					not this is NULL.  */
-+
-+  bfd_byte g_symbol_format[4];	     /* Format of the symbol table.  See
-+					definitions for _MINT_SYMBOL_FORMAT*
-+					above.  */
-+
-+  /* Pad with zeros.  */
-+  bfd_byte g_pad0[172];
-+};
-+#define EXEC_BYTES_SIZE 256
-+#define GEMDOS_HEADER_SIZE 28
-+
-+/* The following defines are required by aoutx.h.
-+   They are not automatically defined in aout/aout64.h
-+   if external_exec is defined.  */
-+
-+#define OMAGIC 0407	/* Object file or impure executable.  */
-+#define NMAGIC 0410	/* Code indicating pure executable.  */
-+#define ZMAGIC 0413	/* Code indicating demand-paged executable.  */
-+#define BMAGIC 0415	/* Used by a b.out object.  */
-+#define QMAGIC 0314	/* Like ZMAGIC but with N_HEADER_IN_TEXT true.  */
-+
-+/* Files using the following magic flags will not be loaded.  */
-+#define N_BADMAG(x)	(N_MAGIC(x) != NMAGIC)
-+
-+/* For DRI symbol table format.  */
-+struct dri_symbol
-+{
-+  bfd_byte a_name[8];	  /* Symbol name */
-+  bfd_byte a_type[2];	  /* Type flag, i.e. A_TEXT etc; see below.  */
-+  bfd_byte a_value[4];	  /* value of this symbol (or sdb offset).  */
-+};
-+#define DRI_SYMBOL_SIZE 14
-+
-+/* Simple values for a_type.  */
-+#define A_UNDF	0
-+#define A_BSS	0x0100
-+#define A_TEXT	0x0200
-+#define A_DATA	0x0400
-+#define A_EXT	0x0800	      /* External.  */
-+#define A_EQREG 0x1000	      /* Equated register.  */
-+#define A_GLOBL 0x2000	      /* Global.  */
-+#define A_EQU	0x4000	      /* Equated.  */
-+#define A_DEF	0x8000	      /* Defined.  */
-+#define A_LNAM	0x0048	      /* GST compatible long name.  */
-+			      /* File symbols ala aln.  */
-+#define A_TFILE 0x0280	      /* Text file corresponding to object module.  */
-+#define A_TFARC 0x02C0	      /* Text file archive.  Unfortunately this
-+				 conflicts with the bits in A_LNAM.  */
-+
-+/* The following include contains the definitions for internal a.out structures
-+   as well as the prototypes for the NAME(...) functions defined in aoutx.h.  */
-+
-+#include "libaout.h"
-+
-+/* The following function is similar to _bfd_final_link_relocate, except it
-+   adds the reloc structure as an additional parameter.
-+   It will be used int aoutx.h.  */
-+
-+static bfd_reloc_status_type
-+m68kmint_prg_final_link_relocate_rel (reloc_howto_type *howto,
-+				      bfd *input_bfd,
-+				      asection *input_section,
-+				      bfd_byte *contents,
-+				      bfd_vma address,
-+				      bfd_vma value,
-+				      bfd_vma addend,
-+				      struct reloc_std_external *rel);
-+
-+#define MY_final_link_relocate_rel m68kmint_prg_final_link_relocate_rel
-+
-+/* The following include contains the definitions for the NAME(...) functions.  */
-+
-+#include "aoutx.h"
-+
-+/* Data structure that holds some private information for us.  */
-+struct mint_internal_info
-+{
-+  struct bfd_link_info *linkinfo;    /* Remembered from final_link.  */
-+  bfd_boolean	traditional_format;  /* Saved from link info.  */
-+  int		symbol_format;	     /* Format of the symbol table.  */
-+  void		*tparel;	     /* Data for TPA relative relocation
-+					information.  */
-+  file_ptr	tparel_pos;	     /* File position of TPA relative
-+					relocation information.  */
-+  bfd_size_type tparel_size;	     /* Size of TPA relative relocation
-+					information.  */
-+  bfd_size_type dri_symtab_size;     /* Size of traditional symbol table.  */
-+
-+#define MINT_RELOC_CHUNKSIZE 0x1000
-+  bfd_vma	*relocs;	     /* Array of address relocations.  */
-+  unsigned long relocs_used;	     /* Number of relocation entries
-+					already used up.  */
-+  unsigned long relocs_allocated;    /* Number of relocation entries
-+					allocated.  */
-+
-+  bfd_vma	stkpos; 	     /* File offset to value of _stksize.  */
-+
-+  flagword	prg_flags;	     /* Standard GEMDOS flags.  */
-+
-+  bfd_boolean 	override_stack_size; /* TRUE if the executable stack size
-+					must be overriden with stack_size.  */
-+  bfd_signed_vma stack_size;
-+
-+  bfd_boolean	reloc_error;	     /* TRUE if an unhandled error during
-+					relocation occured.  */
-+};
-+
-+/* If --traditional-format was given to the linker an old-style DRI
-+   symbol table is written into the executable.  This is with respect
-+   to many old debugging tools or disassemblers which expect this format.
-+   Although created by the linker, these symbols will be ignored from
-+   input files.  */
-+#define _MINT_SYMBOL_FORMAT_GNU  0
-+#define _MINT_SYMBOL_FORMAT_DRI  1
-+
-+/* Declarations for the variables and functions
-+   defined later in aout-target.h.  */
-+
-+static const bfd_target *
-+m68kmint_prg_callback (bfd *abfd);
-+
-+static void
-+MY_final_link_callback (bfd *abfd,
-+			file_ptr *ptreloff,
-+			file_ptr *pdreloff,
-+			file_ptr *psymoff);
-+
-+extern const bfd_target m68kmint_prg_vec;
-+
-+/* Initialize a new BFD using our file format.  */
-+
-+#define MY_mkobject m68kmint_prg_mkobject
-+
-+static bfd_boolean
-+m68kmint_prg_mkobject (bfd *abfd)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  if (!NAME (aout, mkobject (abfd)))
-+    return FALSE;
-+
-+  /* Allocate our private BFD data.  */
-+  myinfo = bfd_zalloc (abfd, sizeof (*myinfo));
-+  if (myinfo == NULL)
-+    return FALSE;
-+  obj_aout_ext (abfd) = myinfo;
-+
-+  return TRUE;
-+}
-+
-+/* Finish up the reading of an a.out file header.  */
-+
-+#define MY_object_p m68kmint_prg_object_p
-+
-+static const bfd_target *
-+m68kmint_prg_object_p (bfd *abfd)
-+{
-+  struct external_exec exec_bytes;	/* Raw exec header from file.  */
-+  struct internal_exec exec;		/* Cleaned-up exec header.  */
-+  const bfd_target *target;
-+  bfd_size_type amt = EXEC_BYTES_SIZE;
-+  struct mint_internal_info *myinfo;
-+
-+  /* Read the exec bytesd from the file.  */
-+  if (bfd_bread (&exec_bytes, amt, abfd) != amt)
-+    {
-+      if (bfd_get_error () != bfd_error_system_call)
-+	bfd_set_error (bfd_error_wrong_format);
-+      return NULL;
-+    }
-+
-+  /* Instead of byte-swapping we compare bytes.  */
-+  if (exec_bytes.g_branch[0] != 0x60
-+      || exec_bytes.g_branch[1] != 0x1a
-+      || exec_bytes.g_extmagic[0] != 'M'
-+      || exec_bytes.g_extmagic[1] != 'i'
-+      || exec_bytes.g_extmagic[2] != 'N'
-+      || exec_bytes.g_extmagic[3] != 'T')
-+    {
-+      bfd_set_error (bfd_error_wrong_format);
-+      return NULL;
-+    }
-+
-+  /* Swap the standard a.out fields.  */
-+  NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
-+
-+  /* Check a.out magic value.  */
-+  if (N_BADMAG (exec))
-+    {
-+      bfd_set_error (bfd_error_wrong_format);
-+      return NULL;
-+    }
-+
-+  /* Initialize this BFD with the exec values.  */
-+  target = NAME (aout, some_aout_object_p) (abfd, &exec, m68kmint_prg_callback);
-+
-+  /* Allocate our private BFD data.  */
-+  myinfo = bfd_zalloc (abfd, sizeof (*myinfo));
-+  if (myinfo == NULL)
-+    return NULL;
-+  obj_aout_ext (abfd) = myinfo;
-+
-+  /* Now get the missing information.  */
-+  myinfo->prg_flags = bfd_h_get_32 (abfd, exec_bytes.g_flags);
-+  myinfo->stkpos = bfd_h_get_32 (abfd, exec_bytes.g_stkpos);
-+  myinfo->symbol_format = bfd_h_get_32 (abfd, exec_bytes.g_symbol_format);
-+
-+  /* TPA relocation information.  */
-+  myinfo->tparel_pos = bfd_h_get_32 (abfd, exec_bytes.g_tparel_pos);
-+  myinfo->tparel_size = bfd_h_get_32 (abfd, exec_bytes.g_tparel_size);
-+
-+  /* FIXME:  Currently we always read the TPA relative relocation
-+     information.  This is suboptimal because often times there
-+     is no need for it.  Read it only if need be!  Maybe this should
-+     also depend on abfd->cacheable?  */
-+  if (myinfo->tparel_size == 0)
-+    myinfo->tparel = bfd_zalloc (abfd, 4);
-+  else
-+    myinfo->tparel = bfd_alloc (abfd, myinfo->tparel_size);
-+
-+  if (myinfo->tparel == NULL)
-+    return NULL;
-+
-+  if (myinfo->tparel_size == 0)
-+    {
-+      myinfo->tparel_size = 4;
-+    }
-+  else
-+    {
-+      /* Read the information from the bfd.  */
-+      if (bfd_seek (abfd, myinfo->tparel_pos, SEEK_SET) != 0
-+	  || (bfd_bread (myinfo->tparel, myinfo->tparel_size, abfd)
-+	      != myinfo->tparel_size))
-+	return NULL;
-+    }
-+
-+  return target;
-+}
-+
-+/* Free all information we have cached for this BFD.  We can always
-+   read it again later if we need it.  */
-+
-+#define MY_bfd_free_cached_info m68kmint_prg_bfd_free_cached_info
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_free_cached_info (bfd *abfd)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+
-+  if (myinfo != NULL && myinfo->relocs != NULL)
-+    {
-+      free (myinfo->relocs);
-+      myinfo->relocs = NULL;
-+    }
-+
-+  /* myinfo itself has been allocated by bfd_zalloc()
-+     so will be automatically freed along with the BFD.
-+     Same for myinfo->tparel.  */
-+
-+  return NAME (aout, bfd_free_cached_info) (abfd);
-+}
-+
-+/* Write a DRI symbol with TYPE and VALUE.  If the NAME of the
-+   symbol exceeds 8 characters write a long symbol.  If it
-+   exceeds 22 characters truncate the name.  */
-+
-+static int
-+write_dri_symbol (bfd *abfd, const char *name, int type, bfd_vma value)
-+{
-+  int written_bytes = 0;
-+  struct dri_symbol sym;
-+  int is_long_name = strlen (name) > sizeof (sym.a_name);
-+
-+  if (is_long_name)
-+    type |= A_LNAM;
-+
-+  strncpy ((char*)sym.a_name, name, sizeof (sym.a_name));
-+  bfd_put_16 (abfd, type, sym.a_type);
-+  bfd_put_32 (abfd, value, sym.a_value);
-+
-+  if (bfd_bwrite (&sym, DRI_SYMBOL_SIZE, abfd) != DRI_SYMBOL_SIZE)
-+    return -1;
-+  written_bytes += DRI_SYMBOL_SIZE;
-+
-+  if (is_long_name)
-+    {
-+      char more_name[DRI_SYMBOL_SIZE];
-+
-+      strncpy (more_name, name + sizeof (sym.a_name), DRI_SYMBOL_SIZE);
-+
-+      if (bfd_bwrite (more_name, DRI_SYMBOL_SIZE, abfd) != DRI_SYMBOL_SIZE)
-+	return -1;
-+      written_bytes += DRI_SYMBOL_SIZE;
-+    }
-+
-+  return written_bytes;
-+}
-+
-+/* Emit a traditional DRI symbol table while linking.
-+   Most of this code comes from aout_link_write_symbols() in aoutx.h.  */
-+
-+static bfd_boolean
-+link_write_traditional_syms (bfd *abfd, struct bfd_link_info *info)
-+{
-+  bfd			     *input_bfd;
-+  enum bfd_link_strip	     strip = info->strip;
-+  enum bfd_link_discard      discard = info->discard;
-+  struct mint_internal_info  *myinfo = obj_aout_ext (abfd);
-+  bfd			     *last_archive = NULL;
-+
-+  /* Position file pointer.  */
-+  if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
-+    return FALSE;
-+
-+  myinfo->dri_symtab_size = 0;
-+
-+  for (input_bfd = info->input_bfds; input_bfd != NULL; input_bfd = input_bfd->link_next)
-+    {
-+      bfd_size_type sym_count = obj_aout_external_sym_count (input_bfd);
-+      char *strings = obj_aout_external_strings (input_bfd);
-+      struct external_nlist *sym = obj_aout_external_syms (input_bfd);
-+      struct external_nlist *sym_end = sym + sym_count;
-+      struct aout_link_hash_entry **sym_hash = obj_aout_sym_hashes (input_bfd);
-+      bfd_boolean pass = FALSE;
-+      bfd_boolean skip = FALSE;
-+      bfd_boolean skip_next = FALSE;
-+      int written_bytes;
-+      int a_type;
-+      bfd_boolean write_archive_name = FALSE;
-+      bfd_vma val = 0;
-+
-+      /* First write out a symbol for the archive if we do not
-+	 strip these symbols and if it differs from the last
-+	 one.  */
-+      if (input_bfd->my_archive != last_archive
-+	  && input_bfd->my_archive != NULL)
-+	{
-+	  write_archive_name = TRUE;
-+	  last_archive = input_bfd->my_archive;
-+	}
-+
-+      if (write_archive_name
-+	  && strip != strip_all
-+	  && (strip != strip_some
-+	      || bfd_hash_lookup (info->keep_hash,
-+				  input_bfd->my_archive->filename,
-+				  FALSE, FALSE) != NULL)
-+	  && discard != discard_all)
-+	{
-+	  val = bfd_get_section_vma (abfd,
-+				     obj_textsec (input_bfd)->output_section)
-+	    + obj_textsec (input_bfd)->output_offset;
-+
-+	  written_bytes = write_dri_symbol (abfd,
-+					    input_bfd->my_archive->filename,
-+					    A_TFILE, val);
-+
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+	  else
-+	    myinfo->dri_symtab_size += written_bytes;
-+	}
-+
-+      /* Now write out a symbol for the object file if we do not
-+	 strip these symbols.  */
-+      if (strip != strip_all
-+	  && (strip != strip_some
-+	      || bfd_hash_lookup (info->keep_hash, input_bfd->filename,
-+				  FALSE, FALSE) != NULL)
-+	  && discard != discard_all)
-+	{
-+	  val = bfd_get_section_vma (abfd,
-+				     obj_textsec (input_bfd)->output_section)
-+	    + obj_textsec (input_bfd)->output_offset;
-+
-+	  written_bytes = write_dri_symbol (abfd, input_bfd->filename,
-+					    A_TFILE, val);
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+	  else
-+	    myinfo->dri_symtab_size += written_bytes;
-+	}
-+
-+      /* Now we have a problem.  All symbols that we see have already
-+	 been marked written (because we write them a second time
-+	 here.  If we would do it the clean way we would have
-+	 to traverse the entire symbol map and reset the written
-+	 flag.  We hack here instead...  */
-+#define mark_written(h) (* (int *) &h->written = (int) TRUE + 1)
-+#define is_written(h) ((int) h->written == (int) TRUE + 1)
-+      for (; sym < sym_end; sym++, sym_hash++)
-+	{
-+	  const char *name;
-+	  int type;
-+	  struct aout_link_hash_entry *h;
-+	  asection *symsec;
-+	  val = 0;
-+
-+	  type = H_GET_8 (input_bfd, sym->e_type);
-+	  name = strings + GET_WORD (input_bfd, sym->e_strx);
-+
-+	  h = NULL;
-+
-+	  if (pass)
-+	    {
-+	      /* Pass this symbol through.  It is the target of an
-+	      indirect or warning symbol.  */
-+	      val = GET_WORD (input_bfd, sym->e_value);
-+	      pass = FALSE;
-+	    }
-+	  else if (skip_next)
-+	    {
-+	      /* Skip this symbol, which is the target of an indirect
-+		 symbol that we have changed to no longer be an indirect
-+		 symbol.  */
-+	      skip_next = FALSE;
-+	      continue;
-+	    }
-+	  else
-+	    {
-+	      struct aout_link_hash_entry *hresolve = *sym_hash;
-+
-+	      /* We have saved the hash table entry for this symbol, if
-+		 there is one.  Note that we could just look it up again
-+		 in the hash table, provided we first check that it is an
-+		 external symbol. */
-+	      h = *sym_hash;
-+
-+	      /* Use the name from the hash table, in case the symbol was
-+		 wrapped.  */
-+	    if (h != NULL
-+		&& h->root.type != bfd_link_hash_warning)
-+		name = h->root.root.string;
-+
-+	      /* If this is an indirect or warning symbol, then change
-+		 hresolve to the base symbol.  */
-+	      hresolve = h;
-+	      if (h != (struct aout_link_hash_entry *) NULL
-+		  && (h->root.type == bfd_link_hash_indirect
-+		      || h->root.type == bfd_link_hash_warning))
-+		{
-+		  hresolve = (struct aout_link_hash_entry*) h->root.u.i.link;
-+		  while (hresolve->root.type == bfd_link_hash_indirect
-+			 || hresolve->root.type == bfd_link_hash_warning)
-+		    hresolve = ((struct aout_link_hash_entry*)
-+				hresolve->root.u.i.link);
-+		}
-+
-+	      /* If the symbol has already been written out skip it.  */
-+	      if (h != NULL
-+		  && is_written (h))
-+		{
-+		  if ((type & N_TYPE) == N_INDR
-+		      || type == N_WARNING)
-+		    skip_next = TRUE;
-+		  continue;
-+		}
-+
-+	      /* See if we are stripping this symbol.  */
-+	      skip = FALSE;
-+
-+	      /* Skip all debugger symbols.  No way to output them in
-+		 DRI format.  This will also reduce a lot of headaches.  */
-+	      if ((type & N_STAB) != 0)
-+		skip = TRUE;
-+
-+	      switch (strip)
-+		{
-+		case strip_none:
-+		case strip_debugger:
-+		  break;
-+		case strip_some:
-+		  if (bfd_hash_lookup (info->keep_hash, name, FALSE, FALSE)
-+		      == NULL)
-+		    skip = TRUE;
-+		  break;
-+		case strip_all:
-+		  skip = TRUE;
-+		  break;
-+		}
-+
-+	      if (skip)
-+		{
-+		  if (h != NULL)
-+		    mark_written (h);
-+		  continue;
-+		}
-+
-+	      /* Get the value of the symbol.  */
-+	      if ((type & N_TYPE) == N_TEXT
-+		  || type == N_WEAKT)
-+		symsec = obj_textsec (input_bfd);
-+	      else if ((type & N_TYPE) == N_DATA
-+		       || type == N_WEAKD)
-+		symsec = obj_datasec (input_bfd);
-+	      else if ((type & N_TYPE) == N_BSS
-+		       || type == N_WEAKB)
-+		symsec = obj_bsssec (input_bfd);
-+	      else if ((type & N_TYPE) == N_ABS
-+		       || type == N_WEAKA)
-+		symsec = bfd_abs_section_ptr;
-+	      else if (((type & N_TYPE) == N_INDR
-+			&& (hresolve == NULL
-+			    || (hresolve->root.type != bfd_link_hash_defined
-+				&& hresolve->root.type != bfd_link_hash_defweak
-+				&& hresolve->root.type != bfd_link_hash_common)))
-+		       || type == N_WARNING)
-+		{
-+		  /* Pass the next symbol through unchanged.  The
-+		     condition above for indirect symbols is so that if
-+		     the indirect symbol was defined, we output it with
-+		     the correct definition so the debugger will
-+		     understand it.  */
-+		  pass = TRUE;
-+		  val = GET_WORD (input_bfd, sym->e_value);
-+		  symsec = NULL;
-+		}
-+	      else
-+		{
-+		  /* If we get here with an indirect symbol, it means that
-+		     we are outputting it with a real definition.  In such
-+		     a case we do not want to output the next symbol,
-+		     which is the target of the indirection.  */
-+		  if ((type & N_TYPE) == N_INDR)
-+		    skip_next = TRUE;
-+
-+		  symsec = NULL;
-+
-+		  /* We need to get the value from the hash table.  We use
-+		     hresolve so that if we have defined an indirect
-+		     symbol we output the final definition.  */
-+		  if (h == NULL)
-+		    {
-+		      switch (type & N_TYPE)
-+			{
-+			case N_SETT:
-+			  symsec = obj_textsec (input_bfd);
-+			  break;
-+			case N_SETD:
-+			  symsec = obj_datasec (input_bfd);
-+			  break;
-+			case N_SETB:
-+			  symsec = obj_bsssec (input_bfd);
-+			  break;
-+			case N_SETA:
-+			  symsec = bfd_abs_section_ptr;
-+			  break;
-+			default:
-+			  val = 0;
-+			  break;
-+			}
-+		    }
-+		  else if (hresolve->root.type == bfd_link_hash_defined
-+			   || hresolve->root.type == bfd_link_hash_defweak)
-+		    {
-+		      asection *input_section;
-+		      asection *output_section;
-+
-+		      /* This case usually means a common symbol which was
-+			 turned into a defined symbol.  */
-+		      input_section = hresolve->root.u.def.section;
-+		      output_section = input_section->output_section;
-+		      BFD_ASSERT (bfd_is_abs_section (output_section)
-+				  || output_section->owner == abfd);
-+
-+		      /* The following reference to the output section VMA
-+			 is commented out because DRI symbols are relative
-+			 to the beginning of the section.  */
-+		      val = (hresolve->root.u.def.value
-+			     /*+ bfd_get_section_vma (abfd, output_section)*/
-+			     + input_section->output_offset);
-+
-+		      /* TEXT symbols values must be adjusted
-+			 by adding the size of the extended header.  */
-+		      if (output_section == obj_textsec (abfd))
-+			val += TEXT_START_ADDR;
-+
-+		      /* Get the correct type based on the section.  If
-+			 this is a constructed set, force it to be
-+			 globally visible.  */
-+		      if (type == N_SETT
-+			  || type == N_SETD
-+			  || type == N_SETB
-+			  || type == N_SETA)
-+			type |= N_EXT;
-+
-+		      type &=~ N_TYPE;
-+
-+		      if (output_section == obj_textsec (abfd))
-+			type |= N_TEXT;
-+		      else if (output_section == obj_datasec (abfd))
-+			type |= N_DATA;
-+		      else if (output_section == obj_bsssec (abfd))
-+			type |= N_BSS;
-+		      else
-+			type |= N_ABS;
-+		    }
-+		  else if (hresolve->root.type == bfd_link_hash_common)
-+		    val = hresolve->root.u.c.size;
-+		  else if (hresolve->root.type == bfd_link_hash_undefweak)
-+		    {
-+		      val = 0;
-+		      type = N_UNDF;
-+		    }
-+		  else
-+		    val = 0;
-+		}
-+	      if (symsec != NULL)
-+		{
-+		  /* The following reference to the output section VMA
-+		     is commented out because DRI symbols are relative
-+		     to the beginning of the section.  */
-+		  val = (/*symsec->output_section->vma
-+			 +*/ symsec->output_offset
-+			 + (GET_WORD (input_bfd, sym->e_value)
-+			 - symsec->vma));
-+
-+		  /* TEXT symbols values must be adjusted
-+		     by adding the size of the extended header.  */
-+		  if (symsec == obj_textsec (input_bfd))
-+		    val += TEXT_START_ADDR;
-+		}
-+
-+	      /* If this is a global symbol set the written flag, and if
-+		 it is a local symbol see if we should discard it.  */
-+	      if (h != NULL)
-+		{
-+		  mark_written (h);
-+		}
-+	      else if ((type & N_TYPE) != N_SETT
-+		       && (type & N_TYPE) != N_SETD
-+		       && (type & N_TYPE) != N_SETB
-+		       && (type & N_TYPE) != N_SETA)
-+		{
-+		  switch (discard)
-+		    {
-+		    case discard_none:
-+		    case discard_sec_merge:
-+		      break;
-+		    case discard_l:
-+		      if (bfd_is_local_label_name (input_bfd, name))
-+			skip = TRUE;
-+		      break;
-+		    default:
-+		    case discard_all:
-+		      skip = TRUE;
-+		      break;
-+		    }
-+		  if (skip)
-+		    {
-+		      pass = FALSE;
-+		      continue;
-+		    }
-+		}
-+	    }
-+
-+	  /* Now find the nearest type in DRI format.  */
-+	  switch (type)
-+	    {
-+	    case N_ABS:
-+	    case N_ABS | N_EXT:
-+	    case N_SETA:
-+	    case N_SETA | N_EXT:
-+	    case N_WEAKA:
-+	      a_type = A_EQU | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_TEXT:
-+	    case N_TEXT | N_EXT:
-+	    case N_SETT:
-+	    case N_SETT | N_EXT:
-+	    case N_WEAKT:
-+	      a_type = A_TEXT | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_DATA:
-+	    case N_DATA | N_EXT:
-+	    case N_SETD:
-+	    case N_SETD | N_EXT:
-+	    case N_WEAKD:
-+	      a_type = A_DATA | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_BSS:
-+	    case N_BSS | N_EXT:
-+	    case N_SETB:
-+	    case N_SETB | N_EXT:
-+	    case N_WEAKB:
-+	      a_type = A_BSS | A_DEF | A_GLOBL;
-+	      break;
-+	    default:
-+	      continue;
-+	    }
-+
-+	  written_bytes = write_dri_symbol (abfd, name, a_type, val);
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+
-+	  myinfo->dri_symtab_size += written_bytes;
-+	}
-+    }
-+
-+  obj_aout_external_string_size (abfd) = 0;
-+  return TRUE;
-+}
-+
-+/* This is used for qsort() to sort addresses
-+   for the TPA relocation table.  */
-+
-+static int
-+vma_cmp (const void *v1, const void *v2)
-+{
-+  return (int) ((*((bfd_vma *) v1)) - (*((bfd_vma *) v2)));
-+}
-+
-+/* Alloc and fill the TPA relocation table.  */
-+
-+static bfd_boolean
-+fill_tparel (bfd *abfd)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  unsigned long i;
-+  bfd_size_type bytes;
-+  unsigned char *ptr;
-+
-+  /* Sort the relocation info.  */
-+  if (myinfo->relocs != NULL)
-+    qsort (myinfo->relocs, myinfo->relocs_used, sizeof (bfd_vma),
-+	   vma_cmp);
-+
-+  /* Now calculate the number of bytes we need.  The relocation info
-+     is encoded as follows:  The first entry is a 32-bit value
-+     denoting the first offset to relocate.  All following entries
-+     are relative to the preceding one.  For relative offsets of
-+     more than 254 bytes a value of 1 is used.  The OS will then
-+     add 254 bytes to the current offset.  The list is then terminated
-+     with the byte 0.  */
-+  bytes = 4; /* First entry is a long.  */
-+  for (i = 1; i < myinfo->relocs_used; i++)
-+    {
-+      unsigned long diff = myinfo->relocs[i] - myinfo->relocs[i - 1];
-+      BFD_ASSERT(diff > 0);
-+      bytes += (diff + 253) / 254;
-+    }
-+  /* Last entry is (bfd_byte) 0 if there are some relocations.  */
-+  if (myinfo->relocs_used > 0)
-+    bytes++;
-+
-+  myinfo->tparel_size = bytes;
-+  myinfo->tparel = bfd_alloc (abfd, bytes);
-+  if (myinfo->tparel == NULL)
-+    return FALSE;
-+
-+  /* Now fill the array.  */
-+  ptr = (bfd_byte*) myinfo->tparel;
-+  if (myinfo->relocs != NULL)
-+    bfd_put_32 (abfd, myinfo->relocs[0], ptr);
-+  else
-+    bfd_put_32 (abfd, 0, ptr);
-+  ptr += 4;
-+
-+  for (i = 1; i < myinfo->relocs_used; i++)
-+    {
-+      unsigned long diff = myinfo->relocs[i] - myinfo->relocs[i - 1];
-+      while (diff > 254)
-+	{
-+	  *ptr++ = 1;
-+	  diff -= 254;
-+	}
-+      *ptr++ = (bfd_byte) diff;
-+    }
-+
-+  if (myinfo->relocs_used > 0)
-+    *ptr = 0;
-+
-+  return TRUE;
-+}
-+
-+/* Final link routine.  We need to use a call back to get the correct
-+   offsets in the output file.  And we need to malloc some internal
-+   buffers.  */
-+
-+#define MY_bfd_final_link m68kmint_prg_bfd_final_link
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  struct bfd_link_hash_table *hash = info->hash;
-+  enum bfd_link_strip original_strip = info->strip;
-+
-+  if (info->relocatable)
-+    {
-+      _bfd_error_handler ("%B: relocatable output is not supported by format %s",
-+	abfd, bfd_get_target (abfd));
-+      bfd_set_error (bfd_error_invalid_operation);
-+      return FALSE;
-+    }
-+
-+  myinfo->linkinfo = info;
-+
-+  /* Make sure that for now we never write zmagics.  */
-+  abfd->flags &= ~D_PAGED;
-+
-+  /* Find the __stksize symbol.  This symbol is used for a MiNT
-+     special kludge.  The libc defines this symbol in an object file
-+     initialized to a default value to make sure it is defined in
-+     every output file.  The start-up code in crtinit() then simply
-+     sets the stacksize accordingly.  In your programs (if they need
-+     an unusual stacksize) you can then simply code:
-+
-+	   long _stksize = 0x2000;
-+
-+     This will create a program stack of 2k.  Since MiNT cannot detect
-+     a stack overflow this is the only way to prevent program crashes
-+     caused by a stack that is too small.
-+
-+     The ancient linker ignored this feature, the ancient strip
-+     program paid heed to it.  By default, strip never stripped this
-+     special symbol from the binary.
-+
-+     Another program called ``printstk'' and its colleague ``fixstk''
-+     could be used to either print the current value of the stacksize
-+     or to modify it without recompiling and rebuilding.  These
-+     programs traversed the symbol table and then took the appropriate
-+     measures if the symbol was found.
-+
-+     Here we do a different approach.  Since we already expanded the
-+     standard executable header we now hardcode the address (as a file
-+     offset) that the __stksize symbol points to into the header.  We
-+     can now let strip safely remove the entry from the symbol table
-+     and we're not dependent on a special format of the symbol table.
-+     Because the address is kept in the header we will always be able
-+     to manipulate the stacksize value later.  */
-+  if (hash != NULL)
-+    {
-+      struct aout_link_hash_entry *h =
-+	aout_link_hash_lookup (aout_hash_table (info), "__stksize",
-+			       FALSE, FALSE, FALSE);
-+      asection *sec;
-+
-+      if (h != NULL)
-+	{
-+	  switch (h->root.type)
-+	    {
-+	    case bfd_link_hash_defined:
-+	    case bfd_link_hash_defweak:
-+	      sec = h->root.u.def.section->output_section;
-+	      BFD_ASSERT (sec->owner == abfd);
-+
-+	      myinfo->stkpos = (h->root.u.def.value + sec->vma
-+				+ h->root.u.def.section->output_offset
-+				+ GEMDOS_HEADER_SIZE);
-+	      break;
-+	    default:  /* Ignore other types.  */
-+	      break;
-+	    }
-+	}
-+    }
-+
-+  if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
-+    {
-+      myinfo->traditional_format = TRUE;
-+      myinfo->symbol_format = _MINT_SYMBOL_FORMAT_DRI;
-+    }
-+
-+  /* Unconditionally unset the traditional flag.  The only effect in
-+     the a.out code is to disable string hashing (with respect to
-+     SunOS gdx).  This is not necessary for us.  */
-+
-+  abfd->flags &= ~BFD_TRADITIONAL_FORMAT;
-+
-+  /* Do not write GNU symbols in traditional format.  */
-+  if (myinfo->traditional_format)
-+    info->strip = strip_all;
-+
-+  if (NAME(aout,final_link) (abfd, info, MY_final_link_callback)
-+      != TRUE)
-+    return FALSE;
-+
-+  if (myinfo->reloc_error)
-+    return FALSE;
-+
-+  /* Restore the strip status for the traditional symbols.  */
-+  info->strip = original_strip;
-+
-+  if (myinfo->traditional_format
-+      && link_write_traditional_syms (abfd, info) != TRUE)
-+    return FALSE;
-+
-+  if (fill_tparel (abfd) != TRUE)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Copy private BFD header information from the input BFD.  */
-+
-+#define MY_bfd_copy_private_header_data m68kmint_prg_bfd_copy_private_header_data
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_copy_private_header_data (bfd *ibfd, bfd *obfd)
-+{
-+  (void)obfd; /* Unused.  */
-+
-+  /* We can only copy BFD files using our own file format.  */
-+  if (ibfd->xvec != &m68kmint_prg_vec)
-+    {
-+      _bfd_error_handler ("%B: cannot convert from format %s to format %s",
-+	ibfd, bfd_get_target (ibfd), bfd_get_target (obfd));
-+      bfd_set_error (bfd_error_invalid_operation);
-+      return FALSE;
-+    }
-+
-+  return TRUE;
-+}
-+
-+/* Copy backend specific data from one object module to another.
-+   This function is used by objcopy and strip.  */
-+
-+#define MY_bfd_copy_private_bfd_data m68kmint_prg_bfd_copy_private_bfd_data
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
-+{
-+  struct mint_internal_info *myinfo_in;
-+  struct mint_internal_info *myinfo_out;
-+
-+  /* obfd uses our file format, ibfd may be foreign.  */
-+  if (ibfd->xvec != &m68kmint_prg_vec)
-+    return TRUE;
-+
-+  myinfo_in = obj_aout_ext (ibfd);
-+  BFD_ASSERT (myinfo_in != NULL);
-+
-+  myinfo_out = obj_aout_ext (obfd);
-+  BFD_ASSERT (myinfo_out != NULL);
-+
-+  /* Copy myinfo.  */
-+  memcpy (myinfo_out, myinfo_in, sizeof (*myinfo_out));
-+
-+  /* Copy tparel.  */
-+  myinfo_out->tparel = bfd_alloc (obfd, myinfo_out->tparel_size);
-+  if (myinfo_out->tparel == NULL)
-+    return FALSE;
-+  memcpy (myinfo_out->tparel, myinfo_in->tparel, myinfo_out->tparel_size);
-+
-+  /* Normalize the type of empty symbols.  */
-+  if (bfd_get_symcount (obfd) == 0)
-+    myinfo_out->symbol_format = _MINT_SYMBOL_FORMAT_GNU;
-+
-+  return TRUE; /* _bfd_generic_bfd_copy_private_bfd_data (ibfd, obfd); */
-+}
-+
-+/* Merge private BFD information from an input BFD to the output BFD when linking.  */
-+
-+#define MY_bfd_merge_private_bfd_data m68kmint_prg_merge_private_bfd_data
-+
-+static bfd_boolean
-+m68kmint_prg_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
-+{
-+  (void)obfd; /* Unused.  */
-+
-+  /* Our file format cannot be used as linker input.  */
-+  if (ibfd->xvec == &m68kmint_prg_vec)
-+    {
-+      _bfd_error_handler ("%B: file format %s cannot be used as linker input",
-+	ibfd, bfd_get_target (ibfd));
-+      bfd_set_error (bfd_error_invalid_operation);
-+      return FALSE;
-+    }
-+
-+  return TRUE; /* _bfd_generic_bfd_merge_private_bfd_data (ibfd, obfd); */
-+}
-+
-+/* Find out the symbol name.  */
-+
-+static const char *
-+find_symbol_name (reloc_howto_type *howto, bfd *input_bfd,
-+		  bfd_byte *location, struct reloc_std_external *rel)
-+{
-+  struct external_nlist *syms = obj_aout_external_syms (input_bfd);
-+  char *strings = obj_aout_external_strings (input_bfd);
-+  struct aout_link_hash_entry **sym_hashes
-+    = obj_aout_sym_hashes (input_bfd);
-+  struct aout_link_hash_entry *h = NULL;
-+  const char *name;
-+  bfd_size_type r_index;
-+  int r_extern;
-+
-+  if (bfd_get_reloc_size (howto) != 4)
-+    return "(not a symbol)";
-+
-+  /* The input bfd is always big-endian.  There is no need to
-+     call bfd_header_big_endian (input_bfd).  */
-+  r_index  = ((rel->r_index[0] << 16)
-+	      | (rel->r_index[1] << 8)
-+	      | (rel->r_index[2]));
-+  r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
-+
-+  if (sym_hashes != NULL)
-+    h = sym_hashes[r_index];
-+
-+  if (!r_extern)
-+    {
-+      bfd_size_type i;
-+      bfd_vma wanted_value = bfd_get_32 (input_bfd, location);
-+
-+      name = NULL;
-+      for (i = 0; i < obj_aout_external_sym_count (input_bfd); i++)
-+	{
-+	  bfd_vma this_value = bfd_get_32 (input_bfd, syms[i].e_value);
-+
-+	  if (this_value == wanted_value)
-+	    {
-+	      bfd_byte symtype = bfd_get_8 (input_bfd, syms[i].e_type);
-+
-+	      /* Skip debug symbols and the like.  */
-+	      if ((symtype & N_STAB) != 0)
-+		continue;
-+
-+	      /* This is dirty but preferable to a plethoria of
-+		 single comparisons.  */
-+	      if (symtype <= (N_BSS | N_EXT)
-+		  || (symtype >= N_WEAKU && symtype <= N_COMM))
-+		{
-+		  name = strings + GET_WORD (input_bfd, syms[i].e_strx);
-+		  break;
-+		}
-+	    }
-+	}
-+
-+      /* FIXME:  If the relocation is against a section there is
-+	 probably a symbol for that section floating around somewhere
-+	 in the bfd jungle.  */
-+      if (name == NULL)
-+	{
-+	  switch ((r_index & N_TYPE) & ~N_EXT)
-+	    {
-+	    case N_TEXT:
-+	      name = "text section";
-+	      break;
-+	    case N_DATA:
-+	      name = "data section";
-+	      break;
-+	    case N_BSS:
-+	      name = "bss section";
-+	      break;
-+	    case N_ABS:
-+	      name = "absolute section";
-+	      break;
-+	    default:
-+	      name = "unknown section";
-+	      break;
-+	    }
-+	}
-+    }
-+  else if (h != NULL)
-+    name = h->root.root.string;
-+  else if (r_index >= obj_aout_external_sym_count (input_bfd))
-+    name = "(unknown symbol)";	/* Shouldn't happen.  */
-+  else
-+    name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
-+
-+  return name;
-+}
-+
-+/* This relocation routine is used by some of the backend linkers.
-+   They do not construct asymbol or arelent structures, so there is no
-+   reason for them to use bfd_perform_relocation.  Also,
-+   bfd_perform_relocation is so hacked up it is easier to write a new
-+   function than to try to deal with it.
-+
-+   This routine does a final relocation.  Whether it is useful for a
-+   relocatable link depends upon how the object format defines
-+   relocations.
-+
-+   FIXME: This routine ignores any special_function in the HOWTO,
-+   since the existing special_function values have been written for
-+   bfd_perform_relocation.
-+
-+   HOWTO is the reloc howto information.
-+   INPUT_BFD is the BFD which the reloc applies to.
-+   INPUT_SECTION is the section which the reloc applies to.
-+   CONTENTS is the contents of the section.
-+   ADDRESS is the address of the reloc within INPUT_SECTION.
-+   VALUE is the value of the symbol the reloc refers to.
-+   ADDEND is the addend of the reloc.  */
-+
-+/* The additional parameter REL is specific to this backend.
-+   This function is derived from _bfd_final_link_relocate()
-+   found in reloc.c. It adds additional checking for dangerous
-+   relocations in MiNT sharable text sections, then it records
-+   the relocated offset in myinfo->relocs[] for further processing.  */
-+
-+static bfd_reloc_status_type
-+m68kmint_prg_final_link_relocate_rel (reloc_howto_type *howto,
-+				      bfd *input_bfd,
-+				      asection *input_section,
-+				      bfd_byte *contents,
-+				      bfd_vma address,
-+				      bfd_vma value,
-+				      bfd_vma addend,
-+				      struct reloc_std_external *rel)
-+{
-+  bfd_vma relocation;
-+  bfd *output_bfd = input_section->output_section->owner;
-+  struct mint_internal_info *myinfo = obj_aout_ext (output_bfd);
-+  bfd_reloc_status_type retval;
-+  int r_index;
-+  int r_extern;
-+  bfd_boolean need_tpa_relocation;
-+
-+  /* The input bfd is always big-endian.  There is no need to
-+     call bfd_header_big_endian (input_bfd).  */
-+  r_index  = ((rel->r_index[0] << 16)
-+	      | (rel->r_index[1] << 8)
-+	      | (rel->r_index[2]));
-+  r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
-+
-+#define _MINT_F_SHTEXT 0x800
-+
-+  /* Sanity check the address.  */
-+  if (address > bfd_get_section_limit (input_bfd, input_section))
-+    return bfd_reloc_outofrange;
-+
-+  /* This function assumes that we are dealing with a basic relocation
-+     against a symbol.  We want to compute the value of the symbol to
-+     relocate to.  This is just VALUE, the value of the symbol, plus
-+     ADDEND, any addend associated with the reloc.  */
-+  relocation = value + addend;
-+
-+  /* Check for dangerous relocations in images with a sharable
-+     text section.  */
-+  if ((myinfo->prg_flags & _MINT_F_SHTEXT) != 0
-+      && bfd_get_reloc_size (howto) == 4)
-+    {
-+      bfd_boolean error_found = FALSE;
-+      const char *name = NULL;
-+
-+      if (input_section == obj_textsec (input_bfd))
-+	{
-+	  if (!r_extern)
-+	    {
-+	      /* This is a relocation against another section.  Only
-+		 relocations against the text section are allowed.  */
-+	      if (r_index != N_TEXT && r_index != (N_TEXT | N_EXT))
-+		error_found = TRUE;
-+	    }
-+	  else if (relocation > (input_section->output_section->vma
-+			    + input_section->output_section->size))
-+	    {
-+	      error_found = TRUE;
-+	    }
-+	  else if (relocation == (input_section->output_section->vma
-+				  + input_section->output_section->size))
-+	    {
-+	      name = find_symbol_name (howto, input_bfd,
-+						    contents + address,
-+						    rel);
-+	      if (strcmp (name, "_etext") == 0)
-+		error_found = FALSE;
-+	    }
-+	}
-+
-+      if (error_found)
-+	{
-+	  const struct bfd_link_callbacks *callbacks
-+	    = myinfo->linkinfo->callbacks;
-+
-+	  myinfo->reloc_error = TRUE;
-+
-+	  if (callbacks->reloc_dangerous != NULL)
-+	    {
-+	      if (name == NULL)
-+		name = find_symbol_name (howto, input_bfd,
-+						      contents + address,
-+						      rel);
-+
-+	      callbacks->reloc_dangerous (myinfo->linkinfo, name,
-+					  input_bfd,
-+					  input_section, address);
-+	    }
-+	}
-+    }
-+
-+  /* If the relocation is PC relative, we want to set RELOCATION to
-+     the distance between the symbol (currently in RELOCATION) and the
-+     location we are relocating.  Some targets (e.g., i386-aout)
-+     arrange for the contents of the section to be the negative of the
-+     offset of the location within the section; for such targets
-+     pcrel_offset is FALSE.  Other targets (e.g., m88kbcs or ELF)
-+     simply leave the contents of the section as zero; for such
-+     targets pcrel_offset is TRUE.  If pcrel_offset is FALSE we do not
-+     need to subtract out the offset of the location within the
-+     section (which is just ADDRESS).  */
-+  if (howto->pc_relative)
-+    {
-+      relocation -= (input_section->output_section->vma
-+		     + input_section->output_offset);
-+      if (howto->pcrel_offset)
-+	relocation -= address;
-+    }
-+
-+  retval = _bfd_relocate_contents (howto, input_bfd, relocation,
-+				   contents + address);
-+
-+  /* The symbol has to be relocated again iff the length of the relocation
-+     is 2 words and it is not pc relative.  */
-+  need_tpa_relocation = FALSE;
-+  if (!howto->pc_relative && bfd_get_reloc_size (howto) == 4)
-+    {
-+      if (r_extern)
-+	{
-+	  struct aout_link_hash_entry **sym_hashes = obj_aout_sym_hashes (input_bfd);
-+	  struct aout_link_hash_entry *h = sym_hashes[r_index];
-+	  asection *output_section = h->root.u.def.section->output_section;
-+
-+	  /* Do not relocate absolute symbols.  */
-+	  if (output_section == obj_textsec (output_bfd)
-+	      || output_section == obj_datasec (output_bfd)
-+	      || output_section == obj_bsssec (output_bfd))
-+	    {
-+	      need_tpa_relocation = TRUE;
-+	    }
-+	}
-+      else
-+	{
-+	  need_tpa_relocation = TRUE;
-+	}
-+    }
-+
-+  /* Here we add the TPA relocation entries for the address references
-+     located inside the input sections. Note that if some references
-+     to addresses are generated using data statements in the linker
-+     script, they will not be relocated here because they do not
-+     belong to any input section.  */
-+  if (need_tpa_relocation)
-+    {
-+      bfd_vma tpa_address = input_section->output_section->vma
-+	+ input_section->output_offset + address;
-+
-+      if (!bfd_m68kmint_add_tpa_relocation_entry(output_bfd, tpa_address))
-+	return bfd_reloc_other;
-+    }
-+
-+  return retval;
-+}
-+
-+/* Write out the TPA relocation table.  */
-+
-+static bfd_boolean
-+write_tparel (bfd *abfd, struct internal_exec *execp)
-+{
-+  struct mint_internal_info* myinfo = obj_aout_ext (abfd);
-+
-+  if (myinfo->dri_symtab_size == 0)
-+    myinfo->tparel_pos = N_STROFF (*execp)
-+      + obj_aout_external_string_size (abfd);
-+  else
-+    myinfo->tparel_pos = N_SYMOFF (*execp)
-+      + myinfo->dri_symtab_size;
-+
-+  if (bfd_seek (abfd, myinfo->tparel_pos, SEEK_SET) != 0)
-+    return FALSE;
-+
-+  if (bfd_bwrite (myinfo->tparel, myinfo->tparel_size, abfd)
-+      != myinfo->tparel_size)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Write the full exec header.
-+   This function must be called last to ensure that we have all the
-+   information needed to fill the MiNT-specific header fields.  */
-+
-+static bfd_boolean
-+write_exec_header (bfd *abfd, struct internal_exec *execp, struct external_exec *exec_bytes)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  bfd_size_type symtab_size;
-+
-+  bfd_h_put_16 (abfd, 0x601a, exec_bytes->g_branch);
-+
-+  /* The OS will load our extension header fields into the text segment.  */
-+  bfd_h_put_32 (abfd, execp->a_text + (EXEC_BYTES_SIZE - GEMDOS_HEADER_SIZE),
-+		exec_bytes->g_text);
-+  bfd_h_put_32 (abfd, execp->a_data, exec_bytes->g_data);
-+  bfd_h_put_32 (abfd, execp->a_bss, exec_bytes->g_bss);
-+
-+  /* The OS' notion of the size of the symbol table is another than
-+     the bfd library's.  We have to fill in the size of the table
-+     itself plus the size of the string table but only if we have not written
-+     a traditional symbol table.  If we have written a traditional symbol
-+     table we know the size.  */
-+  if (myinfo->dri_symtab_size != 0)
-+    symtab_size = myinfo->dri_symtab_size;
-+  else
-+    symtab_size = myinfo->tparel_pos - N_SYMOFF (*execp);
-+
-+  bfd_h_put_32 (abfd, symtab_size, exec_bytes->g_syms);
-+
-+  bfd_h_put_32 (abfd, 0x4d694e54, exec_bytes->g_extmagic);
-+  bfd_h_put_32 (abfd, myinfo->prg_flags, exec_bytes->g_flags);
-+  bfd_h_put_16 (abfd, 0, exec_bytes->g_abs);
-+
-+  /* Generate the jump instruction to the entry point.  In m68k
-+     assembler mnemnonics it looks more or less like this:
-+
-+       move.l  exec_bytes->e_entry(pc),d0
-+       jmp     -6(pc,d0.l)
-+
-+     Sorry for the wrong syntax.  As a real assembler addict I
-+     never actually use an assembler.  I edit my binaries manually
-+     with a hex editor, looks much cooler and it strengthens your
-+     abstraction abilities.  */
-+
-+  exec_bytes->g_jump_entry[0] = 0x20;
-+  exec_bytes->g_jump_entry[1] = 0x3a;
-+  exec_bytes->g_jump_entry[2] = 0x00;
-+  exec_bytes->g_jump_entry[3] = 0x1a;
-+  exec_bytes->g_jump_entry[4] = 0x4e;
-+  exec_bytes->g_jump_entry[5] = 0xfb;
-+  exec_bytes->g_jump_entry[6] = 0x08;
-+  exec_bytes->g_jump_entry[7] = 0xfa;
-+
-+  bfd_h_put_32 (abfd, myinfo->tparel_pos, exec_bytes->g_tparel_pos);
-+  bfd_h_put_32 (abfd, myinfo->tparel_size, exec_bytes->g_tparel_size);
-+  bfd_h_put_32 (abfd, myinfo->stkpos, exec_bytes->g_stkpos);
-+
-+  /* If there are no symbols, pretend they are in GNU format.  */
-+  if (symtab_size == 0)
-+    myinfo->symbol_format = _MINT_SYMBOL_FORMAT_GNU;
-+
-+  bfd_h_put_32 (abfd, myinfo->symbol_format, exec_bytes->g_symbol_format);
-+
-+  memset (&exec_bytes->g_pad0, 0, sizeof (exec_bytes->g_pad0));
-+
-+  /* The standard stuff.  */
-+  NAME(aout, swap_exec_header_out) (abfd, execp, exec_bytes);
-+  if (myinfo->symbol_format != _MINT_SYMBOL_FORMAT_GNU)
-+    PUT_WORD (abfd, 0, exec_bytes->e_syms);
-+
-+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
-+    return FALSE;
-+
-+  if (bfd_bwrite (exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
-+      != EXEC_BYTES_SIZE)
-+    return FALSE;
-+
-+  /* Override the stack size.  */
-+  if (myinfo->override_stack_size && myinfo->stkpos)
-+  {
-+    bfd_byte big_endian_stack_size[4];
-+
-+    bfd_put_32 (abfd, myinfo->stack_size, &big_endian_stack_size);
-+
-+    if (bfd_seek (abfd, (file_ptr) myinfo->stkpos, SEEK_SET) != 0)
-+      return FALSE;
-+
-+    if (bfd_bwrite (big_endian_stack_size, 4, abfd) != 4)
-+      return FALSE;
-+  }
-+
-+  return TRUE;
-+}
-+
-+/* Write an object file.
-+   Section contents have already been written.  We write the
-+   file header, symbols, and relocation.  */
-+
-+#define MY_write_object_contents m68kmint_prg_write_object_contents
-+
-+static bfd_boolean
-+m68kmint_prg_write_object_contents (bfd *abfd)
-+{
-+  struct external_exec exec_bytes;
-+  struct internal_exec *execp = exec_hdr (abfd);
-+  bfd_size_type text_size;
-+  file_ptr text_end;
-+
-+  BFD_ASSERT (obj_aout_ext (abfd) != NULL);
-+
-+  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-+
-+  /* Most of the following code come from the WRITE_HEADERS macro
-+     found in libaout.h.  */
-+
-+  if (adata(abfd).magic == undecided_magic)
-+    NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end);
-+
-+  execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE;
-+  execp->a_entry = bfd_get_start_address (abfd);
-+
-+  execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *
-+		     obj_reloc_entry_size (abfd));
-+  execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *
-+		     obj_reloc_entry_size (abfd));
-+
-+  /* Now write out reloc info, followed by syms and strings.  */
-+
-+  if (bfd_get_outsymbols (abfd) != NULL
-+      && bfd_get_symcount (abfd) != 0)
-+    {
-+      if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)
-+	return FALSE;
-+
-+      if (! NAME (aout, write_syms) (abfd))
-+	return FALSE;
-+    }
-+
-+  if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0)
-+    return FALSE;
-+  if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd)))
-+    return FALSE;
-+
-+  if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0)
-+    return FALSE;
-+  if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
-+    return FALSE;
-+
-+  if (write_tparel (abfd, execp) != TRUE)
-+    return FALSE;
-+
-+  if (write_exec_header (abfd, execp, &exec_bytes) != TRUE)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Print private BFD data. Used by objdump -p.  */
-+
-+#define MY_bfd_print_private_bfd_data m68kmint_prg_print_private_bfd_data
-+
-+static bfd_boolean
-+m68kmint_prg_print_private_bfd_data (bfd *abfd, void *ptr)
-+{
-+  FILE *file = (FILE *) ptr;
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  const char* symbol_format;
-+  long stksize = 0;
-+
-+  fprintf (file, "\n");
-+
-+  fprintf (file, " GEMDOS flags: 0x%08lx\n", (unsigned long) myinfo->prg_flags);
-+  fprintf (file, "Start address: 0x%08lx\n", bfd_get_start_address (abfd));
-+
-+  /* Stack size.  */
-+  if (myinfo->stkpos != 0)
-+    {
-+      if (bfd_seek (abfd, myinfo->stkpos, SEEK_SET) != 0
-+	  || (bfd_bread (&stksize, sizeof(long), abfd) != sizeof(long)))
-+	return FALSE;
-+
-+      stksize = bfd_get_signed_32 (abfd, &stksize);
-+    }
-+  fprintf (file, "   Stack size: %ld\n", stksize);
-+
-+  /* Symbol format.  */
-+  switch (myinfo->symbol_format)
-+    {
-+      case _MINT_SYMBOL_FORMAT_GNU: symbol_format = "stabs"; break;
-+      case _MINT_SYMBOL_FORMAT_DRI: symbol_format = "DRI";   break;
-+      default:			    symbol_format = "?";     break;
-+    }
-+  fprintf (file, "Symbol format: %s\n", symbol_format);
-+
-+  return TRUE;
-+}
-+
-+/* Special case for NAME (aout, get_section_contents)
-+   It is not declared in libaout.h, neither implemented in aoutx.h.
-+   Instead, a macro named aout_32_get_section_contents is defined in libaout.h.
-+   So the default value of MY_get_section_contents provided by aout-target.h
-+   is not correct, it has to be defined here with the right value.  */
-+
-+#define MY_get_section_contents aout_32_get_section_contents
-+
-+/* The following include will define m68kmint_prg_vec
-+   and a default implementation for all the MY_ functions
-+   not overriden here.  */
-+
-+#include "aout-target.h"
-+
-+/* Set the GEMDOS executable flags.
-+   It is called by the linker emulation script.  */
-+
-+bfd_boolean
-+bfd_m68kmint_set_extended_flags (bfd *abfd, flagword prg_flags)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  BFD_ASSERT(abfd->xvec == &m68kmint_prg_vec);
-+  myinfo = obj_aout_ext (abfd);
-+  BFD_ASSERT(myinfo != NULL);
-+
-+  myinfo->prg_flags = prg_flags;
-+
-+  return TRUE;
-+}
-+
-+/* Override the stack size.
-+   It is called by the linker emulation script.  */
-+
-+bfd_boolean
-+bfd_m68kmint_set_stack_size (bfd *abfd, bfd_signed_vma stack_size)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  BFD_ASSERT(abfd->xvec == &m68kmint_prg_vec);
-+  myinfo = obj_aout_ext (abfd);
-+  BFD_ASSERT(myinfo != NULL);
-+
-+  myinfo->stack_size = stack_size;
-+  myinfo->override_stack_size = TRUE;
-+
-+  return TRUE;
-+}
-+
-+/* Add a TPA relocation entry.
-+   It is called by BFD when linking the input sections, and by the
-+   linker when it generates a reference to an address (in particular,
-+   when building the constructors list).  */
-+
-+bfd_boolean
-+bfd_m68kmint_add_tpa_relocation_entry (bfd *abfd, bfd_vma address)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  BFD_ASSERT(abfd->xvec == &m68kmint_prg_vec);
-+  myinfo = obj_aout_ext (abfd);
-+  BFD_ASSERT(myinfo != NULL);
-+
-+  /* Enlarge the buffer if necessary.  */
-+  if (myinfo->relocs_used * sizeof (bfd_vma) >= myinfo->relocs_allocated)
-+    {
-+      bfd_vma *newbuf;
-+      myinfo->relocs_allocated += MINT_RELOC_CHUNKSIZE;
-+      newbuf = bfd_realloc (myinfo->relocs, myinfo->relocs_allocated);
-+      if (newbuf == NULL)
-+	return FALSE;
-+
-+      myinfo->relocs = newbuf;
-+    }
-+
-+  /* The TPA relative relocation actually just adds the address of
-+     the text segment (i. e. beginning of the executable in memory)
-+     to the addresses at the specified locations.  This allows an
-+     executable to be loaded everywhere in the address space without
-+     memory management.  */
-+  myinfo->relocs[myinfo->relocs_used++] = address;
-+
-+  return TRUE;
-+}
-diff -aurN binutils-2.21/bfd/targets.c binutils-2.21-mint-20110206/bfd/targets.c
---- binutils-2.21/bfd/targets.c	2010-10-22 14:08:28.000000000 +0200
-+++ binutils-2.21-mint-20110206/bfd/targets.c	2011-02-06 16:27:49.515625000 +0100
-@@ -763,6 +763,7 @@
- extern const bfd_target m68kcoff_vec;
- extern const bfd_target m68kcoffun_vec;
- extern const bfd_target m68klinux_vec;
-+extern const bfd_target m68kmint_prg_vec;
- extern const bfd_target m68knetbsd_vec;
- extern const bfd_target m68ksysvcoff_vec;
- extern const bfd_target m88kbcs_vec;
-diff -aurN binutils-2.21/binutils/configure binutils-2.21-mint-20110206/binutils/configure
---- binutils-2.21/binutils/configure	2010-11-05 11:32:55.000000000 +0100
-+++ binutils-2.21-mint-20110206/binutils/configure	2011-02-06 16:27:50.000000000 +0100
-@@ -13049,7 +13049,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
-  ;;
-diff -aurN binutils-2.21/binutils/dlltool.c binutils-2.21-mint-20110206/binutils/dlltool.c
---- binutils-2.21/binutils/dlltool.c	2010-10-30 19:14:02.000000000 +0200
-+++ binutils-2.21-mint-20110206/binutils/dlltool.c	2011-02-06 16:27:50.203125000 +0100
-@@ -4347,7 +4347,7 @@
-       if (*cp == '-')
- 	dash = cp;
-       if (
--#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__)
-+#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__) || defined(__MINT__)
- 	  *cp == ':' || *cp == '\\' ||
- #endif
- 	  *cp == '/')
-diff -aurN binutils-2.21/binutils/dllwrap.c binutils-2.21-mint-20110206/binutils/dllwrap.c
---- binutils-2.21/binutils/dllwrap.c	2010-07-15 09:58:47.000000000 +0200
-+++ binutils-2.21-mint-20110206/binutils/dllwrap.c	2011-02-06 16:27:50.203125000 +0100
-@@ -263,7 +263,7 @@
- 	dash = cp;
- 
-       if (
--#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__)
-+#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__) || defined(__MINT__)
- 	  *cp == ':' || *cp == '\\' ||
- #endif
- 	  *cp == '/')
-diff -aurN binutils-2.21/binutils/readelf.c binutils-2.21-mint-20110206/binutils/readelf.c
---- binutils-2.21/binutils/readelf.c	2010-11-02 15:36:35.000000000 +0100
-+++ binutils-2.21-mint-20110206/binutils/readelf.c	2011-02-06 16:27:50.218750000 +0100
-@@ -9879,7 +9879,11 @@
- #ifndef __MSVCRT__
- 	  /* PR 11128: Use two separate invocations in order to work
-              around bugs in the Solaris 8 implementation of printf.  */
-+#if GCC_VERSION < 3000
-+	  printf ("  [%6lx]  ", (unsigned long) (data - start));
-+#else
- 	  printf ("  [%6tx]  ", data - start);
-+#endif
- 	  printf ("%s\n", data);
- #else
- 	  printf ("  [%6Ix]  %s\n", (size_t) (data - start), data);
-diff -aurN binutils-2.21/binutils/resrc.c binutils-2.21-mint-20110206/binutils/resrc.c
---- binutils-2.21/binutils/resrc.c	2009-12-11 14:42:06.000000000 +0100
-+++ binutils-2.21-mint-20110206/binutils/resrc.c	2011-02-06 16:27:50.234375000 +0100
-@@ -396,7 +396,7 @@
-     *space = 0;
- 
-   if (
--#if defined (__DJGPP__) || defined (__CYGWIN__) || defined (_WIN32)
-+#if defined (__DJGPP__) || defined (__CYGWIN__) || defined (_WIN32) || defined (__MINT__)
-       strchr (cmd, '\\') ||
- #endif
-       strchr (cmd, '/'))
-@@ -514,7 +514,7 @@
- 	  if (*cp == '-')
- 	    dash = cp;
- 	  if (
--#if defined (__DJGPP__) || defined (__CYGWIN__) || defined(_WIN32)
-+#if defined (__DJGPP__) || defined (__CYGWIN__) || defined(_WIN32) || defined (__MINT__)
- 	      *cp == ':' || *cp == '\\' ||
- #endif
- 	      *cp == '/')
-diff -aurN binutils-2.21/gas/config/te-mint.h binutils-2.21-mint-20110206/gas/config/te-mint.h
---- binutils-2.21/gas/config/te-mint.h	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.21-mint-20110206/gas/config/te-mint.h	2011-02-06 16:27:50.312500000 +0100
-@@ -0,0 +1,30 @@
-+/* Copyright 2008 Free Software Foundation, Inc.
-+
-+   This file is part of GAS, the GNU Assembler.
-+
-+   GAS is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as
-+   published by the Free Software Foundation; either version 3,
-+   or (at your option) any later version.
-+
-+   GAS is distributed in the hope that it will be useful, but
-+   WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-+   the GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with GAS; see the file COPYING.  If not, write to the Free
-+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
-+   02110-1301, USA.  */
-+
-+#define TE_MINT
-+
-+#define LOCAL_LABELS_DOLLAR 1
-+#define LOCAL_LABELS_FB 1
-+
-+/* These define interfaces.  */
-+#ifdef   OBJ_HEADER
-+#include OBJ_HEADER
-+#else
-+#include "obj-format.h"
-+#endif
-diff -aurN binutils-2.21/gas/configure.tgt binutils-2.21-mint-20110206/gas/configure.tgt
---- binutils-2.21/gas/configure.tgt	2010-12-01 12:03:20.000000000 +0100
-+++ binutils-2.21-mint-20110206/gas/configure.tgt	2011-02-06 16:27:50.312500000 +0100
-@@ -266,6 +266,7 @@
-   m68k-*-linux-*)			fmt=elf em=linux ;;
-   m68k-*-uclinux*)			fmt=elf em=uclinux ;;
-   m68k-*-gnu*)				fmt=elf ;;
-+  m68k-*-mint*)				fmt=aout em=mint bfd_gas=yes ;;
-   m68k-*-netbsdelf*)			fmt=elf em=nbsd ;;
-   m68k-*-netbsd*)			fmt=aout em=nbsd bfd_gas=yes ;;
-   m68k-*-openbsd*)			fmt=aout em=nbsd bfd_gas=yes ;;
-diff -aurN binutils-2.21/gas/testsuite/gas/all/weakref1u.d binutils-2.21-mint-20110206/gas/testsuite/gas/all/weakref1u.d
---- binutils-2.21/gas/testsuite/gas/all/weakref1u.d	2009-10-18 09:43:04.000000000 +0200
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/all/weakref1u.d	2011-02-06 16:27:50.328125000 +0100
-@@ -3,7 +3,7 @@
- #source: weakref1.s
- # aout turns undefined into *ABS* symbols.
- # see weakref1.d for comments on the other not-targets
--#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* ns32k-*-netbsd alpha*-*-osf* *-*-ecoff
-+#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* m68k-*-mint* ns32k-*-netbsd alpha*-*-osf* *-*-ecoff
- 
- # the rest of this file is generated with the following script:
- # # script begin
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/all.exp binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/all.exp
---- binutils-2.21/gas/testsuite/gas/m68k/all.exp	2010-09-23 14:15:55.000000000 +0200
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/all.exp	2011-02-06 16:27:50.343750000 +0100
-@@ -71,9 +71,10 @@
- 
-     gas_test_error "p11673.s" "-march=isab" "movel immediate with offset unsupported on isab"
- 
--    if { [istarget *-*-netbsd] } then {
-+    if { [istarget *-*-*aout] || [istarget *-*-netbsd] || [istarget *-*-openbsd*] || [istarget *-*-mint*] } then {
-       run_dump_test p3041
-       run_dump_test p3041data
-+      run_dump_test p3041pcrel
-     }
- 
-     set testname "68000 operands"
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/br-isaa.d binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/br-isaa.d
---- binutils-2.21/gas/testsuite/gas/m68k/br-isaa.d	2009-10-18 09:43:04.000000000 +0200
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/br-isaa.d	2011-02-06 16:27:50.359375000 +0100
-@@ -1,7 +1,7 @@
- #name: br-isaa.d
- #objdump: -dr
- #as: -march=isaa -pcrel
--#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd*
-+#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* m68k-*-mint*
- 
- .*:     file format .*
- 
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/br-isab.d binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/br-isab.d
---- binutils-2.21/gas/testsuite/gas/m68k/br-isab.d	2009-10-18 09:43:04.000000000 +0200
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/br-isab.d	2011-02-06 16:27:50.375000000 +0100
-@@ -1,7 +1,7 @@
- #name: br-isab.d
- #objdump: -dr
- #as: -march=isab -pcrel
--#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd*
-+#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* m68k-*-mint*
- 
- .*:     file format .*
- 
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/br-isac.d binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/br-isac.d
---- binutils-2.21/gas/testsuite/gas/m68k/br-isac.d	2009-10-18 09:43:04.000000000 +0200
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/br-isac.d	2011-02-06 16:27:50.375000000 +0100
-@@ -1,7 +1,7 @@
- #name: br-isac.d
- #objdump: -dr
- #as: -march=isac -pcrel
--#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd*
-+#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* m68k-*-mint*
- 
- .*:     file format .*
- 
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/cpu32.d binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/cpu32.d
---- binutils-2.21/gas/testsuite/gas/m68k/cpu32.d	2007-05-15 11:21:24.000000000 +0200
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/cpu32.d	2011-02-06 16:27:50.390625000 +0100
-@@ -1,5 +1,5 @@
- #name: cpu32
--#objdump: -d
-+#objdump: --architecture=m68k:cpu32 -d
- #as: -mcpu32
- 
- .*:     file format .*
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/mcf-coproc.d binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/mcf-coproc.d
---- binutils-2.21/gas/testsuite/gas/m68k/mcf-coproc.d	2007-07-03 09:54:19.000000000 +0200
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/mcf-coproc.d	2011-02-06 16:27:50.390625000 +0100
-@@ -1,4 +1,4 @@
--#objdump: -d
-+#objdump: --architecture=m68k:547x -d
- #as: -mcpu=5475
- 
- .*:     file format .*
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/mcf-wdebug.d binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/mcf-wdebug.d
---- binutils-2.21/gas/testsuite/gas/m68k/mcf-wdebug.d	2007-06-18 18:10:27.000000000 +0200
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/mcf-wdebug.d	2011-02-06 16:27:50.406250000 +0100
-@@ -1,5 +1,5 @@
- #name: mcf-wdebug
--#objdump: -d
-+#objdump: --architecture=m68k:5200 -d
- #as: -m5208
- 
- .*:     file format .*
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/p3041pcrel.d binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/p3041pcrel.d
---- binutils-2.21/gas/testsuite/gas/m68k/p3041pcrel.d	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/p3041pcrel.d	2011-02-06 16:27:50.421875000 +0100
-@@ -0,0 +1,38 @@
-+#name: PR 3041 pcrel
-+#as: -m68000
-+#objdump: -tdr
-+
-+.*:     file format .*
-+
-+SYMBOL TABLE:
-+00000024  w      \.text 0000 00 0f mytext
-+0000002e  w      \.data 0000 00 10 mydata
-+0000003a  w      \.bss  0000 00 11 mybss
-+
-+Disassembly of section \.text:
-+
-+00000000 <.*>:
-+   0:	41fa fffe      	lea %pc@\(0 <.*>\),%a0
-+			2: DISP16	mytext
-+   4:	41fa fffc      	lea %pc@\(2 <.*>\),%a0
-+			6: DISP16	mytext
-+   8:	41fa fff2      	lea %pc@\(fffffffc <.*>\),%a0
-+			a: DISP16	mytext
-+   c:	41fa fff2      	lea %pc@\(0 <.*>\),%a0
-+			e: DISP16	mydata
-+  10:	41fa fff1      	lea %pc@\(3 <.*>\),%a0
-+			12: DISP16	mydata
-+  14:	41fa ffe9      	lea %pc@\(ffffffff <.*>\),%a0
-+			16: DISP16	mydata
-+  18:	41fa ffe6      	lea %pc@\(0 <.*>\),%a0
-+			1a: DISP16	mybss
-+  1c:	41fa ffe3      	lea %pc@\(1 <.*>\),%a0
-+			1e: DISP16	mybss
-+  20:	41fa ffdc      	lea %pc@\(fffffffe <.*>\),%a0
-+			22: DISP16	mybss
-+
-+00000024 <mytext>:
-+  24:	4e71           	nop
-+  26:	4e71           	nop
-+  28:	4e71           	nop
-+  2a:	4e71           	nop
-diff -aurN binutils-2.21/gas/testsuite/gas/m68k/p3041pcrel.s binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/p3041pcrel.s
---- binutils-2.21/gas/testsuite/gas/m68k/p3041pcrel.s	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.21-mint-20110206/gas/testsuite/gas/m68k/p3041pcrel.s	2011-02-06 16:27:50.437500000 +0100
-@@ -0,0 +1,28 @@
-+	lea	mytext(%pc),%a0
-+	lea	mytext+2(%pc),%a0
-+	lea	mytext-4(%pc),%a0
-+	lea	mydata(%pc),%a0
-+	lea	mydata+3(%pc),%a0
-+	lea	mydata-1(%pc),%a0
-+	lea	mybss(%pc),%a0
-+	lea	mybss+1(%pc),%a0
-+	lea	mybss-2(%pc),%a0
-+	.weak	mytext
-+mytext:
-+	nop
-+	nop
-+	nop
-+	nop
-+
-+	.data
-+	.word	0x8081
-+	.weak	mydata
-+mydata:
-+	.word	0x8283
-+	.word	0x8485
-+
-+	.bss
-+	.skip	6
-+	.weak	mybss
-+mybss:
-+	.skip	2
-diff -aurN binutils-2.21/gprof/corefile.c binutils-2.21-mint-20110206/gprof/corefile.c
---- binutils-2.21/gprof/corefile.c	2010-07-16 16:52:15.000000000 +0200
-+++ binutils-2.21-mint-20110206/gprof/corefile.c	2011-02-06 16:30:48.015625000 +0100
-@@ -678,7 +678,7 @@
- 	  }
-       }
- 
--      symtab.limit->is_func = (core_syms[i]->flags & BSF_FUNCTION) != 0; 
-+      symtab.limit->is_func = TRUE; 
-       symtab.limit->is_bb_head = TRUE;
- 
-       if (cxxclass == 't')
-diff -aurN binutils-2.21/include/filenames.h binutils-2.21-mint-20110206/include/filenames.h
---- binutils-2.21/include/filenames.h	2010-04-26 20:04:23.000000000 +0200
-+++ binutils-2.21-mint-20110206/include/filenames.h	2011-02-06 16:27:50.453125000 +0100
-@@ -30,7 +30,7 @@
- extern "C" {
- #endif
- 
--#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
-+#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) || defined (__MINT__)
- #  ifndef HAVE_DOS_BASED_FILE_SYSTEM
- #    define HAVE_DOS_BASED_FILE_SYSTEM 1
- #  endif
-diff -aurN binutils-2.21/include/getopt.h binutils-2.21-mint-20110206/include/getopt.h
---- binutils-2.21/include/getopt.h	2005-05-10 12:21:08.000000000 +0200
-+++ binutils-2.21-mint-20110206/include/getopt.h	2011-02-06 16:27:50.453125000 +0100
-@@ -106,7 +106,7 @@
-    to find the declaration so provide a fully prototyped one.  If it
-    is 1, we found it so don't provide any declaration at all.  */
- #if !HAVE_DECL_GETOPT
--#if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT)
-+#if defined (__GNU_LIBRARY__) || defined (__MINT__) || defined (HAVE_DECL_GETOPT)
- /* Many other libraries have conflicting prototypes for getopt, with
-    differences in the consts, in unistd.h.  To avoid compilation
-    errors, only prototype getopt for the GNU C library.  */
-diff -aurN binutils-2.21/ld/Makefile.am binutils-2.21-mint-20110206/ld/Makefile.am
---- binutils-2.21/ld/Makefile.am	2010-11-03 04:22:01.000000000 +0100
-+++ binutils-2.21-mint-20110206/ld/Makefile.am	2011-02-06 16:27:50.671875000 +0100
-@@ -300,6 +300,7 @@
- 	em68kelf.c \
- 	em68kelfnbsd.c \
- 	em68klinux.c \
-+	em68kmint.c \
- 	em68knbsd.c \
- 	em68kpsos.c \
- 	em88kbcs.c \
-@@ -1394,6 +1395,10 @@
- em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \
-   $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68klinux "$(tdir_m68klinux)"
-+em68kmint.c: $(srcdir)/emulparams/m68kmint.sh \
-+  $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/mint.em \
-+  $(srcdir)/scripttempl/m68kmint.sc ${GEN_DEPENDS}
-+	${GENSCRIPTS} m68kmint "$(tdir_m68kmint)"
- em68knbsd.c:	$(srcdir)/emulparams/m68knbsd.sh \
-   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)"
-diff -aurN binutils-2.21/ld/Makefile.in binutils-2.21-mint-20110206/ld/Makefile.in
---- binutils-2.21/ld/Makefile.in	2010-11-05 11:34:22.000000000 +0100
-+++ binutils-2.21-mint-20110206/ld/Makefile.in	2011-02-06 16:27:50.718750000 +0100
-@@ -600,6 +600,7 @@
- 	em68kelf.c \
- 	em68kelfnbsd.c \
- 	em68klinux.c \
-+	em68kmint.c \
- 	em68knbsd.c \
- 	em68kpsos.c \
- 	em88kbcs.c \
-@@ -1199,6 +1200,7 @@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68kelf.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68kelfnbsd.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68klinux.Po@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68kmint.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68knbsd.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68kpsos.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em88kbcs.Po@am__quote@
-@@ -2817,6 +2819,10 @@
- em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \
-   $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68klinux "$(tdir_m68klinux)"
-+em68kmint.c: $(srcdir)/emulparams/m68kmint.sh \
-+  $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/mint.em \
-+  $(srcdir)/scripttempl/m68kmint.sc ${GEN_DEPENDS}
-+	${GENSCRIPTS} m68kmint "$(tdir_m68kmint)"
- em68knbsd.c:	$(srcdir)/emulparams/m68knbsd.sh \
-   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)"
-diff -aurN binutils-2.21/ld/configure binutils-2.21-mint-20110206/ld/configure
---- binutils-2.21/ld/configure	2010-11-23 14:50:32.000000000 +0100
-+++ binutils-2.21-mint-20110206/ld/configure	2011-02-06 16:27:51.234375000 +0100
-@@ -12978,7 +12978,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
-  ;;
-diff -aurN binutils-2.21/ld/configure.tgt binutils-2.21-mint-20110206/ld/configure.tgt
---- binutils-2.21/ld/configure.tgt	2010-12-01 12:03:47.000000000 +0100
-+++ binutils-2.21-mint-20110206/ld/configure.tgt	2011-02-06 16:27:51.437500000 +0100
-@@ -343,6 +343,7 @@
- 			tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` ;;
- m68k-*-uclinux*)	targ_emul=m68kelf ;;
- m68*-*-gnu*)		targ_emul=m68kelf ;;
-+m68*-*-mint*)		targ_emul=m68kmint ;;
- m68*-*-netbsd*4k*)	targ_emul=m68k4knbsd
- 			targ_extra_emuls="m68knbsd m68kelfnbsd" ;;
- m68*-*-netbsdelf*)	targ_emul=m68kelfnbsd
-diff -aurN binutils-2.21/ld/emulparams/m68kmint.sh binutils-2.21-mint-20110206/ld/emulparams/m68kmint.sh
---- binutils-2.21/ld/emulparams/m68kmint.sh	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.21-mint-20110206/ld/emulparams/m68kmint.sh	2011-02-06 16:27:51.437500000 +0100
-@@ -0,0 +1,6 @@
-+SCRIPT_NAME=m68kmint
-+OUTPUT_FORMAT="a.out-mintprg"
-+RELOCATEABLE_OUTPUT_FORMAT="a.out-zero-big"
-+TEXT_START_ADDR=0xe4
-+ARCH=m68k
-+EXTRA_EM_FILE=mint
-diff -aurN binutils-2.21/ld/emultempl/generic.em binutils-2.21-mint-20110206/ld/emultempl/generic.em
---- binutils-2.21/ld/emultempl/generic.em	2009-09-02 09:25:35.000000000 +0200
-+++ binutils-2.21-mint-20110206/ld/emultempl/generic.em	2011-02-06 16:27:51.453125000 +0100
-@@ -138,8 +138,8 @@
-   ${LDEMUL_PLACE_ORPHAN-NULL},
-   ${LDEMUL_SET_SYMBOLS-NULL},
-   ${LDEMUL_PARSE_ARGS-NULL},
--  NULL,	/* add_options */
--  NULL,	/* handle_option */
-+  ${LDEMUL_ADD_OPTIONS-NULL},
-+  ${LDEMUL_HANDLE_OPTION-NULL},
-   ${LDEMUL_UNRECOGNIZED_FILE-NULL},
-   ${LDEMUL_LIST_OPTIONS-NULL},
-   ${LDEMUL_RECOGNIZED_FILE-NULL},
-diff -aurN binutils-2.21/ld/emultempl/mint.em binutils-2.21-mint-20110206/ld/emultempl/mint.em
---- binutils-2.21/ld/emultempl/mint.em	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.21-mint-20110206/ld/emultempl/mint.em	2011-02-06 16:27:51.468750000 +0100
-@@ -0,0 +1,330 @@
-+# This shell script emits a C file. -*- C -*-
-+#   Copyright 2006, 2007 Free Software Foundation, Inc.
-+#
-+# This file is part of the GNU Binutils.
-+#
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-+# MA 02110-1301, USA.
-+#
-+
-+# This file is sourced from generic.em
-+#
-+fragment <<EOF
-+
-+#include "getopt.h"
-+#include "ldgram.h"
-+
-+/* Standard GEMDOS program flags.  */
-+#define _MINT_F_FASTLOAD      0x01    /* Don't clear heap.  */
-+#define _MINT_F_ALTLOAD       0x02    /* OK to load in alternate RAM.  */
-+#define _MINT_F_ALTALLOC      0x04    /* OK to malloc from alt. RAM.  */
-+#define _MINT_F_BESTFIT       0x08    /* Load with optimal heap size.  */
-+/* The memory flags are mutually exclusive.  */
-+#define _MINT_F_MEMPROTECTION 0xf0    /* Masks out protection bits.  */
-+#define _MINT_F_MEMPRIVATE    0x00    /* Memory is private.  */
-+#define _MINT_F_MEMGLOBAL     0x10    /* Read/write access to mem allowed.  */
-+#define _MINT_F_MEMSUPER      0x20    /* Only supervisor access allowed.  */
-+#define _MINT_F_MEMREADABLE   0x30    /* Any read access OK.  */
-+#define _MINT_F_SHTEXT        0x800   /* Program's text may be shared */
-+
-+/* Option flags.  */
-+static flagword prg_flags = (_MINT_F_FASTLOAD | _MINT_F_ALTLOAD
-+			     | _MINT_F_ALTALLOC | _MINT_F_MEMPRIVATE);
-+
-+/* If override_stack_size is TRUE, then the executable stack size
-+ * must be overriden with the value of stack_size.  */
-+static bfd_boolean override_stack_size = FALSE;
-+static bfd_signed_vma stack_size;
-+
-+/* MiNT format extra command line options.  */
-+
-+/* Used for setting flags in the MiNT header.  */
-+#define OPTION_FASTLOAD (300)
-+#define OPTION_NO_FASTLOAD (OPTION_FASTLOAD + 1)
-+#define OPTION_FASTRAM (OPTION_NO_FASTLOAD + 1)
-+#define OPTION_NO_FASTRAM (OPTION_FASTRAM + 1)
-+#define OPTION_FASTALLOC (OPTION_NO_FASTRAM + 1)
-+#define OPTION_NO_FASTALLOC (OPTION_FASTALLOC + 1)
-+#define OPTION_BESTFIT (OPTION_NO_FASTALLOC + 1)
-+#define OPTION_NO_BESTFIT (OPTION_BESTFIT + 1)
-+#define OPTION_BASEREL (OPTION_NO_BESTFIT + 1)
-+#define OPTION_NO_BASEREL (OPTION_BASEREL + 1)
-+#define OPTION_MEM_PRIVATE (OPTION_NO_BASEREL + 1)
-+#define OPTION_MEM_GLOBAL (OPTION_MEM_PRIVATE + 1)
-+#define OPTION_MEM_SUPER (OPTION_MEM_GLOBAL + 1)
-+#define OPTION_MEM_READONLY (OPTION_MEM_SUPER + 1)
-+#define OPTION_PRG_FLAGS (OPTION_MEM_READONLY + 1)
-+#define OPTION_STACK (OPTION_PRG_FLAGS + 1)
-+
-+static void
-+gld${EMULATION_NAME}_add_options
-+  (int ns ATTRIBUTE_UNUSED, char **shortopts ATTRIBUTE_UNUSED, int nl,
-+    struct option **longopts, int nrl ATTRIBUTE_UNUSED,
-+    struct option **really_longopts ATTRIBUTE_UNUSED)
-+{
-+  static const struct option xtra_long[] = {
-+    {"mfastload", no_argument, NULL, OPTION_FASTLOAD},
-+    {"mno-fastload", no_argument, NULL, OPTION_NO_FASTLOAD},
-+    {"mfastram", no_argument, NULL, OPTION_FASTRAM},
-+    {"mno-fastram", no_argument, NULL, OPTION_NO_FASTRAM},
-+    {"maltram", no_argument, NULL, OPTION_FASTRAM},
-+    {"mno-altram", no_argument, NULL, OPTION_NO_FASTRAM},
-+    {"mfastalloc", no_argument, NULL, OPTION_FASTALLOC},
-+    {"mno-fastalloc", no_argument, NULL, OPTION_NO_FASTALLOC},
-+    {"maltalloc", no_argument, NULL, OPTION_FASTALLOC},
-+    {"mno-altalloc", no_argument, NULL, OPTION_NO_FASTALLOC},
-+    {"mbest-fit", no_argument, NULL, OPTION_BESTFIT},
-+    {"mno-best-fit", no_argument, NULL, OPTION_NO_BESTFIT},
-+    {"mbaserel", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-baserel", no_argument, NULL, OPTION_NO_BASEREL},
-+    {"mshared-text", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-shared-text", no_argument, NULL, OPTION_NO_BASEREL},
-+    {"msharable-text", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-sharable-text", no_argument, NULL, OPTION_NO_BASEREL},
-+    /* Memory protection bits.  */
-+    {"mprivate-memory", no_argument, NULL, OPTION_MEM_PRIVATE },
-+    {"mglobal-memory", no_argument, NULL, OPTION_MEM_GLOBAL},
-+    {"msuper-memory", no_argument, NULL, OPTION_MEM_SUPER},
-+    {"mreadable-memory", no_argument, NULL, OPTION_MEM_READONLY},
-+    {"mreadonly-memory", no_argument, NULL, OPTION_MEM_READONLY},
-+    {"mprg-flags", required_argument, NULL, OPTION_PRG_FLAGS},
-+    {"stack", required_argument, NULL, OPTION_STACK},
-+    {NULL, no_argument, NULL, 0}
-+  };
-+
-+  *longopts = (struct option *)
-+    xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
-+  memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
-+}
-+
-+static bfd_boolean
-+gld${EMULATION_NAME}_handle_option (int optc)
-+{
-+  switch (optc)
-+    {
-+    default:
-+      return FALSE;
-+
-+    case OPTION_FASTLOAD:
-+      prg_flags |= _MINT_F_FASTLOAD;
-+      break;
-+
-+    case OPTION_NO_FASTLOAD:
-+      prg_flags &= ~_MINT_F_FASTLOAD;
-+      break;
-+
-+    case OPTION_FASTRAM:
-+      prg_flags |= _MINT_F_ALTLOAD;
-+      break;
-+
-+    case OPTION_NO_FASTRAM:
-+      prg_flags &= ~_MINT_F_ALTLOAD;
-+      break;
-+
-+    case OPTION_FASTALLOC:
-+      prg_flags |= _MINT_F_ALTALLOC;
-+      break;
-+
-+    case OPTION_NO_FASTALLOC:
-+      prg_flags &= ~_MINT_F_ALTALLOC;
-+      break;
-+
-+    case OPTION_BESTFIT:
-+      prg_flags |= _MINT_F_BESTFIT;
-+      break;
-+
-+    case OPTION_NO_BESTFIT:
-+      prg_flags &= ~_MINT_F_BESTFIT;
-+      break;
-+
-+    case OPTION_BASEREL:
-+      prg_flags |= _MINT_F_SHTEXT;
-+      break;
-+
-+    case OPTION_NO_BASEREL:
-+      prg_flags &= ~_MINT_F_SHTEXT;
-+      break;
-+
-+    case OPTION_MEM_PRIVATE:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      break;
-+
-+    case OPTION_MEM_GLOBAL:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMPRIVATE;
-+      break;
-+
-+    case OPTION_MEM_SUPER:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMSUPER;
-+      break;
-+
-+    case OPTION_MEM_READONLY:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMREADABLE;
-+      break;
-+
-+    case OPTION_PRG_FLAGS:
-+      {
-+	char* tail;
-+	unsigned long flag_value = strtoul (optarg, &tail, 0);
-+
-+	if (*tail != '\0')
-+	  einfo (_("%P: warning: ignoring invalid program flags %s\n"), optarg);
-+	else
-+	  prg_flags = flag_value;
-+
-+	break;
-+      }
-+    case OPTION_STACK:
-+      {
-+	char* tail;
-+	long size = strtol (optarg, &tail, 0);
-+
-+	if (*tail == 'K' || *tail == 'k')
-+	  {
-+	    size *= 1024;
-+	    ++tail;
-+	  }
-+	else if (*tail == 'M' || *tail == 'm')
-+	  {
-+	    size *= 1024*1024;
-+	    ++tail;
-+	  }
-+
-+	if (*tail != '\0')
-+	  einfo (_("%P: warning: ignoring invalid stack size %s\n"), optarg);
-+	else
-+	{
-+	  stack_size = (bfd_signed_vma) size;
-+	  override_stack_size = TRUE;
-+	}
-+
-+	break;
-+      }
-+    }
-+  return TRUE;
-+}
-+
-+/* This callback is called when ld is invoked
-+   with the --help and --target-help options.  */
-+
-+static void
-+gld_${EMULATION_NAME}_list_options (FILE *file)
-+{
-+  fprintf (file, _("  --m[no-]fastload            Enable/Disable not cleaning the heap on startup\n"));
-+  fprintf (file, _("  --m[no-]altram, --m[no-]fastram\n"));
-+  fprintf (file, _("                              Enable/Disable loading into alternate RAM\n"));
-+  fprintf (file, _("  --m[no-]altalloc, --m[no-]fastalloc\n"));
-+  fprintf (file, _("                              Enable/Disable malloc from alternate RAM\n"));
-+  fprintf (file, _("  --m[no-]best-fit            Enable/Disable loading with optimal heap size\n"));
-+  fprintf (file, _("  --m[no-]sharable-text, --m[no-]shared-text, --m[no-]baserel\n"));
-+  fprintf (file, _("                              Enable/Disable sharing the text segment\n"));
-+  fprintf (file, "\n");
-+  fprintf (file, _("The following memory options are mutually exclusive:\n"));
-+  fprintf (file, _("  --mprivate-memory           Process memory is not accessible\n"));
-+  fprintf (file, _("  --mglobal-memory            Process memory is readable and writable\n"));
-+  fprintf (file, _("  --msuper-memory             Process memory is accessible in supervisor mode\n"));
-+  fprintf (file, _("  --mreadonly-memory, --mreadable-memory\n"));
-+  fprintf (file, _("                              Process memory is readable but not writable\n"));
-+  fprintf (file, "\n");
-+  fprintf (file, _("  --mprg-flags <value>        Set all the flags with an integer raw value\n"));
-+  fprintf (file, _("  --stack <size>              Override the stack size (suffix k or M allowed)\n"));
-+}
-+
-+/* This callback is called by lang_for_each_statement. It checks that the
-+   output sections speficied in the linker script are compatible with the MiNT
-+   executable format.  */
-+
-+static void
-+gld${EMULATION_NAME}_check_output_sections (lang_statement_union_type *s)
-+{
-+  if (s->header.type == lang_output_section_statement_enum)
-+    {
-+      lang_output_section_statement_type *oss = &s->output_section_statement;
-+
-+      if (strcmp(oss->name, ".text") == 0 && oss->bfd_section->vma != ${TEXT_START_ADDR})
-+	einfo (_("%F%P: the VMA of section %A must be 0x%V, but actual value is 0x%V\n"),
-+	  oss->bfd_section, ${TEXT_START_ADDR}, oss->bfd_section->vma);
-+      else if (strcmp(oss->name, ".data") == 0 && oss->addr_tree != NULL)
-+	einfo (_("%F%P: the VMA of section %A must not be specified\n"),
-+	  oss->bfd_section);
-+      else if (strcmp(oss->name, ".bss") == 0 && oss->addr_tree != NULL)
-+	einfo (_("%F%P: the VMA of section %A must not be specified\n"),
-+	  oss->bfd_section);
-+    }
-+}
-+
-+/* This callback is called by lang_for_each_statement. It looks for the data
-+   statements of type REL generated by the linker, and adds a TPA relocation
-+   entry for them. This is used by the CONSTRUCTORS list.  */
-+
-+static void
-+gld${EMULATION_NAME}_add_tpa_relocs (lang_statement_union_type *s)
-+{
-+  if (s->header.type == lang_data_statement_enum)
-+    {
-+      lang_data_statement_type *ds = &s->data_statement;
-+
-+      if (ds->exp->type.node_code == REL)
-+	{
-+	  if (ds->type == LONG)
-+	    {
-+	      bfd_vma tpa_address = ds->output_section->vma + ds->output_offset;
-+	      if (!bfd_m68kmint_add_tpa_relocation_entry(link_info.output_bfd, tpa_address))
-+		einfo (_("%F%P:%B: unable to add a relocation entry\n"), link_info.output_bfd);
-+	    }
-+	    else
-+	    {
-+	      einfo (_("%F%P:%B: invalid size for TPA relocation entry in section %A, offset 0x%V\n"),
-+		link_info.output_bfd, ds->output_section, ds->output_offset);
-+	    }
-+	}
-+    }
-+}
-+
-+/* Final emulation specific call.  */
-+
-+static void
-+gld${EMULATION_NAME}_finish (void)
-+{
-+  /* Do nothing if we are not generating a MiNT executable (ex: binary).  */
-+  if (strcmp (bfd_get_target (link_info.output_bfd), "${OUTPUT_FORMAT}") != 0)
-+    return;
-+
-+  /* Check the output sections.  */
-+  lang_for_each_statement (gld${EMULATION_NAME}_check_output_sections);
-+
-+  /* Set the GEMDOS executable header flags.  */
-+  if (!bfd_m68kmint_set_extended_flags (link_info.output_bfd, prg_flags))
-+    einfo (_("%F%P:%B: unable to set the header flags\n"), link_info.output_bfd);
-+
-+  /* Override the stack size.  */
-+  if (override_stack_size)
-+    if (!bfd_m68kmint_set_stack_size (link_info.output_bfd, stack_size))
-+      einfo (_("%F%P:%B: unable to set the stack size\n"), link_info.output_bfd);
-+
-+  /* Generate TPA relocation entries for the data statements.  */
-+  lang_for_each_statement (gld${EMULATION_NAME}_add_tpa_relocs);
-+}
-+
-+EOF
-+
-+# Put these extra routines in ld_${EMULATION_NAME}_emulation
-+#
-+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
-+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
-+LDEMUL_LIST_OPTIONS=gld_${EMULATION_NAME}_list_options
-+LDEMUL_FINISH=gld${EMULATION_NAME}_finish
-diff -aurN binutils-2.21/ld/scripttempl/m68kmint.sc binutils-2.21-mint-20110206/ld/scripttempl/m68kmint.sc
---- binutils-2.21/ld/scripttempl/m68kmint.sc	1970-01-01 01:00:00.000000000 +0100
-+++ binutils-2.21-mint-20110206/ld/scripttempl/m68kmint.sc	2011-02-06 16:27:51.484375000 +0100
-@@ -0,0 +1,35 @@
-+cat <<EOF
-+${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
-+${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
-+${RELOCATING+${LIB_SEARCH_DIRS}}
-+SECTIONS
-+{
-+  ${RELOCATING+/* The VMA of the .text section is ${TEXT_START_ADDR} instead of 0
-+     because the extended MiNT header is just before,
-+     at the beginning of the TEXT segment.  */}
-+  .text ${RELOCATING+${TEXT_START_ADDR}}:
-+  {
-+    CREATE_OBJECT_SYMBOLS
-+    *(.text)
-+    ${CONSTRUCTING+CONSTRUCTORS}
-+    ${RELOCATING+_etext = .;}
-+    ${RELOCATING+__etext = .;}
-+  }
-+
-+  .data :
-+  {
-+    *(.data)
-+    ${RELOCATING+_edata = .;}
-+    ${RELOCATING+__edata = .;}
-+  }
-+
-+  .bss :
-+  {
-+    ${RELOCATING+__bss_start = .;}
-+    *(.bss)
-+    *(COMMON)
-+    ${RELOCATING+_end = .;}
-+    ${RELOCATING+__end = .;}
-+  }
-+}
-+EOF
-diff -aurN binutils-2.21/libiberty/hex.c binutils-2.21-mint-20110206/libiberty/hex.c
---- binutils-2.21/libiberty/hex.c	2007-01-31 21:25:23.000000000 +0100
-+++ binutils-2.21-mint-20110206/libiberty/hex.c	2011-02-06 16:27:51.484375000 +0100
-@@ -24,7 +24,7 @@
- #include "libiberty.h"
- #include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
- 
--#if EOF != -1
-+#if !(EOF == -1)	/* gcc 2.95.3 has bug in '!=' operator for negative constants */
-  #error "hex.c requires EOF == -1"
- #endif
- 
-diff -aurN binutils-2.21/libiberty/safe-ctype.c binutils-2.21-mint-20110206/libiberty/safe-ctype.c
---- binutils-2.21/libiberty/safe-ctype.c	2005-05-10 17:33:33.000000000 +0200
-+++ binutils-2.21-mint-20110206/libiberty/safe-ctype.c	2011-02-06 16:27:51.500000000 +0100
-@@ -119,7 +119,7 @@
- #include <safe-ctype.h>
- #include <stdio.h>  /* for EOF */
- 
--#if EOF != -1
-+#if !(EOF == -1)	/* gcc 2.95.3 has bug in '!=' operator for negative constants */
-  #error "<safe-ctype.h> requires EOF == -1"
- #endif
- 
-diff -aurN binutils-2.21/libiberty/configure binutils-2.21-mint-20110206/libiberty/configure
---- binutils-2.21/libiberty/configure	2009-09-08 18:11:46.000000000 +0100
-+++ binutils-2.21-mint-20110206/libiberty/configure	2009-10-22 16:39:46.000000000 +0100
-@@ -4844,6 +4844,7 @@
- if [ "${shared}" = "yes" ]; then
-   case "${host}" in
-     *-*-cygwin*)	;;
-+    *-*-mint*)		;;
-     alpha*-*-linux*)	PICFLAG=-fPIC ;;
-     arm*-*-*)		PICFLAG=-fPIC ;;
-     hppa*-*-*)		PICFLAG=-fPIC ;;
-diff -aurN binutils-2.21/libiberty/configure.ac binutils-2.21-mint-20110206/libiberty/configure.ac
---- binutils-2.21/libiberty/configure.ac	2009-09-08 18:11:46.000000000 +0100
-+++ binutils-2.21-mint-20110206/libiberty/configure.ac	2009-10-22 16:39:46.000000000 +0100
-@@ -201,6 +201,7 @@
- if [[ "${shared}" = "yes" ]]; then
-   case "${host}" in
-     *-*-cygwin*)	;;
-+    *-*-mint*)		;;
-     alpha*-*-linux*)	PICFLAG=-fPIC ;;
-     arm*-*-*)		PICFLAG=-fPIC ;;
-     hppa*-*-*)		PICFLAG=-fPIC ;;

diff --git a/sys-devel/binutils/files/binutils-2.21.53.0.2-mint.patch b/sys-devel/binutils/files/binutils-2.21.53.0.2-mint.patch
deleted file mode 100644
index ba41a3541a..0000000000
--- a/sys-devel/binutils/files/binutils-2.21.53.0.2-mint.patch
+++ /dev/null
@@ -1,2667 +0,0 @@
-http://bugs.gentoo.org/show_bug.cgi?id=362559
-
-diff -ur --new-file binutils-2.21.51.0.7/bfd/Makefile.am binutils-2.21.51.0.7-mint/bfd/Makefile.am
---- binutils-2.21.51.0.7/bfd/Makefile.am	2010-12-06 14:23:53.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/Makefile.am	2011-04-08 10:07:06.000000000 +0000
-@@ -379,6 +379,7 @@
- 	peigen.lo \
- 	plugin.lo \
- 	ppcboot.lo \
-+	prg-mint.lo \
- 	reloc16.lo \
- 	riscix.lo \
- 	som.lo \
-@@ -559,6 +560,7 @@
- 	pei-sh.c \
- 	plugin.c \
- 	ppcboot.c \
-+	prg-mint.c \
- 	reloc16.c \
- 	riscix.c \
- 	som.c \
-diff -ur --new-file binutils-2.21.51.0.7/bfd/Makefile.in binutils-2.21.51.0.7-mint/bfd/Makefile.in
---- binutils-2.21.51.0.7/bfd/Makefile.in	2010-12-06 14:23:53.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/Makefile.in	2011-04-08 10:07:06.000000000 +0000
-@@ -679,6 +679,7 @@
- 	peigen.lo \
- 	plugin.lo \
- 	ppcboot.lo \
-+	prg-mint.lo \
- 	reloc16.lo \
- 	riscix.lo \
- 	som.lo \
-@@ -859,6 +860,7 @@
- 	pei-sh.c \
- 	plugin.c \
- 	ppcboot.c \
-+	prg-mint.c \
- 	reloc16.c \
- 	riscix.c \
- 	som.c \
-diff -ur --new-file binutils-2.21.51.0.7/bfd/acinclude.m4 binutils-2.21.51.0.7-mint/bfd/acinclude.m4
---- binutils-2.21.51.0.7/bfd/acinclude.m4	2009-12-14 15:46:47.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/acinclude.m4	2011-04-08 10:07:06.000000000 +0000
-@@ -5,7 +5,7 @@
- [AC_REQUIRE([AC_CANONICAL_TARGET])
- case "${host}" in
- changequote(,)dnl
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- changequote([,])dnl
-   AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
- esac])dnl
-diff -ur --new-file binutils-2.21.51.0.7/bfd/aoutx.h binutils-2.21.51.0.7-mint/bfd/aoutx.h
---- binutils-2.21.51.0.7/bfd/aoutx.h	2011-03-07 18:05:31.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/aoutx.h	2011-04-08 10:07:06.000000000 +0000
-@@ -1841,6 +1841,11 @@
-   bfd_byte buffer[BYTES_IN_WORD];
-   bfd_size_type amt = BYTES_IN_WORD;
- 
-+  /* The MiNT backend writes past the string table.  It therefore has to
-+     know about the table size.  */
-+  obj_aout_external_string_size (abfd) = _bfd_stringtab_size (tab) +
-+    BYTES_IN_WORD;
-+
-   /* The string table starts with the size.  */
-   PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
-   if (bfd_bwrite ((void *) buffer, amt, abfd) != amt)
-@@ -4220,10 +4225,17 @@
- 		return FALSE;
- 	    }
- 
-+#ifdef MY_final_link_relocate_rel
-+	  r = MY_final_link_relocate_rel (howto,
-+					  input_bfd, input_section,
-+					  contents, r_addr, relocation,
-+					  (bfd_vma) 0, rel);
-+#else
- 	  r = MY_final_link_relocate (howto,
- 				      input_bfd, input_section,
- 				      contents, r_addr, relocation,
- 				      (bfd_vma) 0);
-+#endif
- 	}
- 
-       if (r != bfd_reloc_ok)
-diff -ur --new-file binutils-2.21.51.0.7/bfd/bfd-in.h binutils-2.21.51.0.7-mint/bfd/bfd-in.h
---- binutils-2.21.51.0.7/bfd/bfd-in.h	2010-11-12 17:32:58.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/bfd-in.h	2011-04-08 10:07:06.000000000 +0000
-@@ -742,6 +742,15 @@
- extern bfd_boolean bfd_sparclinux_size_dynamic_sections
-   (bfd *, struct bfd_link_info *);
- 
-+/* MiNT executable support routines for the linker.  */
-+
-+extern bfd_boolean bfd_m68kmint_set_extended_flags
-+  (bfd *, flagword);
-+extern bfd_boolean bfd_m68kmint_set_stack_size
-+  (bfd *, bfd_signed_vma);
-+extern bfd_boolean bfd_m68kmint_add_tpa_relocation_entry
-+  (bfd *, bfd_vma);
-+
- /* mmap hacks */
- 
- struct _bfd_window_internal;
-diff -ur --new-file binutils-2.21.51.0.7/bfd/bfd-in2.h binutils-2.21.51.0.7-mint/bfd/bfd-in2.h
---- binutils-2.21.51.0.7/bfd/bfd-in2.h	2011-03-07 18:05:57.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/bfd-in2.h	2011-04-08 10:07:06.000000000 +0000
-@@ -749,6 +749,15 @@
- extern bfd_boolean bfd_sparclinux_size_dynamic_sections
-   (bfd *, struct bfd_link_info *);
- 
-+/* MiNT executable support routines for the linker.  */
-+
-+extern bfd_boolean bfd_m68kmint_set_extended_flags
-+  (bfd *, flagword);
-+extern bfd_boolean bfd_m68kmint_set_stack_size
-+  (bfd *, bfd_signed_vma);
-+extern bfd_boolean bfd_m68kmint_add_tpa_relocation_entry
-+  (bfd *, bfd_vma);
-+
- /* mmap hacks */
- 
- struct _bfd_window_internal;
-diff -ur --new-file binutils-2.21.51.0.7/bfd/config.bfd binutils-2.21.51.0.7-mint/bfd/config.bfd
---- binutils-2.21.51.0.7/bfd/config.bfd	2011-01-04 17:51:04.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/config.bfd	2011-04-08 10:07:06.000000000 +0000
-@@ -823,6 +823,11 @@
-     # targ_selvecs=m68kmach3_vec
-     # targ_cflags=-DSTAT_FOR_EXEC
-     ;;
-+  m68*-*-mint*)
-+    targ_defvec=aout0_big_vec
-+    targ_selvecs=m68kmint_prg_vec
-+    targ_underscore=yes
-+    ;;
-   m68*-hp*-netbsd*)
-     targ_defvec=m68k4knetbsd_vec
-     targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec"
-diff -ur --new-file binutils-2.21.51.0.7/bfd/configure binutils-2.21.51.0.7-mint/bfd/configure
---- binutils-2.21.51.0.7/bfd/configure	2011-03-07 18:05:31.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/configure	2011-04-08 10:07:07.000000000 +0000
-@@ -13623,7 +13623,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
-  ;;
-@@ -15237,6 +15237,7 @@
-     m68kcoff_vec)		tb="$tb coff-m68k.lo cofflink.lo" ;;
-     m68kcoffun_vec)		tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
-     m68klinux_vec)		tb="$tb m68klinux.lo aout32.lo" ;;
-+    m68kmint_prg_vec)		tb="$tb prg-mint.lo aout32.lo" ;;
-     m68knetbsd_vec)		tb="$tb m68knetbsd.lo aout32.lo" ;;
-     m68ksysvcoff_vec)		tb="$tb coff-svm68k.lo cofflink.lo" ;;
-     m88kbcs_vec)		tb="$tb coff-m88k.lo" ;;
-diff -ur --new-file binutils-2.21.51.0.7/bfd/configure.in binutils-2.21.51.0.7-mint/bfd/configure.in
---- binutils-2.21.51.0.7/bfd/configure.in	2011-03-07 18:05:31.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/configure.in	2011-04-08 10:07:07.000000000 +0000
-@@ -880,6 +880,7 @@
-     m68kcoff_vec)		tb="$tb coff-m68k.lo cofflink.lo" ;;
-     m68kcoffun_vec)		tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;;
-     m68klinux_vec)		tb="$tb m68klinux.lo aout32.lo" ;;
-+    m68kmint_prg_vec)		tb="$tb prg-mint.lo aout32.lo" ;;
-     m68knetbsd_vec)		tb="$tb m68knetbsd.lo aout32.lo" ;;
-     m68ksysvcoff_vec)		tb="$tb coff-svm68k.lo cofflink.lo" ;;
-     m88kbcs_vec)		tb="$tb coff-m88k.lo" ;;
-diff -ur --new-file binutils-2.21.51.0.7/bfd/libaout.h binutils-2.21.51.0.7-mint/bfd/libaout.h
---- binutils-2.21.51.0.7/bfd/libaout.h	2009-10-09 22:25:42.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/libaout.h	2011-04-08 10:07:08.000000000 +0000
-@@ -422,6 +422,10 @@
-      table, used when linking on SunOS.  This is indexed by the symbol
-      index.  */
-   bfd_vma *local_got_offsets;
-+
-+  /* A pointer for data used by aout extensions.  (Currently only used
-+     by MiNT executables (see prg-mint.c).  */
-+  void *ext;
- };
- 
- struct  aout_data_struct
-@@ -449,6 +453,7 @@
- #define obj_aout_string_window(bfd)        (adata (bfd).string_window)
- #define obj_aout_sym_hashes(bfd)           (adata (bfd).sym_hashes)
- #define obj_aout_dynamic_info(bfd)         (adata (bfd).dynamic_info)
-+#define obj_aout_ext(bfd)                  (adata (bfd).ext)
- 
- /* We take the address of the first element of an asymbol to ensure that the
-    macro is only ever applied to an asymbol.  */
-diff -ur --new-file binutils-2.21.51.0.7/bfd/prg-mint.c binutils-2.21.51.0.7-mint/bfd/prg-mint.c
---- binutils-2.21.51.0.7/bfd/prg-mint.c	1970-01-01 00:00:00.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/prg-mint.c	2011-04-08 10:07:08.000000000 +0000
-@@ -0,0 +1,1732 @@
-+/* BFD backend for traditional MiNT executables.
-+   Copyright 1998, 2007, 2008, 2009 Free Software Foundation, Inc.
-+   Originally written by Guido Flohr (guido@freemint.de).
-+   Modified by Vincent Riviere (vincent.riviere@freesbee.fr).
-+
-+   This file is part of BFD, the Binary File Descriptor library.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software
-+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-+   MA 02110-1301, USA.  */
-+
-+/* The format of executables on Atari is actually not a.out,  it is
-+   only chosen as an approach which comes close enough.  The layout of a
-+   program image on disk looked like this:
-+
-+   +-----------------+
-+   | 28 Bytes Header |
-+   +-----------------+
-+   | Text segment    |
-+   +-----------------+
-+   | Data segment    |
-+   +-----------------+
-+   | BSS	     |
-+   +-----------------+
-+   | Symbol table    |
-+   +-----------------+
-+   | TPA relocation  |
-+   +-----------------+
-+
-+   The 28 byte exec header used to look like this:
-+
-+   struct old_exec_header
-+   {
-+     bfd_byte a_magic[2];
-+     bfd_byte a_text[4];
-+     bfd_byte a_data[4];
-+     bfd_byte a_bss[4];
-+     bfd_byte a_syms[4];
-+     bfd_byte a_resvd[4];
-+     bfd_byte a_abs[2];
-+   };
-+
-+   The first two bytes (A_MAGIC) contained an assembler branch
-+   instruction to the beginning of the text segment.  Because the
-+   exec header had a fixed size and the text entry point was constant
-+   this assembler instruction also had a constant value (0x601a).
-+   In fact the operating system never really executed the branch
-+   instruction but used this value (0x601a) as a magic value.
-+
-+   TEXT, DATA and BSS were as one would expect them.  The symbol
-+   table wasn't.  Several different formats were in use, none of them
-+   very efficient, none of them powerful enough to support source
-+   level debugging.  I've changed that and the GNU symbol table will
-+   now be used instead (unless the --traditional-format option was
-+   given to the linker).
-+
-+   If the last member A_ABS of the exec header is zero the program
-+   image contains an additional table with relocation information
-+   at the end of the image.  The kernel can load program images at
-+   virtually any address in the address space.  In fact it will load
-+   it at the start of the biggest block of free memory.  This block
-+   is then called the Transient Program Area TPA and the image has
-+   to be relocated against the TPA at runtime.  The relocation info
-+   itself is in a simply way compressed:  It starts with a four-byte
-+   value, the first address within the image to be relocated.  Now
-+   following are one-byte offsets to the last address.  The special
-+   value of 1 (which is impossible as an offset) signifies that 254
-+   has to be added to the next offset.  The table is finished with
-+   a zero-byte.
-+
-+   I now simply extended the header from its old 28 bytes to 256
-+   bytes.  The first 28 bytes give home to a standard Atari header,
-+   the rest is for extensions.  The extension header starts with
-+   a ``real'' assembler instruction, a far jump to the text entry
-+   point.  The extension header gives home to a standard a.out
-+   exec header (currently NMAGIC) plus some extra
-+   more or less useful fields plus space to future extensions.
-+   For the OS the extension header will already belong to the text
-+   segment, for BFD backends the text segment is 228 (or 0xe4)
-+   bytes smaller than for the OS.  This explains for example the
-+   funny TEXT_START_ADDR 0xe4.
-+
-+   The TARGET_PAGE_SIZE is 2 which is only fake.  There is currently
-+   no such thing as memory paging on the Atari (and this is why
-+   ZMAGICs are disabled for now to allow for future enhancements).
-+
-+   If you think that this whole file looks quite like a big hack
-+   you're probably right.  But the results (mainly the output of
-+   the linker) seem to work and they allow to use up-to-date
-+   binutils on the Atari until a better executable format (maybe
-+   ELF) has been established for this machine.  */
-+
-+#include "sysdep.h"
-+#include "bfd.h"
-+
-+#define N_HEADER_IN_TEXT(x) 0
-+#define BYTES_IN_WORD 4
-+#define ENTRY_CAN_BE_ZERO
-+#define N_SHARED_LIB(x) 0
-+#define TEXT_START_ADDR 0xe4
-+#define TARGET_PAGE_SIZE 2
-+#define TARGET_IS_BIG_ENDIAN_P
-+#define DEFAULT_ARCH bfd_arch_m68k
-+#define N_TXTADDR(x) TEXT_START_ADDR
-+
-+/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
-+   remove whitespace added here, and thus will fail to concatenate
-+   the tokens.  */
-+#define MY(OP) CONCAT2 (m68kmint_prg_,OP)
-+#define TARGETNAME "a.out-mintprg"
-+#define NAME(x,y) CONCAT3 (mintprg,_32_,y)
-+
-+/* We have to do quite a lot of magic to make the Atari format
-+   for GEMDOS executables fit into the standard a.out format.
-+   We start with the original header.  */
-+#define external_exec mint_external_exec
-+struct mint_external_exec
-+{
-+  bfd_byte g_branch[2]; 	     /* 0x601a.  */
-+  bfd_byte g_text[4];		     /* Length of text section.  */
-+  bfd_byte g_data[4];		     /* Length of data section.  */
-+  bfd_byte g_bss[4];		     /* Length of bss section.  */
-+  bfd_byte g_syms[4];		     /* Length of symbol table.  */
-+  bfd_byte g_extmagic[4];	     /* Always 0x4d694e54
-+					(in ASCII: ``MiNT'').  */
-+  bfd_byte g_flags[4];		     /* Atari special flags.  */
-+  bfd_byte g_abs[2];		     /* Non-zero if absolute (no relocation
-+					info.  */
-+
-+  /* We extend this header now to provide the information that the
-+     binutils want to see.  Everything following will actually be part
-+     of the text segment (from MiNT's point of view).  As a
-+     consequence the text section has 228 bytes of redundancy.
-+
-+     The following eight bytes should be treated as opaque.
-+     If the word ``opaque'' always attracts your curiosity in
-+     typedefs and structs, here's the explanation:  These eight bytes
-+     are really two assembler instructions.  The first one moves
-+     the contents of e_entry into register d0, the second one
-+     jumps (pc-relative) to the entry point.  See swap_exec_header_out
-+     for details.  */
-+  bfd_byte g_jump_entry[8];
-+
-+  /* Now following a standard a.out header.  Note that the values
-+     may differ from the one given on top.  The traditional header
-+     contains the values that the OS wants to see, the values below
-+     are the values that make the binutils work.  */
-+  bfd_byte e_info[4];		     /* Magic number and stuff.  */
-+  bfd_byte e_text[4];		     /* Length of text section in bytes.  */
-+  bfd_byte e_data[4];		     /* Length of data section.  */
-+  bfd_byte e_bss[4];		     /* Length of standard symbol
-+					table.  */
-+  bfd_byte e_syms[4];		     /* Length of symbol table.  */
-+  bfd_byte e_entry[4];		     /* Start address.  */
-+  bfd_byte e_trsize[4]; 	     /* Length of text relocation
-+					info.  */
-+  bfd_byte e_drsize[4]; 	     /* Length of data relocation
-+					info.  */
-+
-+  bfd_byte g_tparel_pos[4];	     /* File position of TPA relative
-+					relocation info.  */
-+  bfd_byte g_tparel_size[4];	     /* Length of TPA relative relocation
-+					info.  */
-+
-+  /* This is for extensions.  */
-+  bfd_byte g_stkpos[4]; 	     /* If stacksize is hardcoded into
-+					the executable you will find it
-+					at file offset g_stkpos.  If
-+					not this is NULL.  */
-+
-+  bfd_byte g_symbol_format[4];	     /* Format of the symbol table.  See
-+					definitions for _MINT_SYMBOL_FORMAT*
-+					above.  */
-+
-+  /* Pad with zeros.  */
-+  bfd_byte g_pad0[172];
-+};
-+#define EXEC_BYTES_SIZE 256
-+#define GEMDOS_HEADER_SIZE 28
-+
-+/* The following defines are required by aoutx.h.
-+   They are not automatically defined in aout/aout64.h
-+   if external_exec is defined.  */
-+
-+#define OMAGIC 0407	/* Object file or impure executable.  */
-+#define NMAGIC 0410	/* Code indicating pure executable.  */
-+#define ZMAGIC 0413	/* Code indicating demand-paged executable.  */
-+#define BMAGIC 0415	/* Used by a b.out object.  */
-+#define QMAGIC 0314	/* Like ZMAGIC but with N_HEADER_IN_TEXT true.  */
-+
-+/* Files using the following magic flags will not be loaded.  */
-+#define N_BADMAG(x)	(N_MAGIC(x) != NMAGIC)
-+
-+/* For DRI symbol table format.  */
-+struct dri_symbol
-+{
-+  bfd_byte a_name[8];	  /* Symbol name */
-+  bfd_byte a_type[2];	  /* Type flag, i.e. A_TEXT etc; see below.  */
-+  bfd_byte a_value[4];	  /* value of this symbol (or sdb offset).  */
-+};
-+#define DRI_SYMBOL_SIZE 14
-+
-+/* Simple values for a_type.  */
-+#define A_UNDF	0
-+#define A_BSS	0x0100
-+#define A_TEXT	0x0200
-+#define A_DATA	0x0400
-+#define A_EXT	0x0800	      /* External.  */
-+#define A_EQREG 0x1000	      /* Equated register.  */
-+#define A_GLOBL 0x2000	      /* Global.  */
-+#define A_EQU	0x4000	      /* Equated.  */
-+#define A_DEF	0x8000	      /* Defined.  */
-+#define A_LNAM	0x0048	      /* GST compatible long name.  */
-+			      /* File symbols ala aln.  */
-+#define A_TFILE 0x0280	      /* Text file corresponding to object module.  */
-+#define A_TFARC 0x02C0	      /* Text file archive.  Unfortunately this
-+				 conflicts with the bits in A_LNAM.  */
-+
-+/* The following include contains the definitions for internal a.out structures
-+   as well as the prototypes for the NAME(...) functions defined in aoutx.h.  */
-+
-+#include "libaout.h"
-+
-+/* The following function is similar to _bfd_final_link_relocate, except it
-+   adds the reloc structure as an additional parameter.
-+   It will be used int aoutx.h.  */
-+
-+static bfd_reloc_status_type
-+m68kmint_prg_final_link_relocate_rel (reloc_howto_type *howto,
-+				      bfd *input_bfd,
-+				      asection *input_section,
-+				      bfd_byte *contents,
-+				      bfd_vma address,
-+				      bfd_vma value,
-+				      bfd_vma addend,
-+				      struct reloc_std_external *rel);
-+
-+#define MY_final_link_relocate_rel m68kmint_prg_final_link_relocate_rel
-+
-+/* The following include contains the definitions for the NAME(...) functions.  */
-+
-+#include "aoutx.h"
-+
-+/* Data structure that holds some private information for us.  */
-+struct mint_internal_info
-+{
-+  struct bfd_link_info *linkinfo;    /* Remembered from final_link.  */
-+  bfd_boolean	traditional_format;  /* Saved from link info.  */
-+  int		symbol_format;	     /* Format of the symbol table.  */
-+  void		*tparel;	     /* Data for TPA relative relocation
-+					information.  */
-+  file_ptr	tparel_pos;	     /* File position of TPA relative
-+					relocation information.  */
-+  bfd_size_type tparel_size;	     /* Size of TPA relative relocation
-+					information.  */
-+  bfd_size_type dri_symtab_size;     /* Size of traditional symbol table.  */
-+
-+#define MINT_RELOC_CHUNKSIZE 0x1000
-+  bfd_vma	*relocs;	     /* Array of address relocations.  */
-+  unsigned long relocs_used;	     /* Number of relocation entries
-+					already used up.  */
-+  unsigned long relocs_allocated;    /* Number of relocation entries
-+					allocated.  */
-+
-+  bfd_vma	stkpos; 	     /* File offset to value of _stksize.  */
-+
-+  flagword	prg_flags;	     /* Standard GEMDOS flags.  */
-+
-+  bfd_boolean 	override_stack_size; /* TRUE if the executable stack size
-+					must be overriden with stack_size.  */
-+  bfd_signed_vma stack_size;
-+
-+  bfd_boolean	reloc_error;	     /* TRUE if an unhandled error during
-+					relocation occured.  */
-+};
-+
-+/* If --traditional-format was given to the linker an old-style DRI
-+   symbol table is written into the executable.  This is with respect
-+   to many old debugging tools or disassemblers which expect this format.
-+   Although created by the linker, these symbols will be ignored from
-+   input files.  */
-+#define _MINT_SYMBOL_FORMAT_GNU  0
-+#define _MINT_SYMBOL_FORMAT_DRI  1
-+
-+/* Declarations for the variables and functions
-+   defined later in aout-target.h.  */
-+
-+static const bfd_target *
-+m68kmint_prg_callback (bfd *abfd);
-+
-+static void
-+MY_final_link_callback (bfd *abfd,
-+			file_ptr *ptreloff,
-+			file_ptr *pdreloff,
-+			file_ptr *psymoff);
-+
-+extern const bfd_target m68kmint_prg_vec;
-+
-+/* Initialize a new BFD using our file format.  */
-+
-+#define MY_mkobject m68kmint_prg_mkobject
-+
-+static bfd_boolean
-+m68kmint_prg_mkobject (bfd *abfd)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  if (!NAME (aout, mkobject (abfd)))
-+    return FALSE;
-+
-+  /* Allocate our private BFD data.  */
-+  myinfo = bfd_zalloc (abfd, sizeof (*myinfo));
-+  if (myinfo == NULL)
-+    return FALSE;
-+  obj_aout_ext (abfd) = myinfo;
-+
-+  return TRUE;
-+}
-+
-+/* Finish up the reading of an a.out file header.  */
-+
-+#define MY_object_p m68kmint_prg_object_p
-+
-+static const bfd_target *
-+m68kmint_prg_object_p (bfd *abfd)
-+{
-+  struct external_exec exec_bytes;	/* Raw exec header from file.  */
-+  struct internal_exec exec;		/* Cleaned-up exec header.  */
-+  const bfd_target *target;
-+  bfd_size_type amt = EXEC_BYTES_SIZE;
-+  struct mint_internal_info *myinfo;
-+
-+  /* Read the exec bytesd from the file.  */
-+  if (bfd_bread (&exec_bytes, amt, abfd) != amt)
-+    {
-+      if (bfd_get_error () != bfd_error_system_call)
-+	bfd_set_error (bfd_error_wrong_format);
-+      return NULL;
-+    }
-+
-+  /* Instead of byte-swapping we compare bytes.  */
-+  if (exec_bytes.g_branch[0] != 0x60
-+      || exec_bytes.g_branch[1] != 0x1a
-+      || exec_bytes.g_extmagic[0] != 'M'
-+      || exec_bytes.g_extmagic[1] != 'i'
-+      || exec_bytes.g_extmagic[2] != 'N'
-+      || exec_bytes.g_extmagic[3] != 'T')
-+    {
-+      bfd_set_error (bfd_error_wrong_format);
-+      return NULL;
-+    }
-+
-+  /* Swap the standard a.out fields.  */
-+  NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
-+
-+  /* Check a.out magic value.  */
-+  if (N_BADMAG (exec))
-+    {
-+      bfd_set_error (bfd_error_wrong_format);
-+      return NULL;
-+    }
-+
-+  /* Initialize this BFD with the exec values.  */
-+  target = NAME (aout, some_aout_object_p) (abfd, &exec, m68kmint_prg_callback);
-+
-+  /* Allocate our private BFD data.  */
-+  myinfo = bfd_zalloc (abfd, sizeof (*myinfo));
-+  if (myinfo == NULL)
-+    return NULL;
-+  obj_aout_ext (abfd) = myinfo;
-+
-+  /* Now get the missing information.  */
-+  myinfo->prg_flags = bfd_h_get_32 (abfd, exec_bytes.g_flags);
-+  myinfo->stkpos = bfd_h_get_32 (abfd, exec_bytes.g_stkpos);
-+  myinfo->symbol_format = bfd_h_get_32 (abfd, exec_bytes.g_symbol_format);
-+
-+  /* TPA relocation information.  */
-+  myinfo->tparel_pos = bfd_h_get_32 (abfd, exec_bytes.g_tparel_pos);
-+  myinfo->tparel_size = bfd_h_get_32 (abfd, exec_bytes.g_tparel_size);
-+
-+  /* FIXME:  Currently we always read the TPA relative relocation
-+     information.  This is suboptimal because often times there
-+     is no need for it.  Read it only if need be!  Maybe this should
-+     also depend on abfd->cacheable?  */
-+  if (myinfo->tparel_size == 0)
-+    myinfo->tparel = bfd_zalloc (abfd, 4);
-+  else
-+    myinfo->tparel = bfd_alloc (abfd, myinfo->tparel_size);
-+
-+  if (myinfo->tparel == NULL)
-+    return NULL;
-+
-+  if (myinfo->tparel_size == 0)
-+    {
-+      myinfo->tparel_size = 4;
-+    }
-+  else
-+    {
-+      /* Read the information from the bfd.  */
-+      if (bfd_seek (abfd, myinfo->tparel_pos, SEEK_SET) != 0
-+	  || (bfd_bread (myinfo->tparel, myinfo->tparel_size, abfd)
-+	      != myinfo->tparel_size))
-+	return NULL;
-+    }
-+
-+  return target;
-+}
-+
-+/* Free all information we have cached for this BFD.  We can always
-+   read it again later if we need it.  */
-+
-+#define MY_bfd_free_cached_info m68kmint_prg_bfd_free_cached_info
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_free_cached_info (bfd *abfd)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+
-+  if (myinfo != NULL && myinfo->relocs != NULL)
-+    {
-+      free (myinfo->relocs);
-+      myinfo->relocs = NULL;
-+    }
-+
-+  /* myinfo itself has been allocated by bfd_zalloc()
-+     so will be automatically freed along with the BFD.
-+     Same for myinfo->tparel.  */
-+
-+  return NAME (aout, bfd_free_cached_info) (abfd);
-+}
-+
-+/* Write a DRI symbol with TYPE and VALUE.  If the NAME of the
-+   symbol exceeds 8 characters write a long symbol.  If it
-+   exceeds 22 characters truncate the name.  */
-+
-+static int
-+write_dri_symbol (bfd *abfd, const char *name, int type, bfd_vma value)
-+{
-+  int written_bytes = 0;
-+  struct dri_symbol sym;
-+  int is_long_name = strlen (name) > sizeof (sym.a_name);
-+
-+  if (is_long_name)
-+    type |= A_LNAM;
-+
-+  strncpy ((char*)sym.a_name, name, sizeof (sym.a_name));
-+  bfd_put_16 (abfd, type, sym.a_type);
-+  bfd_put_32 (abfd, value, sym.a_value);
-+
-+  if (bfd_bwrite (&sym, DRI_SYMBOL_SIZE, abfd) != DRI_SYMBOL_SIZE)
-+    return -1;
-+  written_bytes += DRI_SYMBOL_SIZE;
-+
-+  if (is_long_name)
-+    {
-+      char more_name[DRI_SYMBOL_SIZE];
-+
-+      strncpy (more_name, name + sizeof (sym.a_name), DRI_SYMBOL_SIZE);
-+
-+      if (bfd_bwrite (more_name, DRI_SYMBOL_SIZE, abfd) != DRI_SYMBOL_SIZE)
-+	return -1;
-+      written_bytes += DRI_SYMBOL_SIZE;
-+    }
-+
-+  return written_bytes;
-+}
-+
-+/* Emit a traditional DRI symbol table while linking.
-+   Most of this code comes from aout_link_write_symbols() in aoutx.h.  */
-+
-+static bfd_boolean
-+link_write_traditional_syms (bfd *abfd, struct bfd_link_info *info)
-+{
-+  bfd			     *input_bfd;
-+  enum bfd_link_strip	     strip = info->strip;
-+  enum bfd_link_discard      discard = info->discard;
-+  struct mint_internal_info  *myinfo = obj_aout_ext (abfd);
-+  bfd			     *last_archive = NULL;
-+
-+  /* Position file pointer.  */
-+  if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
-+    return FALSE;
-+
-+  myinfo->dri_symtab_size = 0;
-+
-+  for (input_bfd = info->input_bfds; input_bfd != NULL; input_bfd = input_bfd->link_next)
-+    {
-+      bfd_size_type sym_count = obj_aout_external_sym_count (input_bfd);
-+      char *strings = obj_aout_external_strings (input_bfd);
-+      struct external_nlist *sym = obj_aout_external_syms (input_bfd);
-+      struct external_nlist *sym_end = sym + sym_count;
-+      struct aout_link_hash_entry **sym_hash = obj_aout_sym_hashes (input_bfd);
-+      bfd_boolean pass = FALSE;
-+      bfd_boolean skip = FALSE;
-+      bfd_boolean skip_next = FALSE;
-+      int written_bytes;
-+      int a_type;
-+      bfd_boolean write_archive_name = FALSE;
-+      bfd_vma val = 0;
-+
-+      /* First write out a symbol for the archive if we do not
-+	 strip these symbols and if it differs from the last
-+	 one.  */
-+      if (input_bfd->my_archive != last_archive
-+	  && input_bfd->my_archive != NULL)
-+	{
-+	  write_archive_name = TRUE;
-+	  last_archive = input_bfd->my_archive;
-+	}
-+
-+      if (write_archive_name
-+	  && strip != strip_all
-+	  && (strip != strip_some
-+	      || bfd_hash_lookup (info->keep_hash,
-+				  input_bfd->my_archive->filename,
-+				  FALSE, FALSE) != NULL)
-+	  && discard != discard_all)
-+	{
-+	  val = bfd_get_section_vma (abfd,
-+				     obj_textsec (input_bfd)->output_section)
-+	    + obj_textsec (input_bfd)->output_offset;
-+
-+	  written_bytes = write_dri_symbol (abfd,
-+					    input_bfd->my_archive->filename,
-+					    A_TFILE, val);
-+
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+	  else
-+	    myinfo->dri_symtab_size += written_bytes;
-+	}
-+
-+      /* Now write out a symbol for the object file if we do not
-+	 strip these symbols.  */
-+      if (strip != strip_all
-+	  && (strip != strip_some
-+	      || bfd_hash_lookup (info->keep_hash, input_bfd->filename,
-+				  FALSE, FALSE) != NULL)
-+	  && discard != discard_all)
-+	{
-+	  val = bfd_get_section_vma (abfd,
-+				     obj_textsec (input_bfd)->output_section)
-+	    + obj_textsec (input_bfd)->output_offset;
-+
-+	  written_bytes = write_dri_symbol (abfd, input_bfd->filename,
-+					    A_TFILE, val);
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+	  else
-+	    myinfo->dri_symtab_size += written_bytes;
-+	}
-+
-+      /* Now we have a problem.  All symbols that we see have already
-+	 been marked written (because we write them a second time
-+	 here.  If we would do it the clean way we would have
-+	 to traverse the entire symbol map and reset the written
-+	 flag.  We hack here instead...  */
-+#define mark_written(h) (* (int *) &h->written = (int) TRUE + 1)
-+#define is_written(h) ((int) h->written == (int) TRUE + 1)
-+      for (; sym < sym_end; sym++, sym_hash++)
-+	{
-+	  const char *name;
-+	  int type;
-+	  struct aout_link_hash_entry *h;
-+	  asection *symsec;
-+	  val = 0;
-+
-+	  type = H_GET_8 (input_bfd, sym->e_type);
-+	  name = strings + GET_WORD (input_bfd, sym->e_strx);
-+
-+	  h = NULL;
-+
-+	  if (pass)
-+	    {
-+	      /* Pass this symbol through.  It is the target of an
-+	      indirect or warning symbol.  */
-+	      val = GET_WORD (input_bfd, sym->e_value);
-+	      pass = FALSE;
-+	    }
-+	  else if (skip_next)
-+	    {
-+	      /* Skip this symbol, which is the target of an indirect
-+		 symbol that we have changed to no longer be an indirect
-+		 symbol.  */
-+	      skip_next = FALSE;
-+	      continue;
-+	    }
-+	  else
-+	    {
-+	      struct aout_link_hash_entry *hresolve = *sym_hash;
-+
-+	      /* We have saved the hash table entry for this symbol, if
-+		 there is one.  Note that we could just look it up again
-+		 in the hash table, provided we first check that it is an
-+		 external symbol. */
-+	      h = *sym_hash;
-+
-+	      /* Use the name from the hash table, in case the symbol was
-+		 wrapped.  */
-+	    if (h != NULL
-+		&& h->root.type != bfd_link_hash_warning)
-+		name = h->root.root.string;
-+
-+	      /* If this is an indirect or warning symbol, then change
-+		 hresolve to the base symbol.  */
-+	      hresolve = h;
-+	      if (h != (struct aout_link_hash_entry *) NULL
-+		  && (h->root.type == bfd_link_hash_indirect
-+		      || h->root.type == bfd_link_hash_warning))
-+		{
-+		  hresolve = (struct aout_link_hash_entry*) h->root.u.i.link;
-+		  while (hresolve->root.type == bfd_link_hash_indirect
-+			 || hresolve->root.type == bfd_link_hash_warning)
-+		    hresolve = ((struct aout_link_hash_entry*)
-+				hresolve->root.u.i.link);
-+		}
-+
-+	      /* If the symbol has already been written out skip it.  */
-+	      if (h != NULL
-+		  && is_written (h))
-+		{
-+		  if ((type & N_TYPE) == N_INDR
-+		      || type == N_WARNING)
-+		    skip_next = TRUE;
-+		  continue;
-+		}
-+
-+	      /* See if we are stripping this symbol.  */
-+	      skip = FALSE;
-+
-+	      /* Skip all debugger symbols.  No way to output them in
-+		 DRI format.  This will also reduce a lot of headaches.  */
-+	      if ((type & N_STAB) != 0)
-+		skip = TRUE;
-+
-+	      switch (strip)
-+		{
-+		case strip_none:
-+		case strip_debugger:
-+		  break;
-+		case strip_some:
-+		  if (bfd_hash_lookup (info->keep_hash, name, FALSE, FALSE)
-+		      == NULL)
-+		    skip = TRUE;
-+		  break;
-+		case strip_all:
-+		  skip = TRUE;
-+		  break;
-+		}
-+
-+	      if (skip)
-+		{
-+		  if (h != NULL)
-+		    mark_written (h);
-+		  continue;
-+		}
-+
-+	      /* Get the value of the symbol.  */
-+	      if ((type & N_TYPE) == N_TEXT
-+		  || type == N_WEAKT)
-+		symsec = obj_textsec (input_bfd);
-+	      else if ((type & N_TYPE) == N_DATA
-+		       || type == N_WEAKD)
-+		symsec = obj_datasec (input_bfd);
-+	      else if ((type & N_TYPE) == N_BSS
-+		       || type == N_WEAKB)
-+		symsec = obj_bsssec (input_bfd);
-+	      else if ((type & N_TYPE) == N_ABS
-+		       || type == N_WEAKA)
-+		symsec = bfd_abs_section_ptr;
-+	      else if (((type & N_TYPE) == N_INDR
-+			&& (hresolve == NULL
-+			    || (hresolve->root.type != bfd_link_hash_defined
-+				&& hresolve->root.type != bfd_link_hash_defweak
-+				&& hresolve->root.type != bfd_link_hash_common)))
-+		       || type == N_WARNING)
-+		{
-+		  /* Pass the next symbol through unchanged.  The
-+		     condition above for indirect symbols is so that if
-+		     the indirect symbol was defined, we output it with
-+		     the correct definition so the debugger will
-+		     understand it.  */
-+		  pass = TRUE;
-+		  val = GET_WORD (input_bfd, sym->e_value);
-+		  symsec = NULL;
-+		}
-+	      else
-+		{
-+		  /* If we get here with an indirect symbol, it means that
-+		     we are outputting it with a real definition.  In such
-+		     a case we do not want to output the next symbol,
-+		     which is the target of the indirection.  */
-+		  if ((type & N_TYPE) == N_INDR)
-+		    skip_next = TRUE;
-+
-+		  symsec = NULL;
-+
-+		  /* We need to get the value from the hash table.  We use
-+		     hresolve so that if we have defined an indirect
-+		     symbol we output the final definition.  */
-+		  if (h == NULL)
-+		    {
-+		      switch (type & N_TYPE)
-+			{
-+			case N_SETT:
-+			  symsec = obj_textsec (input_bfd);
-+			  break;
-+			case N_SETD:
-+			  symsec = obj_datasec (input_bfd);
-+			  break;
-+			case N_SETB:
-+			  symsec = obj_bsssec (input_bfd);
-+			  break;
-+			case N_SETA:
-+			  symsec = bfd_abs_section_ptr;
-+			  break;
-+			default:
-+			  val = 0;
-+			  break;
-+			}
-+		    }
-+		  else if (hresolve->root.type == bfd_link_hash_defined
-+			   || hresolve->root.type == bfd_link_hash_defweak)
-+		    {
-+		      asection *input_section;
-+		      asection *output_section;
-+
-+		      /* This case usually means a common symbol which was
-+			 turned into a defined symbol.  */
-+		      input_section = hresolve->root.u.def.section;
-+		      output_section = input_section->output_section;
-+		      BFD_ASSERT (bfd_is_abs_section (output_section)
-+				  || output_section->owner == abfd);
-+
-+		      /* The following reference to the output section VMA
-+			 is commented out because DRI symbols are relative
-+			 to the beginning of the section.  */
-+		      val = (hresolve->root.u.def.value
-+			     /*+ bfd_get_section_vma (abfd, output_section)*/
-+			     + input_section->output_offset);
-+
-+		      /* TEXT symbols values must be adjusted
-+			 by adding the size of the extended header.  */
-+		      if (output_section == obj_textsec (abfd))
-+			val += TEXT_START_ADDR;
-+
-+		      /* Get the correct type based on the section.  If
-+			 this is a constructed set, force it to be
-+			 globally visible.  */
-+		      if (type == N_SETT
-+			  || type == N_SETD
-+			  || type == N_SETB
-+			  || type == N_SETA)
-+			type |= N_EXT;
-+
-+		      type &=~ N_TYPE;
-+
-+		      if (output_section == obj_textsec (abfd))
-+			type |= N_TEXT;
-+		      else if (output_section == obj_datasec (abfd))
-+			type |= N_DATA;
-+		      else if (output_section == obj_bsssec (abfd))
-+			type |= N_BSS;
-+		      else
-+			type |= N_ABS;
-+		    }
-+		  else if (hresolve->root.type == bfd_link_hash_common)
-+		    val = hresolve->root.u.c.size;
-+		  else if (hresolve->root.type == bfd_link_hash_undefweak)
-+		    {
-+		      val = 0;
-+		      type = N_UNDF;
-+		    }
-+		  else
-+		    val = 0;
-+		}
-+	      if (symsec != NULL)
-+		{
-+		  /* The following reference to the output section VMA
-+		     is commented out because DRI symbols are relative
-+		     to the beginning of the section.  */
-+		  val = (/*symsec->output_section->vma
-+			 +*/ symsec->output_offset
-+			 + (GET_WORD (input_bfd, sym->e_value)
-+			 - symsec->vma));
-+
-+		  /* TEXT symbols values must be adjusted
-+		     by adding the size of the extended header.  */
-+		  if (symsec == obj_textsec (input_bfd))
-+		    val += TEXT_START_ADDR;
-+		}
-+
-+	      /* If this is a global symbol set the written flag, and if
-+		 it is a local symbol see if we should discard it.  */
-+	      if (h != NULL)
-+		{
-+		  mark_written (h);
-+		}
-+	      else if ((type & N_TYPE) != N_SETT
-+		       && (type & N_TYPE) != N_SETD
-+		       && (type & N_TYPE) != N_SETB
-+		       && (type & N_TYPE) != N_SETA)
-+		{
-+		  switch (discard)
-+		    {
-+		    case discard_none:
-+		    case discard_sec_merge:
-+		      break;
-+		    case discard_l:
-+		      if (bfd_is_local_label_name (input_bfd, name))
-+			skip = TRUE;
-+		      break;
-+		    default:
-+		    case discard_all:
-+		      skip = TRUE;
-+		      break;
-+		    }
-+		  if (skip)
-+		    {
-+		      pass = FALSE;
-+		      continue;
-+		    }
-+		}
-+	    }
-+
-+	  /* Now find the nearest type in DRI format.  */
-+	  switch (type)
-+	    {
-+	    case N_ABS:
-+	    case N_ABS | N_EXT:
-+	    case N_SETA:
-+	    case N_SETA | N_EXT:
-+	    case N_WEAKA:
-+	      a_type = A_EQU | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_TEXT:
-+	    case N_TEXT | N_EXT:
-+	    case N_SETT:
-+	    case N_SETT | N_EXT:
-+	    case N_WEAKT:
-+	      a_type = A_TEXT | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_DATA:
-+	    case N_DATA | N_EXT:
-+	    case N_SETD:
-+	    case N_SETD | N_EXT:
-+	    case N_WEAKD:
-+	      a_type = A_DATA | A_DEF | A_GLOBL;
-+	      break;
-+	    case N_BSS:
-+	    case N_BSS | N_EXT:
-+	    case N_SETB:
-+	    case N_SETB | N_EXT:
-+	    case N_WEAKB:
-+	      a_type = A_BSS | A_DEF | A_GLOBL;
-+	      break;
-+	    default:
-+	      continue;
-+	    }
-+
-+	  written_bytes = write_dri_symbol (abfd, name, a_type, val);
-+	  if (written_bytes < 0)
-+	    return FALSE;
-+
-+	  myinfo->dri_symtab_size += written_bytes;
-+	}
-+    }
-+
-+  obj_aout_external_string_size (abfd) = 0;
-+  return TRUE;
-+}
-+
-+/* This is used for qsort() to sort addresses
-+   for the TPA relocation table.  */
-+
-+static int
-+vma_cmp (const void *v1, const void *v2)
-+{
-+  return (int) ((*((bfd_vma *) v1)) - (*((bfd_vma *) v2)));
-+}
-+
-+/* Alloc and fill the TPA relocation table.  */
-+
-+static bfd_boolean
-+fill_tparel (bfd *abfd)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  unsigned long i;
-+  bfd_size_type bytes;
-+  unsigned char *ptr;
-+
-+  /* Sort the relocation info.  */
-+  if (myinfo->relocs != NULL)
-+    qsort (myinfo->relocs, myinfo->relocs_used, sizeof (bfd_vma),
-+	   vma_cmp);
-+
-+  /* Now calculate the number of bytes we need.  The relocation info
-+     is encoded as follows:  The first entry is a 32-bit value
-+     denoting the first offset to relocate.  All following entries
-+     are relative to the preceding one.  For relative offsets of
-+     more than 254 bytes a value of 1 is used.  The OS will then
-+     add 254 bytes to the current offset.  The list is then terminated
-+     with the byte 0.  */
-+  bytes = 4; /* First entry is a long.  */
-+  for (i = 1; i < myinfo->relocs_used; i++)
-+    {
-+      unsigned long diff = myinfo->relocs[i] - myinfo->relocs[i - 1];
-+      BFD_ASSERT(diff > 0);
-+      bytes += (diff + 253) / 254;
-+    }
-+  /* Last entry is (bfd_byte) 0 if there are some relocations.  */
-+  if (myinfo->relocs_used > 0)
-+    bytes++;
-+
-+  myinfo->tparel_size = bytes;
-+  myinfo->tparel = bfd_alloc (abfd, bytes);
-+  if (myinfo->tparel == NULL)
-+    return FALSE;
-+
-+  /* Now fill the array.  */
-+  ptr = (bfd_byte*) myinfo->tparel;
-+  if (myinfo->relocs != NULL)
-+    bfd_put_32 (abfd, myinfo->relocs[0], ptr);
-+  else
-+    bfd_put_32 (abfd, 0, ptr);
-+  ptr += 4;
-+
-+  for (i = 1; i < myinfo->relocs_used; i++)
-+    {
-+      unsigned long diff = myinfo->relocs[i] - myinfo->relocs[i - 1];
-+      while (diff > 254)
-+	{
-+	  *ptr++ = 1;
-+	  diff -= 254;
-+	}
-+      *ptr++ = (bfd_byte) diff;
-+    }
-+
-+  if (myinfo->relocs_used > 0)
-+    *ptr = 0;
-+
-+  return TRUE;
-+}
-+
-+/* Final link routine.  We need to use a call back to get the correct
-+   offsets in the output file.  And we need to malloc some internal
-+   buffers.  */
-+
-+#define MY_bfd_final_link m68kmint_prg_bfd_final_link
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  struct bfd_link_hash_table *hash = info->hash;
-+  enum bfd_link_strip original_strip = info->strip;
-+
-+  if (info->relocatable)
-+    {
-+      _bfd_error_handler ("%B: relocatable output is not supported by format %s",
-+	abfd, bfd_get_target (abfd));
-+      bfd_set_error (bfd_error_invalid_operation);
-+      return FALSE;
-+    }
-+
-+  myinfo->linkinfo = info;
-+
-+  /* Make sure that for now we never write zmagics.  */
-+  abfd->flags &= ~D_PAGED;
-+
-+  /* Find the __stksize symbol.  This symbol is used for a MiNT
-+     special kludge.  The libc defines this symbol in an object file
-+     initialized to a default value to make sure it is defined in
-+     every output file.  The start-up code in crtinit() then simply
-+     sets the stacksize accordingly.  In your programs (if they need
-+     an unusual stacksize) you can then simply code:
-+
-+	   long _stksize = 0x2000;
-+
-+     This will create a program stack of 2k.  Since MiNT cannot detect
-+     a stack overflow this is the only way to prevent program crashes
-+     caused by a stack that is too small.
-+
-+     The ancient linker ignored this feature, the ancient strip
-+     program paid heed to it.  By default, strip never stripped this
-+     special symbol from the binary.
-+
-+     Another program called ``printstk'' and its colleague ``fixstk''
-+     could be used to either print the current value of the stacksize
-+     or to modify it without recompiling and rebuilding.  These
-+     programs traversed the symbol table and then took the appropriate
-+     measures if the symbol was found.
-+
-+     Here we do a different approach.  Since we already expanded the
-+     standard executable header we now hardcode the address (as a file
-+     offset) that the __stksize symbol points to into the header.  We
-+     can now let strip safely remove the entry from the symbol table
-+     and we're not dependent on a special format of the symbol table.
-+     Because the address is kept in the header we will always be able
-+     to manipulate the stacksize value later.  */
-+  if (hash != NULL)
-+    {
-+      struct aout_link_hash_entry *h =
-+	aout_link_hash_lookup (aout_hash_table (info), "__stksize",
-+			       FALSE, FALSE, FALSE);
-+      asection *sec;
-+
-+      if (h != NULL)
-+	{
-+	  switch (h->root.type)
-+	    {
-+	    case bfd_link_hash_defined:
-+	    case bfd_link_hash_defweak:
-+	      sec = h->root.u.def.section->output_section;
-+	      BFD_ASSERT (sec->owner == abfd);
-+
-+	      myinfo->stkpos = (h->root.u.def.value + sec->vma
-+				+ h->root.u.def.section->output_offset
-+				+ GEMDOS_HEADER_SIZE);
-+	      break;
-+	    default:  /* Ignore other types.  */
-+	      break;
-+	    }
-+	}
-+    }
-+
-+  if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
-+    {
-+      myinfo->traditional_format = TRUE;
-+      myinfo->symbol_format = _MINT_SYMBOL_FORMAT_DRI;
-+    }
-+
-+  /* Unconditionally unset the traditional flag.  The only effect in
-+     the a.out code is to disable string hashing (with respect to
-+     SunOS gdx).  This is not necessary for us.  */
-+
-+  abfd->flags &= ~BFD_TRADITIONAL_FORMAT;
-+
-+  /* Do not write GNU symbols in traditional format.  */
-+  if (myinfo->traditional_format)
-+    info->strip = strip_all;
-+
-+  if (NAME(aout,final_link) (abfd, info, MY_final_link_callback)
-+      != TRUE)
-+    return FALSE;
-+
-+  if (myinfo->reloc_error)
-+    return FALSE;
-+
-+  /* Restore the strip status for the traditional symbols.  */
-+  info->strip = original_strip;
-+
-+  if (myinfo->traditional_format
-+      && link_write_traditional_syms (abfd, info) != TRUE)
-+    return FALSE;
-+
-+  if (fill_tparel (abfd) != TRUE)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Copy private BFD header information from the input BFD.  */
-+
-+#define MY_bfd_copy_private_header_data m68kmint_prg_bfd_copy_private_header_data
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_copy_private_header_data (bfd *ibfd, bfd *obfd)
-+{
-+  (void)obfd; /* Unused.  */
-+
-+  /* We can only copy BFD files using our own file format.  */
-+  if (ibfd->xvec != &m68kmint_prg_vec)
-+    {
-+      _bfd_error_handler ("%B: cannot convert from format %s to format %s",
-+	ibfd, bfd_get_target (ibfd), bfd_get_target (obfd));
-+      bfd_set_error (bfd_error_invalid_operation);
-+      return FALSE;
-+    }
-+
-+  return TRUE;
-+}
-+
-+/* Copy backend specific data from one object module to another.
-+   This function is used by objcopy and strip.  */
-+
-+#define MY_bfd_copy_private_bfd_data m68kmint_prg_bfd_copy_private_bfd_data
-+
-+static bfd_boolean
-+m68kmint_prg_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
-+{
-+  struct mint_internal_info *myinfo_in;
-+  struct mint_internal_info *myinfo_out;
-+
-+  /* obfd uses our file format, ibfd may be foreign.  */
-+  if (ibfd->xvec != &m68kmint_prg_vec)
-+    return TRUE;
-+
-+  myinfo_in = obj_aout_ext (ibfd);
-+  BFD_ASSERT (myinfo_in != NULL);
-+
-+  myinfo_out = obj_aout_ext (obfd);
-+  BFD_ASSERT (myinfo_out != NULL);
-+
-+  /* Copy myinfo.  */
-+  memcpy (myinfo_out, myinfo_in, sizeof (*myinfo_out));
-+
-+  /* Copy tparel.  */
-+  myinfo_out->tparel = bfd_alloc (obfd, myinfo_out->tparel_size);
-+  if (myinfo_out->tparel == NULL)
-+    return FALSE;
-+  memcpy (myinfo_out->tparel, myinfo_in->tparel, myinfo_out->tparel_size);
-+
-+  /* Normalize the type of empty symbols.  */
-+  if (bfd_get_symcount (obfd) == 0)
-+    myinfo_out->symbol_format = _MINT_SYMBOL_FORMAT_GNU;
-+
-+  return TRUE; /* _bfd_generic_bfd_copy_private_bfd_data (ibfd, obfd); */
-+}
-+
-+/* Merge private BFD information from an input BFD to the output BFD when linking.  */
-+
-+#define MY_bfd_merge_private_bfd_data m68kmint_prg_merge_private_bfd_data
-+
-+static bfd_boolean
-+m68kmint_prg_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
-+{
-+  (void)obfd; /* Unused.  */
-+
-+  /* Our file format cannot be used as linker input.  */
-+  if (ibfd->xvec == &m68kmint_prg_vec)
-+    {
-+      _bfd_error_handler ("%B: file format %s cannot be used as linker input",
-+	ibfd, bfd_get_target (ibfd));
-+      bfd_set_error (bfd_error_invalid_operation);
-+      return FALSE;
-+    }
-+
-+  return TRUE; /* _bfd_generic_bfd_merge_private_bfd_data (ibfd, obfd); */
-+}
-+
-+/* Find out the symbol name.  */
-+
-+static const char *
-+find_symbol_name (reloc_howto_type *howto, bfd *input_bfd,
-+		  bfd_byte *location, struct reloc_std_external *rel)
-+{
-+  struct external_nlist *syms = obj_aout_external_syms (input_bfd);
-+  char *strings = obj_aout_external_strings (input_bfd);
-+  struct aout_link_hash_entry **sym_hashes
-+    = obj_aout_sym_hashes (input_bfd);
-+  struct aout_link_hash_entry *h = NULL;
-+  const char *name;
-+  bfd_size_type r_index;
-+  int r_extern;
-+
-+  if (bfd_get_reloc_size (howto) != 4)
-+    return "(not a symbol)";
-+
-+  /* The input bfd is always big-endian.  There is no need to
-+     call bfd_header_big_endian (input_bfd).  */
-+  r_index  = ((rel->r_index[0] << 16)
-+	      | (rel->r_index[1] << 8)
-+	      | (rel->r_index[2]));
-+  r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
-+
-+  if (sym_hashes != NULL)
-+    h = sym_hashes[r_index];
-+
-+  if (!r_extern)
-+    {
-+      bfd_size_type i;
-+      bfd_vma wanted_value = bfd_get_32 (input_bfd, location);
-+
-+      name = NULL;
-+      for (i = 0; i < obj_aout_external_sym_count (input_bfd); i++)
-+	{
-+	  bfd_vma this_value = bfd_get_32 (input_bfd, syms[i].e_value);
-+
-+	  if (this_value == wanted_value)
-+	    {
-+	      bfd_byte symtype = bfd_get_8 (input_bfd, syms[i].e_type);
-+
-+	      /* Skip debug symbols and the like.  */
-+	      if ((symtype & N_STAB) != 0)
-+		continue;
-+
-+	      /* This is dirty but preferable to a plethoria of
-+		 single comparisons.  */
-+	      if (symtype <= (N_BSS | N_EXT)
-+		  || (symtype >= N_WEAKU && symtype <= N_COMM))
-+		{
-+		  name = strings + GET_WORD (input_bfd, syms[i].e_strx);
-+		  break;
-+		}
-+	    }
-+	}
-+
-+      /* FIXME:  If the relocation is against a section there is
-+	 probably a symbol for that section floating around somewhere
-+	 in the bfd jungle.  */
-+      if (name == NULL)
-+	{
-+	  switch ((r_index & N_TYPE) & ~N_EXT)
-+	    {
-+	    case N_TEXT:
-+	      name = "text section";
-+	      break;
-+	    case N_DATA:
-+	      name = "data section";
-+	      break;
-+	    case N_BSS:
-+	      name = "bss section";
-+	      break;
-+	    case N_ABS:
-+	      name = "absolute section";
-+	      break;
-+	    default:
-+	      name = "unknown section";
-+	      break;
-+	    }
-+	}
-+    }
-+  else if (h != NULL)
-+    name = h->root.root.string;
-+  else if (r_index >= obj_aout_external_sym_count (input_bfd))
-+    name = "(unknown symbol)";	/* Shouldn't happen.  */
-+  else
-+    name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
-+
-+  return name;
-+}
-+
-+/* This relocation routine is used by some of the backend linkers.
-+   They do not construct asymbol or arelent structures, so there is no
-+   reason for them to use bfd_perform_relocation.  Also,
-+   bfd_perform_relocation is so hacked up it is easier to write a new
-+   function than to try to deal with it.
-+
-+   This routine does a final relocation.  Whether it is useful for a
-+   relocatable link depends upon how the object format defines
-+   relocations.
-+
-+   FIXME: This routine ignores any special_function in the HOWTO,
-+   since the existing special_function values have been written for
-+   bfd_perform_relocation.
-+
-+   HOWTO is the reloc howto information.
-+   INPUT_BFD is the BFD which the reloc applies to.
-+   INPUT_SECTION is the section which the reloc applies to.
-+   CONTENTS is the contents of the section.
-+   ADDRESS is the address of the reloc within INPUT_SECTION.
-+   VALUE is the value of the symbol the reloc refers to.
-+   ADDEND is the addend of the reloc.  */
-+
-+/* The additional parameter REL is specific to this backend.
-+   This function is derived from _bfd_final_link_relocate()
-+   found in reloc.c. It adds additional checking for dangerous
-+   relocations in MiNT sharable text sections, then it records
-+   the relocated offset in myinfo->relocs[] for further processing.  */
-+
-+static bfd_reloc_status_type
-+m68kmint_prg_final_link_relocate_rel (reloc_howto_type *howto,
-+				      bfd *input_bfd,
-+				      asection *input_section,
-+				      bfd_byte *contents,
-+				      bfd_vma address,
-+				      bfd_vma value,
-+				      bfd_vma addend,
-+				      struct reloc_std_external *rel)
-+{
-+  bfd_vma relocation;
-+  bfd *output_bfd = input_section->output_section->owner;
-+  struct mint_internal_info *myinfo = obj_aout_ext (output_bfd);
-+  bfd_reloc_status_type retval;
-+  int r_index;
-+  int r_extern;
-+  bfd_boolean need_tpa_relocation;
-+
-+  /* The input bfd is always big-endian.  There is no need to
-+     call bfd_header_big_endian (input_bfd).  */
-+  r_index  = ((rel->r_index[0] << 16)
-+	      | (rel->r_index[1] << 8)
-+	      | (rel->r_index[2]));
-+  r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
-+
-+#define _MINT_F_SHTEXT 0x800
-+
-+  /* Sanity check the address.  */
-+  if (address > bfd_get_section_limit (input_bfd, input_section))
-+    return bfd_reloc_outofrange;
-+
-+  /* This function assumes that we are dealing with a basic relocation
-+     against a symbol.  We want to compute the value of the symbol to
-+     relocate to.  This is just VALUE, the value of the symbol, plus
-+     ADDEND, any addend associated with the reloc.  */
-+  relocation = value + addend;
-+
-+  /* Check for dangerous relocations in images with a sharable
-+     text section.  */
-+  if ((myinfo->prg_flags & _MINT_F_SHTEXT) != 0
-+      && bfd_get_reloc_size (howto) == 4)
-+    {
-+      bfd_boolean error_found = FALSE;
-+      const char *name = NULL;
-+
-+      if (input_section == obj_textsec (input_bfd))
-+	{
-+	  if (!r_extern)
-+	    {
-+	      /* This is a relocation against another section.  Only
-+		 relocations against the text section are allowed.  */
-+	      if (r_index != N_TEXT && r_index != (N_TEXT | N_EXT))
-+		error_found = TRUE;
-+	    }
-+	  else if (relocation > (input_section->output_section->vma
-+			    + input_section->output_section->size))
-+	    {
-+	      error_found = TRUE;
-+	    }
-+	  else if (relocation == (input_section->output_section->vma
-+				  + input_section->output_section->size))
-+	    {
-+	      name = find_symbol_name (howto, input_bfd,
-+						    contents + address,
-+						    rel);
-+	      if (strcmp (name, "_etext") == 0)
-+		error_found = FALSE;
-+	    }
-+	}
-+
-+      if (error_found)
-+	{
-+	  const struct bfd_link_callbacks *callbacks
-+	    = myinfo->linkinfo->callbacks;
-+
-+	  myinfo->reloc_error = TRUE;
-+
-+	  if (callbacks->reloc_dangerous != NULL)
-+	    {
-+	      if (name == NULL)
-+		name = find_symbol_name (howto, input_bfd,
-+						      contents + address,
-+						      rel);
-+
-+	      callbacks->reloc_dangerous (myinfo->linkinfo, name,
-+					  input_bfd,
-+					  input_section, address);
-+	    }
-+	}
-+    }
-+
-+  /* If the relocation is PC relative, we want to set RELOCATION to
-+     the distance between the symbol (currently in RELOCATION) and the
-+     location we are relocating.  Some targets (e.g., i386-aout)
-+     arrange for the contents of the section to be the negative of the
-+     offset of the location within the section; for such targets
-+     pcrel_offset is FALSE.  Other targets (e.g., m88kbcs or ELF)
-+     simply leave the contents of the section as zero; for such
-+     targets pcrel_offset is TRUE.  If pcrel_offset is FALSE we do not
-+     need to subtract out the offset of the location within the
-+     section (which is just ADDRESS).  */
-+  if (howto->pc_relative)
-+    {
-+      relocation -= (input_section->output_section->vma
-+		     + input_section->output_offset);
-+      if (howto->pcrel_offset)
-+	relocation -= address;
-+    }
-+
-+  retval = _bfd_relocate_contents (howto, input_bfd, relocation,
-+				   contents + address);
-+
-+  /* The symbol has to be relocated again iff the length of the relocation
-+     is 2 words and it is not pc relative.  */
-+  need_tpa_relocation = FALSE;
-+  if (!howto->pc_relative && bfd_get_reloc_size (howto) == 4)
-+    {
-+      if (r_extern)
-+	{
-+	  struct aout_link_hash_entry **sym_hashes = obj_aout_sym_hashes (input_bfd);
-+	  struct aout_link_hash_entry *h = sym_hashes[r_index];
-+	  asection *output_section = h->root.u.def.section->output_section;
-+
-+	  /* Do not relocate absolute symbols.  */
-+	  if (output_section == obj_textsec (output_bfd)
-+	      || output_section == obj_datasec (output_bfd)
-+	      || output_section == obj_bsssec (output_bfd))
-+	    {
-+	      need_tpa_relocation = TRUE;
-+	    }
-+	}
-+      else
-+	{
-+	  need_tpa_relocation = TRUE;
-+	}
-+    }
-+
-+  /* Here we add the TPA relocation entries for the address references
-+     located inside the input sections. Note that if some references
-+     to addresses are generated using data statements in the linker
-+     script, they will not be relocated here because they do not
-+     belong to any input section.  */
-+  if (need_tpa_relocation)
-+    {
-+      bfd_vma tpa_address = input_section->output_section->vma
-+	+ input_section->output_offset + address;
-+
-+      if (!bfd_m68kmint_add_tpa_relocation_entry(output_bfd, tpa_address))
-+	return bfd_reloc_other;
-+    }
-+
-+  return retval;
-+}
-+
-+/* Write out the TPA relocation table.  */
-+
-+static bfd_boolean
-+write_tparel (bfd *abfd, struct internal_exec *execp)
-+{
-+  struct mint_internal_info* myinfo = obj_aout_ext (abfd);
-+
-+  if (myinfo->dri_symtab_size == 0)
-+    myinfo->tparel_pos = N_STROFF (*execp)
-+      + obj_aout_external_string_size (abfd);
-+  else
-+    myinfo->tparel_pos = N_SYMOFF (*execp)
-+      + myinfo->dri_symtab_size;
-+
-+  if (bfd_seek (abfd, myinfo->tparel_pos, SEEK_SET) != 0)
-+    return FALSE;
-+
-+  if (bfd_bwrite (myinfo->tparel, myinfo->tparel_size, abfd)
-+      != myinfo->tparel_size)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Write the full exec header.
-+   This function must be called last to ensure that we have all the
-+   information needed to fill the MiNT-specific header fields.  */
-+
-+static bfd_boolean
-+write_exec_header (bfd *abfd, struct internal_exec *execp, struct external_exec *exec_bytes)
-+{
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  bfd_size_type symtab_size;
-+
-+  bfd_h_put_16 (abfd, 0x601a, exec_bytes->g_branch);
-+
-+  /* The OS will load our extension header fields into the text segment.  */
-+  bfd_h_put_32 (abfd, execp->a_text + (EXEC_BYTES_SIZE - GEMDOS_HEADER_SIZE),
-+		exec_bytes->g_text);
-+  bfd_h_put_32 (abfd, execp->a_data, exec_bytes->g_data);
-+  bfd_h_put_32 (abfd, execp->a_bss, exec_bytes->g_bss);
-+
-+  /* The OS' notion of the size of the symbol table is another than
-+     the bfd library's.  We have to fill in the size of the table
-+     itself plus the size of the string table but only if we have not written
-+     a traditional symbol table.  If we have written a traditional symbol
-+     table we know the size.  */
-+  if (myinfo->dri_symtab_size != 0)
-+    symtab_size = myinfo->dri_symtab_size;
-+  else
-+    symtab_size = myinfo->tparel_pos - N_SYMOFF (*execp);
-+
-+  bfd_h_put_32 (abfd, symtab_size, exec_bytes->g_syms);
-+
-+  bfd_h_put_32 (abfd, 0x4d694e54, exec_bytes->g_extmagic);
-+  bfd_h_put_32 (abfd, myinfo->prg_flags, exec_bytes->g_flags);
-+  bfd_h_put_16 (abfd, 0, exec_bytes->g_abs);
-+
-+  /* Generate the jump instruction to the entry point.  In m68k
-+     assembler mnemnonics it looks more or less like this:
-+
-+       move.l  exec_bytes->e_entry(pc),d0
-+       jmp     -6(pc,d0.l)
-+
-+     Sorry for the wrong syntax.  As a real assembler addict I
-+     never actually use an assembler.  I edit my binaries manually
-+     with a hex editor, looks much cooler and it strengthens your
-+     abstraction abilities.  */
-+
-+  exec_bytes->g_jump_entry[0] = 0x20;
-+  exec_bytes->g_jump_entry[1] = 0x3a;
-+  exec_bytes->g_jump_entry[2] = 0x00;
-+  exec_bytes->g_jump_entry[3] = 0x1a;
-+  exec_bytes->g_jump_entry[4] = 0x4e;
-+  exec_bytes->g_jump_entry[5] = 0xfb;
-+  exec_bytes->g_jump_entry[6] = 0x08;
-+  exec_bytes->g_jump_entry[7] = 0xfa;
-+
-+  bfd_h_put_32 (abfd, myinfo->tparel_pos, exec_bytes->g_tparel_pos);
-+  bfd_h_put_32 (abfd, myinfo->tparel_size, exec_bytes->g_tparel_size);
-+  bfd_h_put_32 (abfd, myinfo->stkpos, exec_bytes->g_stkpos);
-+
-+  /* If there are no symbols, pretend they are in GNU format.  */
-+  if (symtab_size == 0)
-+    myinfo->symbol_format = _MINT_SYMBOL_FORMAT_GNU;
-+
-+  bfd_h_put_32 (abfd, myinfo->symbol_format, exec_bytes->g_symbol_format);
-+
-+  memset (&exec_bytes->g_pad0, 0, sizeof (exec_bytes->g_pad0));
-+
-+  /* The standard stuff.  */
-+  NAME(aout, swap_exec_header_out) (abfd, execp, exec_bytes);
-+  if (myinfo->symbol_format != _MINT_SYMBOL_FORMAT_GNU)
-+    PUT_WORD (abfd, 0, exec_bytes->e_syms);
-+
-+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
-+    return FALSE;
-+
-+  if (bfd_bwrite (exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
-+      != EXEC_BYTES_SIZE)
-+    return FALSE;
-+
-+  /* Override the stack size.  */
-+  if (myinfo->override_stack_size && myinfo->stkpos)
-+  {
-+    bfd_byte big_endian_stack_size[4];
-+
-+    bfd_put_32 (abfd, myinfo->stack_size, &big_endian_stack_size);
-+
-+    if (bfd_seek (abfd, (file_ptr) myinfo->stkpos, SEEK_SET) != 0)
-+      return FALSE;
-+
-+    if (bfd_bwrite (big_endian_stack_size, 4, abfd) != 4)
-+      return FALSE;
-+  }
-+
-+  return TRUE;
-+}
-+
-+/* Write an object file.
-+   Section contents have already been written.  We write the
-+   file header, symbols, and relocation.  */
-+
-+#define MY_write_object_contents m68kmint_prg_write_object_contents
-+
-+static bfd_boolean
-+m68kmint_prg_write_object_contents (bfd *abfd)
-+{
-+  struct external_exec exec_bytes;
-+  struct internal_exec *execp = exec_hdr (abfd);
-+  bfd_size_type text_size;
-+  file_ptr text_end;
-+
-+  BFD_ASSERT (obj_aout_ext (abfd) != NULL);
-+
-+  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-+
-+  /* Most of the following code come from the WRITE_HEADERS macro
-+     found in libaout.h.  */
-+
-+  if (adata(abfd).magic == undecided_magic)
-+    NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end);
-+
-+  execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE;
-+  execp->a_entry = bfd_get_start_address (abfd);
-+
-+  execp->a_trsize = ((obj_textsec (abfd)->reloc_count) *
-+		     obj_reloc_entry_size (abfd));
-+  execp->a_drsize = ((obj_datasec (abfd)->reloc_count) *
-+		     obj_reloc_entry_size (abfd));
-+
-+  /* Now write out reloc info, followed by syms and strings.  */
-+
-+  if (bfd_get_outsymbols (abfd) != NULL
-+      && bfd_get_symcount (abfd) != 0)
-+    {
-+      if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)
-+	return FALSE;
-+
-+      if (! NAME (aout, write_syms) (abfd))
-+	return FALSE;
-+    }
-+
-+  if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0)
-+    return FALSE;
-+  if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd)))
-+    return FALSE;
-+
-+  if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0)
-+    return FALSE;
-+  if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
-+    return FALSE;
-+
-+  if (write_tparel (abfd, execp) != TRUE)
-+    return FALSE;
-+
-+  if (write_exec_header (abfd, execp, &exec_bytes) != TRUE)
-+    return FALSE;
-+
-+  return TRUE;
-+}
-+
-+/* Print private BFD data. Used by objdump -p.  */
-+
-+#define MY_bfd_print_private_bfd_data m68kmint_prg_print_private_bfd_data
-+
-+static bfd_boolean
-+m68kmint_prg_print_private_bfd_data (bfd *abfd, void *ptr)
-+{
-+  FILE *file = (FILE *) ptr;
-+  struct mint_internal_info *myinfo = obj_aout_ext (abfd);
-+  const char* symbol_format;
-+  long stksize = 0;
-+
-+  fprintf (file, "\n");
-+
-+  fprintf (file, " GEMDOS flags: 0x%08lx\n", (unsigned long) myinfo->prg_flags);
-+  fprintf (file, "Start address: 0x%08lx\n", bfd_get_start_address (abfd));
-+
-+  /* Stack size.  */
-+  if (myinfo->stkpos != 0)
-+    {
-+      if (bfd_seek (abfd, myinfo->stkpos, SEEK_SET) != 0
-+	  || (bfd_bread (&stksize, sizeof(long), abfd) != sizeof(long)))
-+	return FALSE;
-+
-+      stksize = bfd_get_signed_32 (abfd, &stksize);
-+    }
-+  fprintf (file, "   Stack size: %ld\n", stksize);
-+
-+  /* Symbol format.  */
-+  switch (myinfo->symbol_format)
-+    {
-+      case _MINT_SYMBOL_FORMAT_GNU: symbol_format = "stabs"; break;
-+      case _MINT_SYMBOL_FORMAT_DRI: symbol_format = "DRI";   break;
-+      default:			    symbol_format = "?";     break;
-+    }
-+  fprintf (file, "Symbol format: %s\n", symbol_format);
-+
-+  return TRUE;
-+}
-+
-+/* Special case for NAME (aout, get_section_contents)
-+   It is not declared in libaout.h, neither implemented in aoutx.h.
-+   Instead, a macro named aout_32_get_section_contents is defined in libaout.h.
-+   So the default value of MY_get_section_contents provided by aout-target.h
-+   is not correct, it has to be defined here with the right value.  */
-+
-+#define MY_get_section_contents aout_32_get_section_contents
-+
-+/* The following include will define m68kmint_prg_vec
-+   and a default implementation for all the MY_ functions
-+   not overriden here.  */
-+
-+#include "aout-target.h"
-+
-+/* Set the GEMDOS executable flags.
-+   It is called by the linker emulation script.  */
-+
-+bfd_boolean
-+bfd_m68kmint_set_extended_flags (bfd *abfd, flagword prg_flags)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  BFD_ASSERT(abfd->xvec == &m68kmint_prg_vec);
-+  myinfo = obj_aout_ext (abfd);
-+  BFD_ASSERT(myinfo != NULL);
-+
-+  myinfo->prg_flags = prg_flags;
-+
-+  return TRUE;
-+}
-+
-+/* Override the stack size.
-+   It is called by the linker emulation script.  */
-+
-+bfd_boolean
-+bfd_m68kmint_set_stack_size (bfd *abfd, bfd_signed_vma stack_size)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  BFD_ASSERT(abfd->xvec == &m68kmint_prg_vec);
-+  myinfo = obj_aout_ext (abfd);
-+  BFD_ASSERT(myinfo != NULL);
-+
-+  myinfo->stack_size = stack_size;
-+  myinfo->override_stack_size = TRUE;
-+
-+  return TRUE;
-+}
-+
-+/* Add a TPA relocation entry.
-+   It is called by BFD when linking the input sections, and by the
-+   linker when it generates a reference to an address (in particular,
-+   when building the constructors list).  */
-+
-+bfd_boolean
-+bfd_m68kmint_add_tpa_relocation_entry (bfd *abfd, bfd_vma address)
-+{
-+  struct mint_internal_info *myinfo;
-+
-+  BFD_ASSERT(abfd->xvec == &m68kmint_prg_vec);
-+  myinfo = obj_aout_ext (abfd);
-+  BFD_ASSERT(myinfo != NULL);
-+
-+  /* Enlarge the buffer if necessary.  */
-+  if (myinfo->relocs_used * sizeof (bfd_vma) >= myinfo->relocs_allocated)
-+    {
-+      bfd_vma *newbuf;
-+      myinfo->relocs_allocated += MINT_RELOC_CHUNKSIZE;
-+      newbuf = bfd_realloc (myinfo->relocs, myinfo->relocs_allocated);
-+      if (newbuf == NULL)
-+	return FALSE;
-+
-+      myinfo->relocs = newbuf;
-+    }
-+
-+  /* The TPA relative relocation actually just adds the address of
-+     the text segment (i. e. beginning of the executable in memory)
-+     to the addresses at the specified locations.  This allows an
-+     executable to be loaded everywhere in the address space without
-+     memory management.  */
-+  myinfo->relocs[myinfo->relocs_used++] = address;
-+
-+  return TRUE;
-+}
-diff -ur --new-file binutils-2.21.51.0.7/bfd/targets.c binutils-2.21.51.0.7-mint/bfd/targets.c
---- binutils-2.21.51.0.7/bfd/targets.c	2011-01-04 17:51:04.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/bfd/targets.c	2011-04-08 10:07:08.000000000 +0000
-@@ -770,6 +770,7 @@
- extern const bfd_target m68kcoff_vec;
- extern const bfd_target m68kcoffun_vec;
- extern const bfd_target m68klinux_vec;
-+extern const bfd_target m68kmint_prg_vec;
- extern const bfd_target m68knetbsd_vec;
- extern const bfd_target m68ksysvcoff_vec;
- extern const bfd_target m88kbcs_vec;
-diff -ur --new-file binutils-2.21.51.0.7/binutils/configure binutils-2.21.51.0.7-mint/binutils/configure
---- binutils-2.21.51.0.7/binutils/configure	2011-03-07 18:05:31.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/binutils/configure	2011-04-08 10:07:09.000000000 +0000
-@@ -13041,7 +13041,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
-  ;;
-diff -ur --new-file binutils-2.21.51.0.7/binutils/dlltool.c binutils-2.21.51.0.7-mint/binutils/dlltool.c
---- binutils-2.21.51.0.7/binutils/dlltool.c	2010-12-06 14:23:54.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/binutils/dlltool.c	2011-04-08 10:07:09.000000000 +0000
-@@ -4360,7 +4360,7 @@
-       if (*cp == '-')
- 	dash = cp;
-       if (
--#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__)
-+#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__) || defined(__MINT__)
- 	  *cp == ':' || *cp == '\\' ||
- #endif
- 	  *cp == '/')
-diff -ur --new-file binutils-2.21.51.0.7/binutils/dllwrap.c binutils-2.21.51.0.7-mint/binutils/dllwrap.c
---- binutils-2.21.51.0.7/binutils/dllwrap.c	2010-08-11 21:51:51.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/binutils/dllwrap.c	2011-04-08 10:07:09.000000000 +0000
-@@ -263,7 +263,7 @@
- 	dash = cp;
- 
-       if (
--#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__)
-+#if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__) || defined(__MINT__)
- 	  *cp == ':' || *cp == '\\' ||
- #endif
- 	  *cp == '/')
-diff -ur --new-file binutils-2.21.51.0.7/binutils/readelf.c binutils-2.21.51.0.7-mint/binutils/readelf.c
---- binutils-2.21.51.0.7/binutils/readelf.c	2011-04-08 09:37:05.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/binutils/readelf.c	2011-04-08 10:07:10.000000000 +0000
-@@ -9903,7 +9903,11 @@
- #ifndef __MSVCRT__
- 	  /* PR 11128: Use two separate invocations in order to work
-              around bugs in the Solaris 8 implementation of printf.  */
-+#if GCC_VERSION < 3000
-+	  printf ("  [%6lx]  ", (unsigned long) (data - start));
-+#else
- 	  printf ("  [%6tx]  ", data - start);
-+#endif
- 	  printf ("%s\n", data);
- #else
- 	  printf ("  [%6Ix]  %s\n", (size_t) (data - start), data);
-diff -ur --new-file binutils-2.21.51.0.7/binutils/resrc.c binutils-2.21.51.0.7-mint/binutils/resrc.c
---- binutils-2.21.51.0.7/binutils/resrc.c	2010-12-06 14:23:55.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/binutils/resrc.c	2011-04-08 10:07:10.000000000 +0000
-@@ -396,7 +396,7 @@
-     *space = 0;
- 
-   if (
--#if defined (__DJGPP__) || defined (__CYGWIN__) || defined (_WIN32)
-+#if defined (__DJGPP__) || defined (__CYGWIN__) || defined (_WIN32) || defined (__MINT__)
-       strchr (cmd, '\\') ||
- #endif
-       strchr (cmd, '/'))
-@@ -514,7 +514,7 @@
- 	  if (*cp == '-')
- 	    dash = cp;
- 	  if (
--#if defined (__DJGPP__) || defined (__CYGWIN__) || defined(_WIN32)
-+#if defined (__DJGPP__) || defined (__CYGWIN__) || defined(_WIN32) || defined (__MINT__)
- 	      *cp == ':' || *cp == '\\' ||
- #endif
- 	      *cp == '/')
-diff -ur --new-file binutils-2.21.51.0.7/gas/config/te-mint.h binutils-2.21.51.0.7-mint/gas/config/te-mint.h
---- binutils-2.21.51.0.7/gas/config/te-mint.h	1970-01-01 00:00:00.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/gas/config/te-mint.h	2011-04-08 10:07:10.000000000 +0000
-@@ -0,0 +1,30 @@
-+/* Copyright 2008 Free Software Foundation, Inc.
-+
-+   This file is part of GAS, the GNU Assembler.
-+
-+   GAS is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as
-+   published by the Free Software Foundation; either version 3,
-+   or (at your option) any later version.
-+
-+   GAS is distributed in the hope that it will be useful, but
-+   WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-+   the GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with GAS; see the file COPYING.  If not, write to the Free
-+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
-+   02110-1301, USA.  */
-+
-+#define TE_MINT
-+
-+#define LOCAL_LABELS_DOLLAR 1
-+#define LOCAL_LABELS_FB 1
-+
-+/* These define interfaces.  */
-+#ifdef   OBJ_HEADER
-+#include OBJ_HEADER
-+#else
-+#include "obj-format.h"
-+#endif
-diff -ur --new-file binutils-2.21.51.0.7/gas/configure.tgt binutils-2.21.51.0.7-mint/gas/configure.tgt
---- binutils-2.21.51.0.7/gas/configure.tgt	2011-01-04 17:51:04.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/gas/configure.tgt	2011-04-08 10:07:10.000000000 +0000
-@@ -266,6 +266,7 @@
-   m68k-*-linux-*)			fmt=elf em=linux ;;
-   m68k-*-uclinux*)			fmt=elf em=uclinux ;;
-   m68k-*-gnu*)				fmt=elf ;;
-+  m68k-*-mint*)				fmt=aout em=mint bfd_gas=yes ;;
-   m68k-*-netbsdelf*)			fmt=elf em=nbsd ;;
-   m68k-*-netbsd*)			fmt=aout em=nbsd bfd_gas=yes ;;
-   m68k-*-openbsd*)			fmt=aout em=nbsd bfd_gas=yes ;;
-diff -ur --new-file binutils-2.21.51.0.7/gas/testsuite/gas/all/weakref1u.d binutils-2.21.51.0.7-mint/gas/testsuite/gas/all/weakref1u.d
---- binutils-2.21.51.0.7/gas/testsuite/gas/all/weakref1u.d	2009-11-11 16:52:57.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/gas/testsuite/gas/all/weakref1u.d	2011-04-08 10:07:10.000000000 +0000
-@@ -3,7 +3,7 @@
- #source: weakref1.s
- # aout turns undefined into *ABS* symbols.
- # see weakref1.d for comments on the other not-targets
--#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* ns32k-*-netbsd alpha*-*-osf* *-*-ecoff
-+#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* m68k-*-mint* ns32k-*-netbsd alpha*-*-osf* *-*-ecoff
- 
- # the rest of this file is generated with the following script:
- # # script begin
-diff -ur --new-file binutils-2.21.51.0.7/gas/testsuite/gas/m68k/all.exp binutils-2.21.51.0.7-mint/gas/testsuite/gas/m68k/all.exp
---- binutils-2.21.51.0.7/gas/testsuite/gas/m68k/all.exp	2011-03-07 18:05:32.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/gas/testsuite/gas/m68k/all.exp	2011-04-08 10:10:06.000000000 +0000
-@@ -71,7 +71,7 @@
- 
-     gas_test_error "p11673.s" "-march=isab" "movel immediate with offset unsupported on isab"
- 
--    if { [istarget *-*-*aout] || [istarget *-*-netbsd] || [istarget *-*-openbsd*] } then {
-+    if { [istarget *-*-*aout] || [istarget *-*-netbsd] || [istarget *-*-openbsd*] || [istarget *-*-mint*] } then {
-       run_dump_test p3041
-       run_dump_test p3041data
-       run_dump_test p3041pcrel
-diff -ur --new-file binutils-2.21.51.0.7/gas/testsuite/gas/m68k/br-isaa.d binutils-2.21.51.0.7-mint/gas/testsuite/gas/m68k/br-isaa.d
---- binutils-2.21.51.0.7/gas/testsuite/gas/m68k/br-isaa.d	2009-11-11 16:52:56.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/gas/testsuite/gas/m68k/br-isaa.d	2011-04-08 10:07:10.000000000 +0000
-@@ -1,7 +1,7 @@
- #name: br-isaa.d
- #objdump: -dr
- #as: -march=isaa -pcrel
--#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd*
-+#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* m68k-*-mint*
- 
- .*:     file format .*
- 
-diff -ur --new-file binutils-2.21.51.0.7/gas/testsuite/gas/m68k/br-isab.d binutils-2.21.51.0.7-mint/gas/testsuite/gas/m68k/br-isab.d
---- binutils-2.21.51.0.7/gas/testsuite/gas/m68k/br-isab.d	2009-11-11 16:52:56.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/gas/testsuite/gas/m68k/br-isab.d	2011-04-08 10:07:10.000000000 +0000
-@@ -1,7 +1,7 @@
- #name: br-isab.d
- #objdump: -dr
- #as: -march=isab -pcrel
--#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd*
-+#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* m68k-*-mint*
- 
- .*:     file format .*
- 
-diff -ur --new-file binutils-2.21.51.0.7/gas/testsuite/gas/m68k/br-isac.d binutils-2.21.51.0.7-mint/gas/testsuite/gas/m68k/br-isac.d
---- binutils-2.21.51.0.7/gas/testsuite/gas/m68k/br-isac.d	2009-11-11 16:52:56.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/gas/testsuite/gas/m68k/br-isac.d	2011-04-08 10:07:10.000000000 +0000
-@@ -1,7 +1,7 @@
- #name: br-isac.d
- #objdump: -dr
- #as: -march=isac -pcrel
--#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd*
-+#not-target: *-*-*aout m68k-*-netbsd m68k-*-openbsd* m68k-*-mint*
- 
- .*:     file format .*
- 
-diff -ur --new-file binutils-2.21.51.0.7/include/filenames.h binutils-2.21.51.0.7-mint/include/filenames.h
---- binutils-2.21.51.0.7/include/filenames.h	2011-03-07 18:05:32.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/include/filenames.h	2011-04-08 10:07:27.000000000 +0000
-@@ -30,7 +30,7 @@
- extern "C" {
- #endif
- 
--#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
-+#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) || defined (__MINT__)
- #  ifndef HAVE_DOS_BASED_FILE_SYSTEM
- #    define HAVE_DOS_BASED_FILE_SYSTEM 1
- #  endif
-diff -ur --new-file binutils-2.21.51.0.7/include/getopt.h binutils-2.21.51.0.7-mint/include/getopt.h
---- binutils-2.21.51.0.7/include/getopt.h	2005-05-10 22:46:48.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/include/getopt.h	2011-04-08 10:07:27.000000000 +0000
-@@ -106,7 +106,7 @@
-    to find the declaration so provide a fully prototyped one.  If it
-    is 1, we found it so don't provide any declaration at all.  */
- #if !HAVE_DECL_GETOPT
--#if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT)
-+#if defined (__GNU_LIBRARY__) || defined (__MINT__) || defined (HAVE_DECL_GETOPT)
- /* Many other libraries have conflicting prototypes for getopt, with
-    differences in the consts, in unistd.h.  To avoid compilation
-    errors, only prototype getopt for the GNU C library.  */
-diff -ur --new-file binutils-2.21.51.0.7/ld/Makefile.am binutils-2.21.51.0.7-mint/ld/Makefile.am
---- binutils-2.21.51.0.7/ld/Makefile.am	2011-03-07 18:05:32.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/ld/Makefile.am	2011-04-08 10:07:27.000000000 +0000
-@@ -308,6 +308,7 @@
- 	em68kelf.c \
- 	em68kelfnbsd.c \
- 	em68klinux.c \
-+	em68kmint.c \
- 	em68knbsd.c \
- 	em68kpsos.c \
- 	em88kbcs.c \
-@@ -1319,6 +1320,10 @@
- em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \
-   $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68klinux "$(tdir_m68klinux)"
-+em68kmint.c: $(srcdir)/emulparams/m68kmint.sh \
-+  $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/mint.em \
-+  $(srcdir)/scripttempl/m68kmint.sc ${GEN_DEPENDS}
-+	${GENSCRIPTS} m68kmint "$(tdir_m68kmint)"
- em68knbsd.c:	$(srcdir)/emulparams/m68knbsd.sh \
-   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)"
-diff -ur --new-file binutils-2.21.51.0.7/ld/Makefile.in binutils-2.21.51.0.7-mint/ld/Makefile.in
---- binutils-2.21.51.0.7/ld/Makefile.in	2011-03-07 18:05:32.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/ld/Makefile.in	2011-04-08 10:07:27.000000000 +0000
-@@ -614,6 +614,7 @@
- 	em68kelf.c \
- 	em68kelfnbsd.c \
- 	em68klinux.c \
-+	em68kmint.c \
- 	em68knbsd.c \
- 	em68kpsos.c \
- 	em88kbcs.c \
-@@ -1229,6 +1230,7 @@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68kelf.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68kelfnbsd.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68klinux.Po@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68kmint.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68knbsd.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em68kpsos.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/em88kbcs.Po@am__quote@
-@@ -2762,6 +2764,10 @@
- em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \
-   $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68klinux "$(tdir_m68klinux)"
-+em68kmint.c: $(srcdir)/emulparams/m68kmint.sh \
-+  $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/mint.em \
-+  $(srcdir)/scripttempl/m68kmint.sc ${GEN_DEPENDS}
-+	${GENSCRIPTS} m68kmint "$(tdir_m68kmint)"
- em68knbsd.c:	$(srcdir)/emulparams/m68knbsd.sh \
-   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
- 	${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)"
-diff -ur --new-file binutils-2.21.51.0.7/ld/configure binutils-2.21.51.0.7-mint/ld/configure
---- binutils-2.21.51.0.7/ld/configure	2011-03-07 18:05:32.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/ld/configure	2011-04-08 10:07:28.000000000 +0000
-@@ -16557,7 +16557,7 @@
- 
- 
- case "${host}" in
--*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
-+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows* | *-*-mint*)
- 
- $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h
-  ;;
-diff -ur --new-file binutils-2.21.51.0.7/ld/configure.tgt binutils-2.21.51.0.7-mint/ld/configure.tgt
---- binutils-2.21.51.0.7/ld/configure.tgt	2011-01-04 17:51:04.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/ld/configure.tgt	2011-04-08 10:07:28.000000000 +0000
-@@ -344,6 +344,7 @@
- 			tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` ;;
- m68k-*-uclinux*)	targ_emul=m68kelf ;;
- m68*-*-gnu*)		targ_emul=m68kelf ;;
-+m68*-*-mint*)		targ_emul=m68kmint ;;
- m68*-*-netbsd*4k*)	targ_emul=m68k4knbsd
- 			targ_extra_emuls="m68knbsd m68kelfnbsd" ;;
- m68*-*-netbsdelf*)	targ_emul=m68kelfnbsd
-diff -ur --new-file binutils-2.21.51.0.7/ld/emulparams/m68kmint.sh binutils-2.21.51.0.7-mint/ld/emulparams/m68kmint.sh
---- binutils-2.21.51.0.7/ld/emulparams/m68kmint.sh	1970-01-01 00:00:00.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/ld/emulparams/m68kmint.sh	2011-04-08 10:07:28.000000000 +0000
-@@ -0,0 +1,6 @@
-+SCRIPT_NAME=m68kmint
-+OUTPUT_FORMAT="a.out-mintprg"
-+RELOCATEABLE_OUTPUT_FORMAT="a.out-zero-big"
-+TEXT_START_ADDR=0xe4
-+ARCH=m68k
-+EXTRA_EM_FILE=mint
-diff -ur --new-file binutils-2.21.51.0.7/ld/emultempl/mint.em binutils-2.21.51.0.7-mint/ld/emultempl/mint.em
---- binutils-2.21.51.0.7/ld/emultempl/mint.em	1970-01-01 00:00:00.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/ld/emultempl/mint.em	2011-04-08 10:07:28.000000000 +0000
-@@ -0,0 +1,330 @@
-+# This shell script emits a C file. -*- C -*-
-+#   Copyright 2006, 2007 Free Software Foundation, Inc.
-+#
-+# This file is part of the GNU Binutils.
-+#
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-+# MA 02110-1301, USA.
-+#
-+
-+# This file is sourced from generic.em
-+#
-+fragment <<EOF
-+
-+#include "getopt.h"
-+#include "ldgram.h"
-+
-+/* Standard GEMDOS program flags.  */
-+#define _MINT_F_FASTLOAD      0x01    /* Don't clear heap.  */
-+#define _MINT_F_ALTLOAD       0x02    /* OK to load in alternate RAM.  */
-+#define _MINT_F_ALTALLOC      0x04    /* OK to malloc from alt. RAM.  */
-+#define _MINT_F_BESTFIT       0x08    /* Load with optimal heap size.  */
-+/* The memory flags are mutually exclusive.  */
-+#define _MINT_F_MEMPROTECTION 0xf0    /* Masks out protection bits.  */
-+#define _MINT_F_MEMPRIVATE    0x00    /* Memory is private.  */
-+#define _MINT_F_MEMGLOBAL     0x10    /* Read/write access to mem allowed.  */
-+#define _MINT_F_MEMSUPER      0x20    /* Only supervisor access allowed.  */
-+#define _MINT_F_MEMREADABLE   0x30    /* Any read access OK.  */
-+#define _MINT_F_SHTEXT        0x800   /* Program's text may be shared */
-+
-+/* Option flags.  */
-+static flagword prg_flags = (_MINT_F_FASTLOAD | _MINT_F_ALTLOAD
-+			     | _MINT_F_ALTALLOC | _MINT_F_MEMPRIVATE);
-+
-+/* If override_stack_size is TRUE, then the executable stack size
-+ * must be overriden with the value of stack_size.  */
-+static bfd_boolean override_stack_size = FALSE;
-+static bfd_signed_vma stack_size;
-+
-+/* MiNT format extra command line options.  */
-+
-+/* Used for setting flags in the MiNT header.  */
-+#define OPTION_FASTLOAD (300)
-+#define OPTION_NO_FASTLOAD (OPTION_FASTLOAD + 1)
-+#define OPTION_FASTRAM (OPTION_NO_FASTLOAD + 1)
-+#define OPTION_NO_FASTRAM (OPTION_FASTRAM + 1)
-+#define OPTION_FASTALLOC (OPTION_NO_FASTRAM + 1)
-+#define OPTION_NO_FASTALLOC (OPTION_FASTALLOC + 1)
-+#define OPTION_BESTFIT (OPTION_NO_FASTALLOC + 1)
-+#define OPTION_NO_BESTFIT (OPTION_BESTFIT + 1)
-+#define OPTION_BASEREL (OPTION_NO_BESTFIT + 1)
-+#define OPTION_NO_BASEREL (OPTION_BASEREL + 1)
-+#define OPTION_MEM_PRIVATE (OPTION_NO_BASEREL + 1)
-+#define OPTION_MEM_GLOBAL (OPTION_MEM_PRIVATE + 1)
-+#define OPTION_MEM_SUPER (OPTION_MEM_GLOBAL + 1)
-+#define OPTION_MEM_READONLY (OPTION_MEM_SUPER + 1)
-+#define OPTION_PRG_FLAGS (OPTION_MEM_READONLY + 1)
-+#define OPTION_STACK (OPTION_PRG_FLAGS + 1)
-+
-+static void
-+gld${EMULATION_NAME}_add_options
-+  (int ns ATTRIBUTE_UNUSED, char **shortopts ATTRIBUTE_UNUSED, int nl,
-+    struct option **longopts, int nrl ATTRIBUTE_UNUSED,
-+    struct option **really_longopts ATTRIBUTE_UNUSED)
-+{
-+  static const struct option xtra_long[] = {
-+    {"mfastload", no_argument, NULL, OPTION_FASTLOAD},
-+    {"mno-fastload", no_argument, NULL, OPTION_NO_FASTLOAD},
-+    {"mfastram", no_argument, NULL, OPTION_FASTRAM},
-+    {"mno-fastram", no_argument, NULL, OPTION_NO_FASTRAM},
-+    {"maltram", no_argument, NULL, OPTION_FASTRAM},
-+    {"mno-altram", no_argument, NULL, OPTION_NO_FASTRAM},
-+    {"mfastalloc", no_argument, NULL, OPTION_FASTALLOC},
-+    {"mno-fastalloc", no_argument, NULL, OPTION_NO_FASTALLOC},
-+    {"maltalloc", no_argument, NULL, OPTION_FASTALLOC},
-+    {"mno-altalloc", no_argument, NULL, OPTION_NO_FASTALLOC},
-+    {"mbest-fit", no_argument, NULL, OPTION_BESTFIT},
-+    {"mno-best-fit", no_argument, NULL, OPTION_NO_BESTFIT},
-+    {"mbaserel", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-baserel", no_argument, NULL, OPTION_NO_BASEREL},
-+    {"mshared-text", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-shared-text", no_argument, NULL, OPTION_NO_BASEREL},
-+    {"msharable-text", no_argument, NULL, OPTION_BASEREL},
-+    {"mno-sharable-text", no_argument, NULL, OPTION_NO_BASEREL},
-+    /* Memory protection bits.  */
-+    {"mprivate-memory", no_argument, NULL, OPTION_MEM_PRIVATE },
-+    {"mglobal-memory", no_argument, NULL, OPTION_MEM_GLOBAL},
-+    {"msuper-memory", no_argument, NULL, OPTION_MEM_SUPER},
-+    {"mreadable-memory", no_argument, NULL, OPTION_MEM_READONLY},
-+    {"mreadonly-memory", no_argument, NULL, OPTION_MEM_READONLY},
-+    {"mprg-flags", required_argument, NULL, OPTION_PRG_FLAGS},
-+    {"stack", required_argument, NULL, OPTION_STACK},
-+    {NULL, no_argument, NULL, 0}
-+  };
-+
-+  *longopts = (struct option *)
-+    xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
-+  memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
-+}
-+
-+static bfd_boolean
-+gld${EMULATION_NAME}_handle_option (int optc)
-+{
-+  switch (optc)
-+    {
-+    default:
-+      return FALSE;
-+
-+    case OPTION_FASTLOAD:
-+      prg_flags |= _MINT_F_FASTLOAD;
-+      break;
-+
-+    case OPTION_NO_FASTLOAD:
-+      prg_flags &= ~_MINT_F_FASTLOAD;
-+      break;
-+
-+    case OPTION_FASTRAM:
-+      prg_flags |= _MINT_F_ALTLOAD;
-+      break;
-+
-+    case OPTION_NO_FASTRAM:
-+      prg_flags &= ~_MINT_F_ALTLOAD;
-+      break;
-+
-+    case OPTION_FASTALLOC:
-+      prg_flags |= _MINT_F_ALTALLOC;
-+      break;
-+
-+    case OPTION_NO_FASTALLOC:
-+      prg_flags &= ~_MINT_F_ALTALLOC;
-+      break;
-+
-+    case OPTION_BESTFIT:
-+      prg_flags |= _MINT_F_BESTFIT;
-+      break;
-+
-+    case OPTION_NO_BESTFIT:
-+      prg_flags &= ~_MINT_F_BESTFIT;
-+      break;
-+
-+    case OPTION_BASEREL:
-+      prg_flags |= _MINT_F_SHTEXT;
-+      break;
-+
-+    case OPTION_NO_BASEREL:
-+      prg_flags &= ~_MINT_F_SHTEXT;
-+      break;
-+
-+    case OPTION_MEM_PRIVATE:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      break;
-+
-+    case OPTION_MEM_GLOBAL:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMPRIVATE;
-+      break;
-+
-+    case OPTION_MEM_SUPER:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMSUPER;
-+      break;
-+
-+    case OPTION_MEM_READONLY:
-+      prg_flags &= ~_MINT_F_MEMPROTECTION;
-+      prg_flags |= _MINT_F_MEMREADABLE;
-+      break;
-+
-+    case OPTION_PRG_FLAGS:
-+      {
-+	char* tail;
-+	unsigned long flag_value = strtoul (optarg, &tail, 0);
-+
-+	if (*tail != '\0')
-+	  einfo (_("%P: warning: ignoring invalid program flags %s\n"), optarg);
-+	else
-+	  prg_flags = flag_value;
-+
-+	break;
-+      }
-+    case OPTION_STACK:
-+      {
-+	char* tail;
-+	long size = strtol (optarg, &tail, 0);
-+
-+	if (*tail == 'K' || *tail == 'k')
-+	  {
-+	    size *= 1024;
-+	    ++tail;
-+	  }
-+	else if (*tail == 'M' || *tail == 'm')
-+	  {
-+	    size *= 1024*1024;
-+	    ++tail;
-+	  }
-+
-+	if (*tail != '\0')
-+	  einfo (_("%P: warning: ignoring invalid stack size %s\n"), optarg);
-+	else
-+	{
-+	  stack_size = (bfd_signed_vma) size;
-+	  override_stack_size = TRUE;
-+	}
-+
-+	break;
-+      }
-+    }
-+  return TRUE;
-+}
-+
-+/* This callback is called when ld is invoked
-+   with the --help and --target-help options.  */
-+
-+static void
-+gld_${EMULATION_NAME}_list_options (FILE *file)
-+{
-+  fprintf (file, _("  --m[no-]fastload            Enable/Disable not cleaning the heap on startup\n"));
-+  fprintf (file, _("  --m[no-]altram, --m[no-]fastram\n"));
-+  fprintf (file, _("                              Enable/Disable loading into alternate RAM\n"));
-+  fprintf (file, _("  --m[no-]altalloc, --m[no-]fastalloc\n"));
-+  fprintf (file, _("                              Enable/Disable malloc from alternate RAM\n"));
-+  fprintf (file, _("  --m[no-]best-fit            Enable/Disable loading with optimal heap size\n"));
-+  fprintf (file, _("  --m[no-]sharable-text, --m[no-]shared-text, --m[no-]baserel\n"));
-+  fprintf (file, _("                              Enable/Disable sharing the text segment\n"));
-+  fprintf (file, "\n");
-+  fprintf (file, _("The following memory options are mutually exclusive:\n"));
-+  fprintf (file, _("  --mprivate-memory           Process memory is not accessible\n"));
-+  fprintf (file, _("  --mglobal-memory            Process memory is readable and writable\n"));
-+  fprintf (file, _("  --msuper-memory             Process memory is accessible in supervisor mode\n"));
-+  fprintf (file, _("  --mreadonly-memory, --mreadable-memory\n"));
-+  fprintf (file, _("                              Process memory is readable but not writable\n"));
-+  fprintf (file, "\n");
-+  fprintf (file, _("  --mprg-flags <value>        Set all the flags with an integer raw value\n"));
-+  fprintf (file, _("  --stack <size>              Override the stack size (suffix k or M allowed)\n"));
-+}
-+
-+/* This callback is called by lang_for_each_statement. It checks that the
-+   output sections speficied in the linker script are compatible with the MiNT
-+   executable format.  */
-+
-+static void
-+gld${EMULATION_NAME}_check_output_sections (lang_statement_union_type *s)
-+{
-+  if (s->header.type == lang_output_section_statement_enum)
-+    {
-+      lang_output_section_statement_type *oss = &s->output_section_statement;
-+
-+      if (strcmp(oss->name, ".text") == 0 && oss->bfd_section->vma != ${TEXT_START_ADDR})
-+	einfo (_("%F%P: the VMA of section %A must be 0x%V, but actual value is 0x%V\n"),
-+	  oss->bfd_section, ${TEXT_START_ADDR}, oss->bfd_section->vma);
-+      else if (strcmp(oss->name, ".data") == 0 && oss->addr_tree != NULL)
-+	einfo (_("%F%P: the VMA of section %A must not be specified\n"),
-+	  oss->bfd_section);
-+      else if (strcmp(oss->name, ".bss") == 0 && oss->addr_tree != NULL)
-+	einfo (_("%F%P: the VMA of section %A must not be specified\n"),
-+	  oss->bfd_section);
-+    }
-+}
-+
-+/* This callback is called by lang_for_each_statement. It looks for the data
-+   statements of type REL generated by the linker, and adds a TPA relocation
-+   entry for them. This is used by the CONSTRUCTORS list.  */
-+
-+static void
-+gld${EMULATION_NAME}_add_tpa_relocs (lang_statement_union_type *s)
-+{
-+  if (s->header.type == lang_data_statement_enum)
-+    {
-+      lang_data_statement_type *ds = &s->data_statement;
-+
-+      if (ds->exp->type.node_code == REL)
-+	{
-+	  if (ds->type == LONG)
-+	    {
-+	      bfd_vma tpa_address = ds->output_section->vma + ds->output_offset;
-+	      if (!bfd_m68kmint_add_tpa_relocation_entry(link_info.output_bfd, tpa_address))
-+		einfo (_("%F%P:%B: unable to add a relocation entry\n"), link_info.output_bfd);
-+	    }
-+	    else
-+	    {
-+	      einfo (_("%F%P:%B: invalid size for TPA relocation entry in section %A, offset 0x%V\n"),
-+		link_info.output_bfd, ds->output_section, ds->output_offset);
-+	    }
-+	}
-+    }
-+}
-+
-+/* Final emulation specific call.  */
-+
-+static void
-+gld${EMULATION_NAME}_finish (void)
-+{
-+  /* Do nothing if we are not generating a MiNT executable (ex: binary).  */
-+  if (strcmp (bfd_get_target (link_info.output_bfd), "${OUTPUT_FORMAT}") != 0)
-+    return;
-+
-+  /* Check the output sections.  */
-+  lang_for_each_statement (gld${EMULATION_NAME}_check_output_sections);
-+
-+  /* Set the GEMDOS executable header flags.  */
-+  if (!bfd_m68kmint_set_extended_flags (link_info.output_bfd, prg_flags))
-+    einfo (_("%F%P:%B: unable to set the header flags\n"), link_info.output_bfd);
-+
-+  /* Override the stack size.  */
-+  if (override_stack_size)
-+    if (!bfd_m68kmint_set_stack_size (link_info.output_bfd, stack_size))
-+      einfo (_("%F%P:%B: unable to set the stack size\n"), link_info.output_bfd);
-+
-+  /* Generate TPA relocation entries for the data statements.  */
-+  lang_for_each_statement (gld${EMULATION_NAME}_add_tpa_relocs);
-+}
-+
-+EOF
-+
-+# Put these extra routines in ld_${EMULATION_NAME}_emulation
-+#
-+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
-+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
-+LDEMUL_LIST_OPTIONS=gld_${EMULATION_NAME}_list_options
-+LDEMUL_FINISH=gld${EMULATION_NAME}_finish
-diff -ur --new-file binutils-2.21.51.0.7/ld/scripttempl/m68kmint.sc binutils-2.21.51.0.7-mint/ld/scripttempl/m68kmint.sc
---- binutils-2.21.51.0.7/ld/scripttempl/m68kmint.sc	1970-01-01 00:00:00.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/ld/scripttempl/m68kmint.sc	2011-04-08 10:07:28.000000000 +0000
-@@ -0,0 +1,35 @@
-+cat <<EOF
-+${RELOCATING+OUTPUT_FORMAT(${OUTPUT_FORMAT})}
-+${RELOCATING-OUTPUT_FORMAT(${RELOCATEABLE_OUTPUT_FORMAT})}
-+${RELOCATING+${LIB_SEARCH_DIRS}}
-+SECTIONS
-+{
-+  ${RELOCATING+/* The VMA of the .text section is ${TEXT_START_ADDR} instead of 0
-+     because the extended MiNT header is just before,
-+     at the beginning of the TEXT segment.  */}
-+  .text ${RELOCATING+${TEXT_START_ADDR}}:
-+  {
-+    CREATE_OBJECT_SYMBOLS
-+    *(.text)
-+    ${CONSTRUCTING+CONSTRUCTORS}
-+    ${RELOCATING+_etext = .;}
-+    ${RELOCATING+__etext = .;}
-+  }
-+
-+  .data :
-+  {
-+    *(.data)
-+    ${RELOCATING+_edata = .;}
-+    ${RELOCATING+__edata = .;}
-+  }
-+
-+  .bss :
-+  {
-+    ${RELOCATING+__bss_start = .;}
-+    *(.bss)
-+    *(COMMON)
-+    ${RELOCATING+_end = .;}
-+    ${RELOCATING+__end = .;}
-+  }
-+}
-+EOF
-diff -ur --new-file binutils-2.21.51.0.7/libiberty/configure binutils-2.21.51.0.7-mint/libiberty/configure
---- binutils-2.21.51.0.7/libiberty/configure	2010-12-06 14:24:01.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/libiberty/configure	2011-04-08 10:07:29.000000000 +0000
-@@ -4850,6 +4850,7 @@
- if [ "${shared}" = "yes" ]; then
-   case "${host}" in
-     *-*-cygwin*)	;;
-+    *-*-mint*)		;;
-     alpha*-*-linux*)	PICFLAG=-fPIC ;;
-     arm*-*-*)		PICFLAG=-fPIC ;;
-     hppa*-*-*)		PICFLAG=-fPIC ;;
-diff -ur --new-file binutils-2.21.51.0.7/libiberty/configure.ac binutils-2.21.51.0.7-mint/libiberty/configure.ac
---- binutils-2.21.51.0.7/libiberty/configure.ac	2010-12-06 14:24:01.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/libiberty/configure.ac	2011-04-08 10:07:29.000000000 +0000
-@@ -201,6 +201,7 @@
- if [[ "${shared}" = "yes" ]]; then
-   case "${host}" in
-     *-*-cygwin*)	;;
-+    *-*-mint*)		;;
-     alpha*-*-linux*)	PICFLAG=-fPIC ;;
-     arm*-*-*)		PICFLAG=-fPIC ;;
-     hppa*-*-*)		PICFLAG=-fPIC ;;
-diff -ur --new-file binutils-2.21.51.0.7/libiberty/hex.c binutils-2.21.51.0.7-mint/libiberty/hex.c
---- binutils-2.21.51.0.7/libiberty/hex.c	2007-03-16 15:48:30.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/libiberty/hex.c	2011-04-08 10:07:28.000000000 +0000
-@@ -24,7 +24,7 @@
- #include "libiberty.h"
- #include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
- 
--#if EOF != -1
-+#if !(EOF == -1)	/* gcc 2.95.3 has bug in '!=' operator for negative constants */
-  #error "hex.c requires EOF == -1"
- #endif
- 
-diff -ur --new-file binutils-2.21.51.0.7/libiberty/safe-ctype.c binutils-2.21.51.0.7-mint/libiberty/safe-ctype.c
---- binutils-2.21.51.0.7/libiberty/safe-ctype.c	2005-06-22 20:53:36.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/libiberty/safe-ctype.c	2011-04-08 10:07:28.000000000 +0000
-@@ -119,7 +119,7 @@
- #include <safe-ctype.h>
- #include <stdio.h>  /* for EOF */
- 
--#if EOF != -1
-+#if !(EOF == -1)	/* gcc 2.95.3 has bug in '!=' operator for negative constants */
-  #error "<safe-ctype.h> requires EOF == -1"
- #endif
- 
---- binutils-2.21.51.0.7/ld/lexsup.c	2011-04-08 15:39:47.000000000 +0000
-+++ binutils-2.21.51.0.7-mint/ld/lexsup.c	2011-04-08 15:39:25.000000000 +0000
-@@ -57,6 +57,9 @@
- #define	S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
- #endif
- 
-+/* Report plugin symbols.  */
-+bfd_boolean report_plugin_symbols;
-+
- static void set_default_dirlist (char *);
- static void set_section_start (char *, char *);
- static void set_segment_start (const char *, char *);
---- binutils-2.21.53.0.2/ld/plugin.c	2011-08-05 15:31:17.000000000 +0000
-+++ binutils-2.21.53.0.2-mint/ld/plugin.c	2011-09-20 10:34:17.000000000 +0000
-@@ -37,9 +37,6 @@
- #include <windows.h>
- #endif
- 
--/* Report plugin symbols.  */
--bfd_boolean report_plugin_symbols;
--
- /* Store plugin intermediate files permanently.  */
- bfd_boolean plugin_save_temps;
- 

diff --git a/sys-devel/binutils/files/binutils-2.23-ar-ranlib-truncate.patch b/sys-devel/binutils/files/binutils-2.23-ar-ranlib-truncate.patch
deleted file mode 100644
index 0c5728d653..0000000000
--- a/sys-devel/binutils/files/binutils-2.23-ar-ranlib-truncate.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-https://bugs.gentoo.org/show_bug.cgi?id=446642
-
-===================================================================
-RCS file: /cvs/src/src/bfd/archive.c,v
-retrieving revision 1.92
-retrieving revision 1.93
-diff -u -r1.92 -r1.93
---- src/bfd/archive.c	2012/08/20 14:32:30	1.92
-+++ src/bfd/archive.c	2012/12/09 18:01:39	1.93
-@@ -2424,9 +2424,6 @@
-   unsigned int count;
-   struct ar_hdr hdr;
-   long uid, gid;
--  file_ptr max_first_real = 1;
--
--  max_first_real <<= 31;
- 
-   firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
- 
-@@ -2469,6 +2466,7 @@
- 
-   for (count = 0; count < orl_count; count++)
-     {
-+      unsigned int offset;
-       bfd_byte buf[BSD_SYMDEF_SIZE];
- 
-       if (map[count].u.abfd != last_elt)
-@@ -2488,7 +2486,8 @@
-       /* The archive file format only has 4 bytes to store the offset
- 	 of the member.  Check to make sure that firstreal has not grown
- 	 too big.  */
--      if (firstreal >= max_first_real)
-+      offset = (unsigned int) firstreal;
-+      if (firstreal != (file_ptr) offset)
- 	{
- 	  bfd_set_error (bfd_error_file_truncated);
- 	  return FALSE;

diff --git a/sys-devel/binutils/files/binutils-2.23-mbstate_t.patch b/sys-devel/binutils/files/binutils-2.23-mbstate_t.patch
deleted file mode 100644
index 9c1c137182..0000000000
--- a/sys-devel/binutils/files/binutils-2.23-mbstate_t.patch
+++ /dev/null
@@ -1,184 +0,0 @@
-http://sourceware.org/bugzilla/show_bug.cgi?id=14779
-
-Index: binutils/config.in
-===================================================================
-RCS file: /cvs/src/src/binutils/config.in,v
-retrieving revision 1.39
-diff -u -3 -p -r1.39 config.in
---- binutils/config.in	10 Sep 2012 22:30:54 -0000	1.39
-+++ binutils/config.in	30 Oct 2012 12:00:58 -0000
-@@ -100,6 +100,9 @@
- /* Define to 1 if you have the <locale.h> header file. */
- #undef HAVE_LOCALE_H
- 
-+/* Define if mbstate_t exists in wchar.h. */
-+#undef HAVE_MBSTATE_T
-+
- /* Define to 1 if you have the <memory.h> header file. */
- #undef HAVE_MEMORY_H
- 
-@@ -160,6 +163,9 @@
- /* Define to 1 if you have the `utimes' function. */
- #undef HAVE_UTIMES
- 
-+/* Define to 1 if you have the <wchar.h> header file. */
-+#undef HAVE_WCHAR_H
-+
- /* Define to 1 if you have the <zlib.h> header file. */
- #undef HAVE_ZLIB_H
- 
-Index: binutils/configure
-===================================================================
-RCS file: /cvs/src/src/binutils/configure,v
-retrieving revision 1.152
-diff -u -3 -p -r1.152 configure
---- binutils/configure	26 Oct 2012 15:27:17 -0000	1.152
-+++ binutils/configure	30 Oct 2012 12:00:59 -0000
-@@ -12446,7 +12446,7 @@ case "${host}" in
- esac
- 
- 
--for ac_header in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h
-+for ac_header in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h
- do :
-   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
- ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-@@ -12750,6 +12750,32 @@ $as_echo "#define HAVE_MKDTEMP 1" >>conf
- 
- fi
- 
-+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5
-+$as_echo_n "checking for mbstate_t... " >&6; }
-+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-+/* end confdefs.h.  */
-+#include <wchar.h>
-+int
-+main ()
-+{
-+mbstate_t teststate;
-+  ;
-+  return 0;
-+}
-+_ACEOF
-+if ac_fn_c_try_compile "$LINENO"; then :
-+  have_mbstate_t=yes
-+else
-+  have_mbstate_t=no
-+fi
-+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_mbstate_t" >&5
-+$as_echo "$have_mbstate_t" >&6; }
-+  if test x"$have_mbstate_t" = xyes; then
-+
-+$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h
-+
-+  fi
- 
- # Some systems have frexp only in -lm, not in -lc.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing frexp" >&5
-Index: binutils/configure.in
-===================================================================
-RCS file: /cvs/src/src/binutils/configure.in,v
-retrieving revision 1.113
-diff -u -3 -p -r1.113 configure.in
---- binutils/configure.in	26 Oct 2012 15:27:18 -0000	1.113
-+++ binutils/configure.in	30 Oct 2012 12:01:00 -0000
-@@ -96,7 +96,7 @@ case "${host}" in
- esac
- AC_SUBST(DEMANGLER_NAME)
- 
--AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h)
-+AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h)
- AC_HEADER_SYS_WAIT
- ACX_HEADER_STRING
- AC_FUNC_ALLOCA
-@@ -107,6 +107,14 @@ AC_CHECK_FUNC([mkstemp],
- AC_CHECK_FUNC([mkdtemp],
-               AC_DEFINE([HAVE_MKDTEMP], 1,
-               [Define to 1 if you have the `mkdtemp' function.]))
-+  AC_MSG_CHECKING([for mbstate_t])
-+  AC_TRY_COMPILE([#include <wchar.h>],
-+  [mbstate_t teststate;],
-+  have_mbstate_t=yes, have_mbstate_t=no)
-+  AC_MSG_RESULT($have_mbstate_t)
-+  if test x"$have_mbstate_t" = xyes; then
-+    AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
-+  fi
- 
- # Some systems have frexp only in -lm, not in -lc.
- AC_SEARCH_LIBS(frexp, m)
-Index: binutils/readelf.c
-===================================================================
-RCS file: /cvs/src/src/binutils/readelf.c,v
-retrieving revision 1.583
-diff -u -3 -p -r1.583 readelf.c
---- binutils/readelf.c	24 Oct 2012 01:59:39 -0000	1.583
-+++ binutils/readelf.c	30 Oct 2012 12:01:00 -0000
-@@ -48,7 +48,9 @@
- #ifdef HAVE_ZLIB_H
- #include <zlib.h>
- #endif
-+#ifdef HAVE_WCHAR_H
- #include <wchar.h>
-+#endif
- 
- #if __GNUC__ >= 2
- /* Define BFD64 here, even if our default architecture is 32 bit ELF
-@@ -386,7 +388,7 @@ print_vma (bfd_vma vma, print_mode mode)
- }
- 
- /* Display a symbol on stdout.  Handles the display of control characters and
--   multibye characters.
-+   multibye characters (assuming the host environment supports them).
- 
-    Display at most abs(WIDTH) characters, truncating as necessary, unless do_wide is true.
- 
-@@ -400,7 +402,9 @@ print_symbol (int width, const char *sym
- {
-   bfd_boolean extra_padding = FALSE;
-   int num_printed = 0;
-+#ifdef HAVE_MBSTATE_T
-   mbstate_t state;
-+#endif
-   int width_remaining;
- 
-   if (width < 0)
-@@ -417,13 +421,14 @@ print_symbol (int width, const char *sym
-   else
-     width_remaining = width;
- 
-+#ifdef HAVE_MBSTATE_T
-   /* Initialise the multibyte conversion state.  */
-   memset (& state, 0, sizeof (state));
-+#endif
- 
-   while (width_remaining)
-     {
-       size_t  n;
--      wchar_t w;
-       const char c = *symbol++;
- 
-       if (c == 0)
-@@ -449,15 +454,22 @@ print_symbol (int width, const char *sym
- 	}
-       else
- 	{
-+#ifdef HAVE_MBSTATE_T
-+	  wchar_t w;
-+#endif
- 	  /* Let printf do the hard work of displaying multibyte characters.  */
- 	  printf ("%.1s", symbol - 1);
- 	  width_remaining --;
- 	  num_printed ++;
- 
-+#ifdef HAVE_MBSTATE_T
- 	  /* Try to find out how many bytes made up the character that was
- 	     just printed.  Advance the symbol pointer past the bytes that
- 	     were displayed.  */
- 	  n = mbrtowc (& w, symbol - 1, MB_CUR_MAX, & state);
-+#else
-+	  n = 1;
-+#endif
- 	  if (n != (size_t) -1 && n != (size_t) -2 && n > 0)
- 	    symbol += (n - 1);
- 	}


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2017-11-25 15:16 Fabian Groffen
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2017-11-25 15:16 UTC (permalink / raw
  To: gentoo-commits

commit:     31af8d7ef0176a390faf59af480393f834948292
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 15:16:35 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 15:16:35 2017 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=31af8d7e

sys-devel/binutils: sync

Package-Manager: Portage-2.3.13-prefix, Repoman-2.3.4
RepoMan-Options: --force

 sys-devel/binutils/Manifest                        |  2 ++
 sys-devel/binutils/binutils-2.29.1-r1.ebuild       | 31 ++++++++++++++++++++++
 .../files/binutils-2.29.1-nogoldtest.patch         | 27 +++++++++++++++++++
 3 files changed, 60 insertions(+)

diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
index e348252d68..20f982f5aa 100644
--- a/sys-devel/binutils/Manifest
+++ b/sys-devel/binutils/Manifest
@@ -2,3 +2,5 @@ DIST binutils-2.27-patches-1.0.tar.xz 8852 SHA256 07be45786e1e56498aad2c52a43d41
 DIST binutils-2.27.tar.bz2 26099568 SHA256 369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88 SHA512 cf276f84935312361a2ca077e04d0b469d23a3aed979d8ba5d92ea590904ffb2c2e7ed12cc842822bfc402836be86f479660cef3791aa62f3753d8a1a6f564cb WHIRLPOOL d3204b4900529f697285fb1fe622ecc949c43f064e6b83a1cecb1ea8810a214842c729266c9a44537dc0a86d6d2b3ac100f54c721cc284e54f9d6feb90930d15
 DIST binutils-2.28.1-patches-1.0.tar.xz 19772 SHA256 50cfce6ef7f546dcdb983a8b632507b5cdd51095e4acf1f15bfcd68027d438a4 SHA512 c2c7d22e1013e79040c4dcb4d70649e78a070976ba3a4bc2ceb4805827b9d93eea1805c85db4fcb6b31be5218c3d7b42a4990437a7c01dc01fd7e9dedb606828 WHIRLPOOL 2369fce643cc9b83724b486521621d744de0eaf3d95fdd34c7f1c785bc400f3ed31ae6105001870f33539664d84dd9caae854725e20007f136929d2ece755247
 DIST binutils-2.28.1.tar.bz2 28120394 SHA256 6924999be62d4464458eb53c11f27277cfb63755df8c1cd47b8d15d02c1942ea SHA512 5ec5212497b0fa8324f6a0884c284cb71c01942bbd39356d1ae745a5c9d97274c10f9d9c723f4bef6f0217662dfcd0c36e4e955a7599b11217658dc7b97553eb WHIRLPOOL 5c616f719827e5da7db23e89c761323cd4828b4779e79c3983d3ea429bce57ed40219982c478237b4dd728b77bae0a6447d912d96490ed1f5fc279ba5fd73bc6
+DIST binutils-2.29.1-patches-3.tar.xz 20904 SHA256 a9c6cc884637a398cc6969ca7b734c48967e5ad11e2a74aae25cf53931c85b2b SHA512 ba54efaf9e9f668d2922972acd2cdf5c3e6f174cfcc73d29953ab4ba6e157ce0cb500c583568a4e3baaaa92c9d30c394a327f29b51292acc66f8d3f20f5eae2a WHIRLPOOL 993b08862835843fdda3d3916f7dfed2d9e195c13e6b52deac42b3e714a022b36f62d41a4c2de89c0dc7eb751f28ac3f2fd8774e3bc4551b411c16688400e2c3
+DIST binutils-2.29.1.tar.bz2 29123355 SHA256 1509dff41369fb70aed23682351b663b56db894034773e6dbf7d5d6071fc55cc SHA512 4063d34555526922376ccceb3f14b43e287442e82a8038cf50f4f51ad97d438c672c0e310ca4b856c9aff5aa9911073e256e8298a7a3f1844eeb60b90d955592 WHIRLPOOL 55bf62434bb00b9a355f8d7138c97b6d984eed3a83d7eb37137cf3ab8efcc8e536415d68eba375ae0ab30743f5b3014a664f7d3c773ed55da40c8814691e04d8

diff --git a/sys-devel/binutils/binutils-2.29.1-r1.ebuild b/sys-devel/binutils/binutils-2.29.1-r1.ebuild
new file mode 100644
index 0000000000..e799d64aad
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.29.1-r1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+PATCHVER="3"
+ELF2FLT_VER=""
+inherit toolchain-binutils
+
+KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+
+PATCHES=(
+	"${FILESDIR}/${P}-nogoldtest.patch"
+	"${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
+	"${FILESDIR}"/${PN}-2.24-cygwin-nointl.patch
+)
+
+pkg_setup() {
+	[[ ${CHOST} == *-mint* ]] && die "mint patches require rebasing to ${P}" # 609274
+}
+
+src_compile() {
+	if has noinfo "${FEATURES}" \
+	|| ! type -p makeinfo >/dev/null
+	then
+		# binutils >= 2.17 (accidentally?) requires 'makeinfo'
+		export EXTRA_EMAKE="MAKEINFO=true"
+	fi
+
+	toolchain-binutils_src_compile
+}

diff --git a/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch b/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch
new file mode 100644
index 0000000000..8e0669922d
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch
@@ -0,0 +1,27 @@
+From 40f6e93e5078f16897f23856886566fe3b546206 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
+Date: Fri, 3 Nov 2017 21:51:35 +0100
+Subject: [PATCH] Gentoo: Disable gold testsuite for users since it fails
+ upstream
+
+https://bugs.gentoo.org/634348
+https://sourceware.org/bugzilla/show_bug.cgi?id=21090
+---
+ Makefile.in | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 3acb83b8de..49de829bfa 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -2340,7 +2340,6 @@ check-host:  \
+     maybe-check-mpc \
+     maybe-check-isl \
+     maybe-check-libelf \
+-    maybe-check-gold \
+     maybe-check-gprof \
+     maybe-check-intl \
+     maybe-check-tcl \
+-- 
+2.15.0
+


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2022-10-25  6:50 Fabian Groffen
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2022-10-25  6:50 UTC (permalink / raw
  To: gentoo-commits

commit:     158166f0cb0a9bcbbbe08606e37b9320e89f5942
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 25 06:50:11 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Oct 25 06:50:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=158166f0

sys-devel/binutils-2.39-r4: add patch for Solaris from upstream

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-devel/binutils/binutils-2.39-r4.ebuild         |  1 +
 ...inutils-2.39-protected-visibility-solaris.patch | 64 ++++++++++++++++++++++
 2 files changed, 65 insertions(+)

diff --git a/sys-devel/binutils/binutils-2.39-r4.ebuild b/sys-devel/binutils/binutils-2.39-r4.ebuild
index 0254ffdfb7..8f34b15b0e 100644
--- a/sys-devel/binutils/binutils-2.39-r4.ebuild
+++ b/sys-devel/binutils/binutils-2.39-r4.ebuild
@@ -70,6 +70,7 @@ RESTRICT="!test? ( test )"
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
+	"${FILESDIR}"/${PN}-2.39-protected-visibility-solaris.patch
 )
 
 MY_BUILDDIR=${WORKDIR}/build

diff --git a/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch b/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch
new file mode 100644
index 0000000000..2e83e74b8d
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch
@@ -0,0 +1,64 @@
+From 2c43d202aefb2b6f202a44bbb8a0baf251aae845 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 22 Aug 2022 10:26:17 -0700
+Subject: [PATCH] x86: Ignore protected visibility in shared libraries on
+ Solaris
+
+On x86, the PLT entry in executable may be used as function address for
+functions in shared libraries.  If functions are protected, the function
+address used in executable can be different from the function address
+used in shared library.  This will lead to incorrect run-time behavior
+if function pointer equality is needed.  By default, x86 linker issues
+an error in this case.
+
+On Solaris, linker issued an error for
+
+struct tm *tb = (kind == CPP_time_kind::FIXED ? gmtime : localtime) (&tt);
+
+where gmtime is a protected function in libc.so.  Use gmtime's PLT entry
+in executable as function address is safe since function pointer equality
+isn't needed.  Ignore protected visibility in shared libraries on Solaris
+to disable linker error.  If function pointer equality is needed, linker
+will silently generate executable with incorrect run-time behavior on
+Solaris.
+
+	PR ld/29512
+	* elf32-i386.c (elf_i386_scan_relocs): Ignore protected
+	visibility in shared libraries on Solaris.
+	* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
+---
+ bfd/elf32-i386.c   | 3 ++-
+ bfd/elf64-x86-64.c | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
+index 52b1db44546..9717e2c5ed6 100644
+--- a/bfd/elf32-i386.c
++++ b/bfd/elf32-i386.c
+@@ -1808,7 +1808,8 @@ elf_i386_scan_relocs (bfd *abfd,
+ 		      || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
+ 		    h->plt.refcount = 1;
+ 
+-		  if (h->pointer_equality_needed
++		  if (htab->elf.target_os != is_solaris
++		      && h->pointer_equality_needed
+ 		      && h->type == STT_FUNC
+ 		      && eh->def_protected
+ 		      && !SYMBOL_DEFINED_NON_SHARED_P (h)
+diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
+index 62a9a22317a..f3b54400013 100644
+--- a/bfd/elf64-x86-64.c
++++ b/bfd/elf64-x86-64.c
+@@ -2251,7 +2251,8 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info,
+ 		      || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
+ 		    h->plt.refcount = 1;
+ 
+-		  if (h->pointer_equality_needed
++		  if (htab->elf.target_os != is_solaris
++		      && h->pointer_equality_needed
+ 		      && h->type == STT_FUNC
+ 		      && eh->def_protected
+ 		      && !SYMBOL_DEFINED_NON_SHARED_P (h)
+-- 
+2.31.1
+


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2023-03-01  0:52 Sam James
  0 siblings, 0 replies; 6+ messages in thread
From: Sam James @ 2023-03-01  0:52 UTC (permalink / raw
  To: gentoo-commits

commit:     f4bae8f7128a0a7977d4cf765f21301a2275f32e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  1 00:51:07 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar  1 00:51:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f4bae8f7

sys-devel/binutils: add 2.40(-r2)

Bug: https://bugs.gentoo.org/895240
Bug: https://bugs.gentoo.org/892549
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/binutils/Manifest                        |   2 +
 sys-devel/binutils/binutils-2.40-r2.ebuild         | 509 +++++++++++++++++++++
 .../files/binutils-2.40-linker-search-path.patch   |  74 +++
 3 files changed, 585 insertions(+)

diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
index 3969b00779..83ad995e9e 100644
--- a/sys-devel/binutils/Manifest
+++ b/sys-devel/binutils/Manifest
@@ -3,3 +3,5 @@ DIST binutils-2.34.tar.xz 21637796 BLAKE2B 07dd23916a7d27f71c3f160c8c16abe2bd4fc
 DIST binutils-2.39-patches-4.tar.xz 62880 BLAKE2B 5cc335769d9c88417583ce059c61d0d7655f3ab9ac69647e6e2f65bd3a9dd143fe34c50bb68ab81d4226ddd0e4ef405d7102f67375a672eedc3d01b92b8ef497 SHA512 ef81350979af64cf35800b39982c84657a5c01362c01d221164a43d8f0dd80276c9f052c55d24516fad457e6671a58d467d71b5edd6c1f53fddbdb31172a21ee
 DIST binutils-2.39-patches-5.tar.xz 82924 BLAKE2B 2cf75f661989f22270d6afe5f3c543814eb6a331be4493016fa2871e1f10a84a123c1c51e77a19b35e46680b9fe77390cb1532ca40d470a6041fa768fed3ccd7 SHA512 4b5811b4822b3a06f590fc7d082dc0ddf18a6058ac23887254e2ee9bd63c7f06f1636e446152115c7e0b01a6c5298a0d9df6904bd1582e66504ccde80dd1ecbd
 DIST binutils-2.39.tar.xz 25167756 BLAKE2B ac6a5296c6586d53eaadcbffc5c399a6d79edf72450b9bb8b3525ce525129cef3d2eb90c85ef3bb3270b5a03b0e1ffb8f0b705f028158726f9777ebb8685066f SHA512 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3
+DIST binutils-2.40-patches-2.tar.xz 183760 BLAKE2B 447f1c40ac8212b1e91f6f2137f87958c3f4e2366b11b9979d9d09d52e9fcde9a9d74f0c1871616157e001f505849fceb2097a512f434b9c848885e367a07c35 SHA512 30efbfcbd2d936c74d9480e4f2f4b8dcd30abcd0f1b22d21d20558002fdb8c90bd2fe97e3f27c2905714dcfd1297cac2646ede1e2c3d9fbf159f93c8cf01a290
+DIST binutils-2.40.tar.xz 25241484 BLAKE2B 8d799f7c595f878b9af5b17a490021dd8b8300ac2fe0ed8574c012929d22d2d0493e003a3e631a9436e8e712da801779b777c566167fe42b0bde119ffa5ad1c2 SHA512 a37e042523bc46494d99d5637c3f3d8f9956d9477b748b3b1f6d7dfbb8d968ed52c932e88a4e946c6f77b8f48f1e1b360ca54c3d298f17193f3b4963472f6925

diff --git a/sys-devel/binutils/binutils-2.40-r2.ebuild b/sys-devel/binutils/binutils-2.40-r2.ebuild
new file mode 100644
index 0000000000..fc19343327
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.40-r2.ebuild
@@ -0,0 +1,509 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs
+
+DESCRIPTION="Tools necessary to build programs"
+HOMEPAGE="https://sourceware.org/binutils/"
+
+LICENSE="GPL-3+"
+IUSE="cet doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla zstd"
+
+# Variables that can be set here  (ignored for live ebuilds)
+# PATCH_VER          - the patchset version
+#                      Default: empty, no patching
+# PATCH_BINUTILS_VER - the binutils version in the patchset name
+#                    - Default: PV
+# PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
+#                      for the patchsets
+
+PATCH_VER=2
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999* ]]; then
+	inherit git-r3
+	SLOT=${PV}
+else
+	PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
+	PATCH_DEV=${PATCH_DEV:-dilfridge}
+	SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://sourceware.org/pub/binutils/releases/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz"
+	[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
+		https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
+	SLOT=$(ver_cut 1-2)
+	KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+fi
+
+#
+# The cross-compile logic
+#
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+#
+# The dependencies
+#
+RDEPEND="
+	>=sys-devel/binutils-config-3
+	sys-libs/zlib
+	zstd? ( app-arch/zstd:= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	doc? ( sys-apps/texinfo )
+	test? (
+		dev-util/dejagnu
+		sys-devel/bc
+	)
+	nls? ( sys-devel/gettext )
+	zstd? ( virtual/pkgconfig )
+	sys-devel/flex
+	app-alternatives/yacc
+"
+
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
+)
+
+MY_BUILDDIR=${WORKDIR}/build
+
+src_unpack() {
+	if [[ ${PV} == 9999* ]] ; then
+		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patch || die
+
+		EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
+		S=${WORKDIR}/binutils
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P/-hppa64/}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz
+
+		# _p patch versions are Gentoo specific tarballs ...
+		local dir=${P%_p?}
+		dir=${dir/-hppa64/}
+
+		S=${WORKDIR}/${dir}
+	fi
+
+	cd "${WORKDIR}" || die
+	mkdir -p "${MY_BUILDDIR}" || die
+}
+
+src_prepare() {
+	local patchsetname
+	if [[ ${PV} == 9999* ]] ; then
+		patchsetname="from git master"
+	else
+		patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}"
+	fi
+
+	if [[ -n ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then
+		if ! use vanilla; then
+			einfo "Applying binutils patchset ${patchsetname}"
+			eapply "${WORKDIR}/patch"
+			einfo "Done."
+
+			# This is applied conditionally for now just out of caution.
+			# It should be okay on non-prefix systems though. See bug #892549.
+			use prefix && eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch
+		fi
+	fi
+
+	# Make sure our explicit libdir paths don't get clobbered, bug #562460
+	sed -i \
+		-e 's:@bfdlibdir@:@libdir@:g' \
+		-e 's:@bfdincludedir@:@includedir@:g' \
+		{bfd,opcodes}/Makefile.in || die
+
+	# Fix locale issues if possible, bug #122216
+	if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
+		einfo "Fixing misc issues in configure files"
+		for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
+			ebegin "  Updating ${f/${S}\/}"
+			patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
+				|| eerror "Please file a bug about this"
+			eend $?
+		done
+	fi
+
+	# Apply things from PATCHES and user dirs
+	default
+
+	# Run misc portage update scripts
+	gnuconfig_update
+	elibtoolize --portage --no-uclibc
+}
+
+toolchain-binutils_bugurl() {
+	printf "https://bugs.gentoo.org/"
+}
+toolchain-binutils_pkgversion() {
+	printf "Gentoo ${PV}"
+	[[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
+}
+
+src_configure() {
+	# See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
+	# Avoid really confusing logs from subconfigure spam, makes logs far
+	# more legible.
+	MAKEOPTS="--output-sync=line ${MAKEOPTS}"
+
+	# Setup some paths
+	LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+	INCPATH=${LIBPATH}/include
+	DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+	if is_cross ; then
+		TOOLPATH=/usr/${CHOST}/${CTARGET}
+	else
+		TOOLPATH=/usr/${CTARGET}
+	fi
+	BINPATH=${TOOLPATH}/binutils-bin/${PV}
+
+	# Make sure we filter $LINGUAS so that only ones that
+	# actually work make it through, bug #42033
+	strip-linguas -u */po
+
+	# Keep things sane
+	strip-flags
+	use cet && filter-flags -mindirect-branch -mindirect-branch=*
+	use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152
+
+	# ideally we want !tc-ld-is-bfd for best future-proofing, but it needs
+	# https://github.com/gentoo/gentoo/pull/28355
+	# mold needs this too but right now tc-ld-is-mold is also not available
+	if tc-ld-is-lld; then
+		append-ldflags -Wl,--undefined-version
+	fi
+
+	local x
+	echo
+	for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
+		einfo "$(printf '%10s' ${x}:) ${!x}"
+	done
+	echo
+
+	cd "${MY_BUILDDIR}" || die
+	local myconf=()
+
+	if use plugins ; then
+		myconf+=( --enable-plugins )
+	fi
+	# enable gold (installed as ld.gold) and ld's plugin architecture
+	if use gold ; then
+		myconf+=( --enable-gold )
+	fi
+
+	if use nls ; then
+		myconf+=( --without-included-gettext )
+		[[ ${CHOST} == *"-solaris"* ]] && append-libs -lintl
+	else
+		myconf+=( --disable-nls )
+	fi
+
+	myconf+=( --with-system-zlib )
+
+	# For bi-arch systems, enable a 64bit bfd. This matches the bi-arch
+	# logic in toolchain.eclass. bug #446946
+	#
+	# We used to do it for everyone, but it's slow on 32bit arches. bug #438522
+	case $(tc-arch) in
+		ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
+	esac
+
+	use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
+
+	[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
+
+	is_cross && myconf+=(
+		--with-sysroot="${EPREFIX}"/usr/${CTARGET}
+		--enable-poison-system-directories
+	)
+
+	myconf+=( --enable-secureplt )
+
+	# mips can't do hash-style=gnu ...
+	# let's not do this on Solaris either
+	if [[ $(tc-arch) != mips && ${CHOST} != *-solaris* ]] ; then
+		myconf+=( --enable-default-hash-style=gnu )
+	fi
+
+	myconf+=(
+		--prefix="${EPREFIX}"/usr
+		--host=${CHOST}
+		--target=${CTARGET}
+		--datadir="${EPREFIX}"${DATAPATH}
+		--datarootdir="${EPREFIX}"${DATAPATH}
+		--infodir="${EPREFIX}"${DATAPATH}/info
+		--mandir="${EPREFIX}"${DATAPATH}/man
+		--bindir="${EPREFIX}"${BINPATH}
+		--libdir="${EPREFIX}"${LIBPATH}
+		--libexecdir="${EPREFIX}"${LIBPATH}
+		--includedir="${EPREFIX}"${INCPATH}
+		--enable-obsolete
+		--enable-shared
+		--enable-threads
+		# Newer versions (>=2.27) offer a configure flag now.
+		--enable-relro
+		# Newer versions (>=2.24) make this an explicit option, bug #497268
+		--enable-install-libiberty
+		# Available from 2.35 on
+		--enable-textrel-check=warning
+
+		# These hardening options are available from 2.39+ but
+		# they unconditionally enable the behaviour even on arches
+		# where e.g. execstacks can't be avoided.
+		# See https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
+		#--enable-warn-execstack
+		#--enable-warn-rwx-segments
+		#--disable-default-execstack (or is it --enable-default-execstack=no? docs are confusing)
+
+		# Things to think about
+		#--enable-deterministic-archives
+
+		# Works better than vapier's patch, bug #808787
+		--enable-new-dtags
+
+		--disable-jansson
+		--disable-werror
+		--with-bugurl="$(toolchain-binutils_bugurl)"
+		--with-pkgversion="$(toolchain-binutils_pkgversion)"
+		$(use_enable static-libs static)
+		$(use_with zstd)
+
+		# Disable modules that are in a combined binutils/gdb tree, bug #490566
+		--disable-{gdb,libdecnumber,readline,sim}
+		# Strip out broken static link flags.
+		# https://gcc.gnu.org/PR56750
+		--without-stage1-ldflags
+		# Change SONAME to avoid conflict across
+		# {native,cross}/binutils, binutils-libs. bug #666100
+		--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
+
+		# Avoid automagic dependency on (currently prefix) systems
+		# systems with debuginfod library, bug #754753
+		--without-debuginfod
+
+		# Avoid automagic dev-libs/msgpack dep, bug #865875
+		--without-msgpack
+
+		# Allow user to opt into CET for host libraries.
+		# Ideally we would like automagic-or-disabled here.
+		# But the check does not quite work on i686: bug #760926.
+		$(use_enable cet)
+
+		# We can enable this by default in future, but it's brand new
+		# in 2.39 with several bugs:
+		# - Doesn't build on musl (https://sourceware.org/bugzilla/show_bug.cgi?id=29477)
+		# - No man pages (https://sourceware.org/bugzilla/show_bug.cgi?id=29521)
+		# - Broken at runtime without Java (https://sourceware.org/bugzilla/show_bug.cgi?id=29479)
+		# - binutils-config (and this ebuild?) needs adaptation first (https://bugs.gentoo.org/865113)
+		$(use_enable gprofng)
+	)
+
+	if ! is_cross ; then
+		myconf+=( $(use_enable pgo pgo-build lto) )
+
+		if use pgo ; then
+			export BUILD_CFLAGS="${CFLAGS}"
+		fi
+	fi
+
+	ECONF_SOURCE="${S}" econf "${myconf[@]}" || die
+
+	# Prevent makeinfo from running if doc is unset.
+	if ! use doc ; then
+		sed -i \
+			-e '/^MAKEINFO/s:=.*:= true:' \
+			Makefile || die
+	fi
+}
+
+src_compile() {
+	cd "${MY_BUILDDIR}" || die
+
+	# see Note [tooldir hack for ldscripts]
+	emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all
+
+	# only build info pages if the user wants them
+	if use doc ; then
+		emake V=1 info
+	fi
+
+	# we nuke the manpages when we're left with junk
+	# (like when we bootstrap, no perl -> no manpages)
+	find . -name '*.1' -a -size 0 -delete
+}
+
+src_test() {
+	cd "${MY_BUILDDIR}" || die
+
+	# bug #637066
+	filter-flags -Wall -Wreturn-type
+
+	emake -k V=1 check
+}
+
+src_install() {
+	local x d
+
+	cd "${MY_BUILDDIR}" || die
+
+	# see Note [tooldir hack for ldscripts]
+	emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
+	rm -rf "${ED}"/${LIBPATH}/bin || die
+	use static-libs || find "${ED}" -name '*.la' -delete
+
+	# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
+	cd "${ED}"/${LIBPATH} || die
+	for d in ../* ; do
+		[[ ${d} == ../${PV} ]] && continue
+		mv ${d}/* . || die
+		rmdir ${d} || die
+	done
+
+	# Now we collect everything intp the proper SLOT-ed dirs
+	# When something is built to cross-compile, it installs into
+	# /usr/$CHOST/ by default ... we have to 'fix' that :)
+	if is_cross ; then
+		cd "${ED}"/${BINPATH} || die
+		for x in * ; do
+			mv ${x} ${x/${CTARGET}-} || die
+		done
+
+		if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
+			mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
+			mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
+			rm -r "${ED}"/usr/${CHOST}/{include,lib}
+		fi
+	fi
+
+	insinto ${INCPATH}
+	local libiberty_headers=(
+		# Not all the libiberty headers.  See libiberty/Makefile.in:install_to_libdir.
+		demangle.h
+		dyn-string.h
+		fibheap.h
+		hashtab.h
+		libiberty.h
+		objalloc.h
+		splay-tree.h
+	)
+	doins "${libiberty_headers[@]/#/${S}/include/}"
+	if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
+		mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die
+		rm -r "${ED}"/${LIBPATH}/lib || die
+	fi
+
+	# Generate an env.d entry for this binutils
+	insinto /etc/env.d/binutils
+	cat <<-EOF > "${T}"/env.d
+		TARGET="${CTARGET}"
+		VER="${PV}"
+		LIBPATH="${EPREFIX}${LIBPATH}"
+	EOF
+	newins "${T}"/env.d ${CTARGET}-${PV}
+
+	# Handle documentation
+	if ! is_cross ; then
+		cd "${S}" || die
+		dodoc README
+
+		docinto bfd
+		dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
+
+		docinto binutils
+		dodoc binutils/ChangeLog binutils/NEWS binutils/README
+
+		docinto gas
+		dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
+
+		docinto gprof
+		dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
+
+		docinto ld
+		dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
+
+		docinto libiberty
+		dodoc libiberty/ChangeLog* libiberty/README
+
+		docinto opcodes
+		dodoc opcodes/ChangeLog*
+	fi
+
+	# Remove shared info pages
+	rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
+
+	# Trim all empty dirs
+	find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
+}
+
+pkg_postinst() {
+	# Make sure this ${CTARGET} has a binutils version selected
+	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
+	binutils-config ${CTARGET}-${PV}
+}
+
+pkg_postrm() {
+	local current_profile=$(binutils-config -c ${CTARGET})
+
+	# If no other versions exist, then uninstall for this
+	# target ... otherwise, switch to the newest version
+	# Note: only do this if this version is unmerged.  We
+	#       rerun binutils-config if this is a remerge, as
+	#       we want the mtimes on the symlinks updated (if
+	#       it is the same as the current selected profile)
+	if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
+		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
+		choice=${choice//$'\n'/ }
+		choice=${choice/* }
+		if [[ -z ${choice} ]] ; then
+			env -i ROOT="${ROOT}" binutils-config -u ${CTARGET}
+		else
+			binutils-config ${choice}
+		fi
+	elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
+		binutils-config ${CTARGET}-${PV}
+	fi
+}
+
+# Note [slotting support]
+# -----------------------
+# Gentoo's layout for binutils files is non-standard as Gentoo
+# supports slotted installation for binutils. Many tools
+# still expect binutils to reside in known locations.
+# binutils-config package restores symlinks into known locations,
+# like:
+#    /usr/bin/${CTARGET}-<tool>
+#    /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
+#    /usr/include/
+#
+# Note [tooldir hack for ldscripts]
+# ---------------------------------
+# Build system does not allow ./configure to tweak every location
+# we need for slotting binutils hence all the shuffling in
+# src_install(). This note is about SCRIPTDIR define handling.
+#
+# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
+# Thus we can't just move files around after compilation finished.
+#
+# Our goal is the following:
+# - at build-time set scriptdir to point to symlinked location:
+#   ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
+# - at install-time set scriptdir to point to slotted location:
+#   ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}

diff --git a/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch b/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch
new file mode 100644
index 0000000000..7423f8d705
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch
@@ -0,0 +1,74 @@
+https://bugs.gentoo.org/892549
+https://github.com/gentoo/binutils-gdb/pull/4
+
+From 1601840f9f2397edd56177871527a198a14277bd Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 11 Feb 2023 15:15:20 +0000
+Subject: [PATCH 1/2] ldelf.c: Always consider -L arguments when handling
+ DT_NEEDED
+
+This is for consistency with other linkers, including gold. Without
+this, we typically rely on ld.so.conf to find libraries such as
+libstdc++.so.6, while other linkers do not use this file at all.
+--- a/ld/ldelf.c
++++ b/ld/ldelf.c
+@@ -1090,8 +1090,8 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
+ 	 linker will search.  That means that we want to use
+ 	 rpath_link, rpath, then the environment variable
+ 	 LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH
+-	 entries (native only), then the linker script LIB_SEARCH_DIRS.
+-	 We do not search using the -L arguments.
++	 entries (native only), then the linker script LIB_SEARCH_DIRS,
++	 then the -L arguments.
+ 
+ 	 We search twice.  The first time, we skip objects which may
+ 	 introduce version mismatches.  The second time, we force
+@@ -1165,11 +1165,7 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
+ 	  len = strlen (l->name);
+ 	  for (search = search_head; search != NULL; search = search->next)
+ 	    {
+-	      char *filename;
+-
+-	      if (search->cmdline)
+-		continue;
+-	      filename = (char *) xmalloc (strlen (search->name) + len + 2);
++	      char *filename = (char *) xmalloc (strlen (search->name) + len + 2);
+ 	      sprintf (filename, "%s/%s", search->name, l->name);
+ 	      nn.name = filename;
+ 	      if (ldelf_try_needed (&nn, force, is_linux))
+
+From 8afc65c8d8c0fff2f686ddd8eb9023c7ebabcca9 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 11 Feb 2023 15:18:58 +0000
+Subject: [PATCH 2/2] ldelf.c: Do not search for libraries using ld.so.conf
+
+Other linkers do not do this. It is problematic for Gentoo Linux,
+because crossdev installs libraries such as libstdc++.so.6 outside of
+the sysroot.
+--- a/ld/ld.texi
++++ b/ld/ld.texi
+@@ -2355,7 +2355,9 @@ For a linker for a Linux system, if the file @file{/etc/ld.so.conf}
+ exists, the list of directories found in that file.  Note: the path
+ to this file is prefixed with the @code{sysroot} value, if that is
+ defined, and then any @code{prefix} string if the linker was
+-configured with the @command{--prefix=<path>} option.
++configured with the @command{--prefix=<path>} option. This has feature has
++been disabled on Gentoo Linux to make it consistent with the other
++linkers, which do not do this.
+ @item
+ For a native linker on a FreeBSD system, any directories specified by
+ the @code{_PATH_ELF_HINTS} macro defined in the @file{elf-hints.h}
+--- a/ld/ldelf.c
++++ b/ld/ldelf.c
+@@ -1156,10 +1156,6 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
+ 	      if (is_freebsd
+ 		  && ldelf_check_ld_elf_hints (l, force, elfsize))
+ 		break;
+-
+-	      if (is_linux
+-		  && ldelf_check_ld_so_conf (l, force, elfsize, prefix))
+-		break;
+ 	    }
+ 
+ 	  len = strlen (l->name);
+


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2023-08-30  8:56 Fabian Groffen
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2023-08-30  8:56 UTC (permalink / raw
  To: gentoo-commits

commit:     64b018b8728e2fc39ff4496f3d80da3e2a6a76f0
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 30 08:53:18 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Aug 30 08:53:18 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=64b018b8

sys-devel/binutils-2.40-r8: pull in EAPI=8 ebuild from gx86

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-devel/binutils/Manifest                        |   7 +-
 sys-devel/binutils/binutils-2.34-r1.ebuild         | 445 ------------------
 sys-devel/binutils/binutils-2.39-r2.ebuild         | 498 --------------------
 sys-devel/binutils/binutils-2.39-r4.ebuild         | 499 ---------------------
 ...tils-2.40-r2.ebuild => binutils-2.40-r8.ebuild} |  20 +-
 .../files/binutils-2.24-cygwin-nointl.patch        |  26 --
 .../files/binutils-2.29.1-nogoldtest.patch         |  27 --
 .../binutils/files/binutils-2.33-gcc-10.patch      |  39 --
 .../binutils/files/binutils-2.34-riscv-SEGV.patch  |  40 --
 ...inutils-2.39-protected-visibility-solaris.patch |  64 ---
 .../binutils/files/binutils-configure-LANG.patch   |  65 +++
 11 files changed, 80 insertions(+), 1650 deletions(-)

diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
index 83ad995e9e..b6c1313f33 100644
--- a/sys-devel/binutils/Manifest
+++ b/sys-devel/binutils/Manifest
@@ -1,7 +1,2 @@
-DIST binutils-2.34-patches-4.tar.xz 95232 BLAKE2B 0a355120ecaf447d863f6d0837028061968166c9024da36212ce7d172ee2060e4027be1fca0089e38ab9073b5332307ff1dc05b868603bd2aa0ec8e88af7cd0a SHA512 e593edbeddaf97ef23fa8eb25c5714c7f2dd2500d11422bd9dba42e119884fe71593adc98862f74c7d391ceb298556ed049eee3c504733c634faef236045876b
-DIST binutils-2.34.tar.xz 21637796 BLAKE2B 07dd23916a7d27f71c3f160c8c16abe2bd4fce294c738c665a012a3be6a87dbe8160d0c38740524f9025e01d438e99b2a94bcf9f9f79ee214f5dd033de8aad3d SHA512 2c7976939dcf5e8c5b7374cccd39bfe803b1bec73c6abfa0eb17c24e1942574c6bdb874c66a092a82adc443182eacd8a5a8001c19a76101f0c7ba40c27de0bbd
-DIST binutils-2.39-patches-4.tar.xz 62880 BLAKE2B 5cc335769d9c88417583ce059c61d0d7655f3ab9ac69647e6e2f65bd3a9dd143fe34c50bb68ab81d4226ddd0e4ef405d7102f67375a672eedc3d01b92b8ef497 SHA512 ef81350979af64cf35800b39982c84657a5c01362c01d221164a43d8f0dd80276c9f052c55d24516fad457e6671a58d467d71b5edd6c1f53fddbdb31172a21ee
-DIST binutils-2.39-patches-5.tar.xz 82924 BLAKE2B 2cf75f661989f22270d6afe5f3c543814eb6a331be4493016fa2871e1f10a84a123c1c51e77a19b35e46680b9fe77390cb1532ca40d470a6041fa768fed3ccd7 SHA512 4b5811b4822b3a06f590fc7d082dc0ddf18a6058ac23887254e2ee9bd63c7f06f1636e446152115c7e0b01a6c5298a0d9df6904bd1582e66504ccde80dd1ecbd
-DIST binutils-2.39.tar.xz 25167756 BLAKE2B ac6a5296c6586d53eaadcbffc5c399a6d79edf72450b9bb8b3525ce525129cef3d2eb90c85ef3bb3270b5a03b0e1ffb8f0b705f028158726f9777ebb8685066f SHA512 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3
-DIST binutils-2.40-patches-2.tar.xz 183760 BLAKE2B 447f1c40ac8212b1e91f6f2137f87958c3f4e2366b11b9979d9d09d52e9fcde9a9d74f0c1871616157e001f505849fceb2097a512f434b9c848885e367a07c35 SHA512 30efbfcbd2d936c74d9480e4f2f4b8dcd30abcd0f1b22d21d20558002fdb8c90bd2fe97e3f27c2905714dcfd1297cac2646ede1e2c3d9fbf159f93c8cf01a290
+DIST binutils-2.40-patches-7.tar.xz 299188 BLAKE2B 170cd2432e0458889b240c3603461d0b4bfa62d5314634b101a629db455d87235ac14ad44c63920b713d5235fa8b73902960df1019153873ef06a33aa7050b4b SHA512 a60da163caee68fe1fa355385d404e8998ebed0e390d50e0713e95334733a8b4e37bc63d522817284c027953e43848dbc98042461a47131fb53bc69203b4ee87
 DIST binutils-2.40.tar.xz 25241484 BLAKE2B 8d799f7c595f878b9af5b17a490021dd8b8300ac2fe0ed8574c012929d22d2d0493e003a3e631a9436e8e712da801779b777c566167fe42b0bde119ffa5ad1c2 SHA512 a37e042523bc46494d99d5637c3f3d8f9956d9477b748b3b1f6d7dfbb8d968ed52c932e88a4e946c6f77b8f48f1e1b360ca54c3d298f17193f3b4963472f6925

diff --git a/sys-devel/binutils/binutils-2.34-r1.ebuild b/sys-devel/binutils/binutils-2.34-r1.ebuild
deleted file mode 100644
index 48fc6daf6d..0000000000
--- a/sys-devel/binutils/binutils-2.34-r1.ebuild
+++ /dev/null
@@ -1,445 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit eutils libtool flag-o-matic gnuconfig multilib toolchain-funcs
-
-DESCRIPTION="Tools necessary to build programs"
-HOMEPAGE="https://sourceware.org/binutils/"
-LICENSE="GPL-3+"
-IUSE="default-gold doc +gold multitarget +nls +plugins static-libs test"
-REQUIRED_USE="default-gold? ( gold )"
-
-# Variables that can be set here:
-# PATCH_VER          - the patchset version
-#                      Default: empty, no patching
-# PATCH_BINUTILS_VER - the binutils version in the patchset name
-#                    - Default: PV
-# PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
-#                      for the patchsets
-
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-case ${PV} in
-	9999)
-		EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
-		inherit git-r3
-		S=${WORKDIR}/binutils
-		EGIT_CHECKOUT_DIR=${S}
-		SLOT=${PV}
-		;;
-	*.9999)
-		EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
-		inherit git-r3
-		S=${WORKDIR}/binutils
-		EGIT_CHECKOUT_DIR=${S}
-		EGIT_BRANCH=$(ver_cut 1-2)
-		EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch"
-		SLOT=$(ver_cut 1-2)
-		;;
-	*)
-		SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
-		SLOT=$(ver_cut 1-2)
-		KEYWORDS="~amd64-linux ~x86-linux ~x64-solaris"
-		;;
-esac
-
-#
-# The Gentoo patchset
-#
-PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
-PATCH_DEV=${PATCH_DEV:-sam}
-
-[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
-	https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
-
-#
-# The cross-compile logic
-#
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
-
-#
-# The dependencies
-#
-RDEPEND="
-	>=sys-devel/binutils-config-3
-	sys-libs/zlib
-"
-DEPEND="${RDEPEND}"
-BDEPEND="
-	doc? ( sys-apps/texinfo )
-	test? ( dev-util/dejagnu )
-	nls? ( sys-devel/gettext )
-	sys-devel/flex
-	app-alternatives/yacc
-"
-
-RESTRICT="!test? ( test )"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-2.33-gcc-10.patch
-	"${FILESDIR}"/${PN}-2.34-riscv-SEGV.patch
-	"${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
-)
-
-MY_BUILDDIR=${WORKDIR}/build
-
-src_unpack() {
-	case ${PV} in
-		*9999)
-			git-r3_src_unpack
-			;;
-		*)
-			;;
-	esac
-	default
-	mkdir -p "${MY_BUILDDIR}"
-}
-
-src_prepare() {
-	if [[ ! -z ${PATCH_VER} ]] ; then
-		# Use upstream patch to enable development mode
-		rm -v "${WORKDIR}/patch"/0000-Gentoo-Git-is-development.patch || die
-
-		einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
-		eapply "${WORKDIR}/patch"/*.patch
-	fi
-
-	# This check should probably go somewhere else, like pkg_pretend.
-	if [[ ${CTARGET} == *-uclibc* ]] ; then
-		if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
-			die "sorry, but this binutils doesn't yet support uClibc :("
-		fi
-	fi
-
-	# Make sure our explicit libdir paths don't get clobbered. #562460
-	sed -i \
-		-e 's:@bfdlibdir@:@libdir@:g' \
-		-e 's:@bfdincludedir@:@includedir@:g' \
-		{bfd,opcodes}/Makefile.in || die
-
-	# Fix locale issues if possible #122216
-	if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
-		einfo "Fixing misc issues in configure files"
-		for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
-			ebegin "  Updating ${f/${S}\/}"
-			patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
-				|| eerror "Please file a bug about this"
-			eend $?
-		done
-	fi
-
-	# Fix conflicts with newer glibc #272594
-	if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
-		sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
-	fi
-
-	# Apply things from PATCHES and user dirs
-	default
-
-	# Run misc portage update scripts
-	gnuconfig_update
-	elibtoolize --portage --no-uclibc
-}
-
-toolchain-binutils_bugurl() {
-	printf "https://bugs.gentoo.org/"
-}
-toolchain-binutils_pkgversion() {
-	printf "Gentoo ${PV}"
-	[[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
-}
-
-src_configure() {
-	# Setup some paths
-	LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
-	INCPATH=${LIBPATH}/include
-	DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
-	if is_cross ; then
-		TOOLPATH=/usr/${CHOST}/${CTARGET}
-	else
-		TOOLPATH=/usr/${CTARGET}
-	fi
-	BINPATH=${TOOLPATH}/binutils-bin/${PV}
-
-	# Make sure we filter $LINGUAS so that only ones that
-	# actually work make it through #42033
-	strip-linguas -u */po
-
-	# Keep things sane
-	strip-flags
-
-	local x
-	echo
-	for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
-		einfo "$(printf '%10s' ${x}:) ${!x}"
-	done
-	echo
-
-	cd "${MY_BUILDDIR}"
-	local myconf=()
-
-	if use plugins ; then
-		myconf+=( --enable-plugins )
-	fi
-	# enable gold (installed as ld.gold) and ld's plugin architecture
-	if use gold ; then
-		myconf+=( --enable-gold )
-		if use default-gold; then
-			myconf+=( --enable-gold=default )
-		fi
-	fi
-
-	if use nls ; then
-		myconf+=( --without-included-gettext )
-		[[ ${CHOST} == *"-solaris"* ]] && append-libs -lintl
-	else
-		myconf+=( --disable-nls )
-	fi
-
-	myconf+=( --with-system-zlib )
-
-	# For bi-arch systems, enable a 64bit bfd.  This matches
-	# the bi-arch logic in toolchain.eclass. #446946
-	# We used to do it for everyone, but it's slow on 32bit arches. #438522
-	case $(tc-arch) in
-		ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
-	esac
-
-	use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
-
-	[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
-
-	is_cross && myconf+=(
-		--with-sysroot="${EPREFIX}"/usr/${CTARGET}
-		--enable-poison-system-directories
-	)
-
-	# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
-	# on everyone in alpha (for now), we'll just enable it when possible
-	has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
-	has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
-
-	# mips can't do hash-style=gnu ...
-	# let's not do this on Solaris either
-	if [[ $(tc-arch) != mips && ${CHOST} != *-solaris* ]] ; then
-		myconf+=( --enable-default-hash-style=gnu )
-	fi
-
-	myconf+=(
-		--prefix="${EPREFIX}"/usr
-		--host=${CHOST}
-		--target=${CTARGET}
-		--datadir="${EPREFIX}"${DATAPATH}
-		--datarootdir="${EPREFIX}"${DATAPATH}
-		--infodir="${EPREFIX}"${DATAPATH}/info
-		--mandir="${EPREFIX}"${DATAPATH}/man
-		--bindir="${EPREFIX}"${BINPATH}
-		--libdir="${EPREFIX}"${LIBPATH}
-		--libexecdir="${EPREFIX}"${LIBPATH}
-		--includedir="${EPREFIX}"${INCPATH}
-		--enable-obsolete
-		--enable-shared
-		--enable-threads
-		# Newer versions (>=2.27) offer a configure flag now.
-		--enable-relro
-		# Newer versions (>=2.24) make this an explicit option. #497268
-		--enable-install-libiberty
-		--disable-werror
-		--with-bugurl="$(toolchain-binutils_bugurl)"
-		--with-pkgversion="$(toolchain-binutils_pkgversion)"
-		$(use_enable static-libs static)
-		${EXTRA_ECONF}
-		# Disable modules that are in a combined binutils/gdb tree. #490566
-		--disable-{gdb,libdecnumber,readline,sim}
-		# Strip out broken static link flags.
-		# https://gcc.gnu.org/PR56750
-		--without-stage1-ldflags
-		# Change SONAME to avoid conflict across
-		# {native,cross}/binutils, binutils-libs. #666100
-		--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
-	)
-	echo ./configure "${myconf[@]}"
-	"${S}"/configure "${myconf[@]}" || die
-
-	# Prevent makeinfo from running if doc is unset.
-	if ! use doc ; then
-		sed -i \
-			-e '/^MAKEINFO/s:=.*:= true:' \
-			Makefile || die
-	fi
-}
-
-src_compile() {
-	cd "${MY_BUILDDIR}"
-	# see Note [tooldir hack for ldscripts]
-	emake tooldir="${EPREFIX}${TOOLPATH}" all
-
-	# only build info pages if the user wants them
-	if use doc ; then
-		emake info
-	fi
-
-	# we nuke the manpages when we're left with junk
-	# (like when we bootstrap, no perl -> no manpages)
-	find . -name '*.1' -a -size 0 -delete
-}
-
-src_test() {
-	cd "${MY_BUILDDIR}"
-
-	# bug 637066
-	filter-flags -Wall -Wreturn-type
-
-	emake -k check
-}
-
-src_install() {
-	local x d
-
-	cd "${MY_BUILDDIR}"
-	# see Note [tooldir hack for ldscripts]
-	emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
-	rm -rf "${ED}"/${LIBPATH}/bin
-	use static-libs || find "${ED}" -name '*.la' -delete
-
-	# Newer versions of binutils get fancy with ${LIBPATH} #171905
-	cd "${ED}"/${LIBPATH}
-	for d in ../* ; do
-		[[ ${d} == ../${PV} ]] && continue
-		mv ${d}/* . || die
-		rmdir ${d} || die
-	done
-
-	# Now we collect everything intp the proper SLOT-ed dirs
-	# When something is built to cross-compile, it installs into
-	# /usr/$CHOST/ by default ... we have to 'fix' that :)
-	if is_cross ; then
-		cd "${ED}"/${BINPATH}
-		for x in * ; do
-			mv ${x} ${x/${CTARGET}-}
-		done
-
-		if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
-			mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
-			mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
-			rm -r "${ED}"/usr/${CHOST}/{include,lib}
-		fi
-	fi
-	insinto ${INCPATH}
-	local libiberty_headers=(
-		# Not all the libiberty headers.  See libiberty/Makefile.in:install_to_libdir.
-		demangle.h
-		dyn-string.h
-		fibheap.h
-		hashtab.h
-		libiberty.h
-		objalloc.h
-		splay-tree.h
-	)
-	doins "${libiberty_headers[@]/#/${S}/include/}"
-	if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
-		mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
-		rm -r "${ED}"/${LIBPATH}/lib
-	fi
-
-	# Generate an env.d entry for this binutils
-	insinto /etc/env.d/binutils
-	cat <<-EOF > "${T}"/env.d
-		TARGET="${CTARGET}"
-		VER="${PV}"
-		LIBPATH="${EPREFIX}${LIBPATH}"
-	EOF
-	newins "${T}"/env.d ${CTARGET}-${PV}
-
-	# Handle documentation
-	if ! is_cross ; then
-		cd "${S}"
-		dodoc README
-		docinto bfd
-		dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
-		docinto binutils
-		dodoc binutils/ChangeLog binutils/NEWS binutils/README
-		docinto gas
-		dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
-		docinto gprof
-		dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
-		docinto ld
-		dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
-		docinto libiberty
-		dodoc libiberty/ChangeLog* libiberty/README
-		docinto opcodes
-		dodoc opcodes/ChangeLog*
-	fi
-
-	# Remove shared info pages
-	rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
-
-	# Trim all empty dirs
-	find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
-}
-
-pkg_postinst() {
-	# Make sure this ${CTARGET} has a binutils version selected
-	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
-	binutils-config ${CTARGET}-${PV}
-}
-
-pkg_postrm() {
-	local current_profile=$(binutils-config -c ${CTARGET})
-
-	# If no other versions exist, then uninstall for this
-	# target ... otherwise, switch to the newest version
-	# Note: only do this if this version is unmerged.  We
-	#       rerun binutils-config if this is a remerge, as
-	#       we want the mtimes on the symlinks updated (if
-	#       it is the same as the current selected profile)
-	if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
-		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
-		choice=${choice//$'\n'/ }
-		choice=${choice/* }
-		if [[ -z ${choice} ]] ; then
-			env -i ROOT="${ROOT}" binutils-config -u ${CTARGET}
-		else
-			binutils-config ${choice}
-		fi
-	elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
-		binutils-config ${CTARGET}-${PV}
-	fi
-}
-
-# Note [slotting support]
-# -----------------------
-# Gentoo's layout for binutils files is non-standard as Gentoo
-# supports slotted installation for binutils. Many tools
-# still expect binutils to reside in known locations.
-# binutils-config package restores symlinks into known locations,
-# like:
-#    /usr/bin/${CTARGET}-<tool>
-#    /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
-#    /usr/include/
-#
-# Note [tooldir hack for ldscripts]
-# ---------------------------------
-# Build system does not allow ./configure to tweak every location
-# we need for slotting binutils hence all the shuffling in
-# src_install(). This note is about SCRIPTDIR define handling.
-#
-# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
-# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
-# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
-# Thus we can't just move files around after compilation finished.
-#
-# Our goal is the following:
-# - at build-time set scriptdir to point to symlinked location:
-#   ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
-# - at install-time set scriptdir to point to slotted location:
-#   ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}

diff --git a/sys-devel/binutils/binutils-2.39-r2.ebuild b/sys-devel/binutils/binutils-2.39-r2.ebuild
deleted file mode 100644
index e409201076..0000000000
--- a/sys-devel/binutils/binutils-2.39-r2.ebuild
+++ /dev/null
@@ -1,498 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs
-
-DESCRIPTION="Tools necessary to build programs"
-HOMEPAGE="https://sourceware.org/binutils/"
-
-LICENSE="GPL-3+"
-IUSE="cet default-gold doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla"
-REQUIRED_USE="default-gold? ( gold )"
-
-# Variables that can be set here  (ignored for live ebuilds)
-# PATCH_VER          - the patchset version
-#                      Default: empty, no patching
-# PATCH_BINUTILS_VER - the binutils version in the patchset name
-#                    - Default: PV
-# PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
-#                      for the patchsets
-
-PATCH_VER=4
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-	SLOT=${PV}
-else
-	PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
-	PATCH_DEV=${PATCH_DEV:-dilfridge}
-	SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz"
-	[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
-		https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
-	SLOT=$(ver_cut 1-2)
-	KEYWORDS="~amd64-linux ~x86-linux ~x64-solaris"
-fi
-
-#
-# The cross-compile logic
-#
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
-
-#
-# The dependencies
-#
-RDEPEND="
-	>=sys-devel/binutils-config-3
-	sys-libs/zlib
-"
-DEPEND="${RDEPEND}"
-BDEPEND="
-	doc? ( sys-apps/texinfo )
-	test? (
-		dev-util/dejagnu
-		sys-devel/bc
-	)
-	nls? ( sys-devel/gettext )
-	sys-devel/flex
-	app-alternatives/yacc
-"
-
-RESTRICT="!test? ( test )"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
-)
-
-MY_BUILDDIR=${WORKDIR}/build
-
-src_unpack() {
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patch || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
-		S=${WORKDIR}/binutils
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P/-hppa64/}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz
-
-		# _p patch versions are Gentoo specific tarballs ...
-		local dir=${P%_p?}
-		dir=${dir/-hppa64/}
-
-		S=${WORKDIR}/${dir}
-	fi
-
-	cd "${WORKDIR}" || die
-	mkdir -p "${MY_BUILDDIR}" || die
-}
-
-src_prepare() {
-	local patchsetname
-	if [[ ${PV} == 9999* ]] ; then
-		patchsetname="from git master"
-	else
-		patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}"
-	fi
-
-	if [[ -n ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then
-		if ! use vanilla; then
-			einfo "Applying binutils patchset ${patchsetname}"
-			eapply "${WORKDIR}/patch"
-			einfo "Done."
-		fi
-	fi
-
-	# Make sure our explicit libdir paths don't get clobbered, bug #562460
-	sed -i \
-		-e 's:@bfdlibdir@:@libdir@:g' \
-		-e 's:@bfdincludedir@:@includedir@:g' \
-		{bfd,opcodes}/Makefile.in || die
-
-	# Fix locale issues if possible, bug #122216
-	if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
-		einfo "Fixing misc issues in configure files"
-		for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
-			ebegin "  Updating ${f/${S}\/}"
-			patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
-				|| eerror "Please file a bug about this"
-			eend $?
-		done
-	fi
-
-	# Apply things from PATCHES and user dirs
-	default
-
-	# Run misc portage update scripts
-	gnuconfig_update
-	elibtoolize --portage --no-uclibc
-}
-
-toolchain-binutils_bugurl() {
-	printf "https://bugs.gentoo.org/"
-}
-toolchain-binutils_pkgversion() {
-	printf "Gentoo ${PV}"
-	[[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
-}
-
-src_configure() {
-	# See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
-	# Avoid really confusing logs from subconfigure spam, makes logs far
-	# more legible.
-	MAKEOPTS="--output-sync=line ${MAKEOPTS}"
-
-	# Setup some paths
-	LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
-	INCPATH=${LIBPATH}/include
-	DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
-	if is_cross ; then
-		TOOLPATH=/usr/${CHOST}/${CTARGET}
-	else
-		TOOLPATH=/usr/${CTARGET}
-	fi
-	BINPATH=${TOOLPATH}/binutils-bin/${PV}
-
-	# Make sure we filter $LINGUAS so that only ones that
-	# actually work make it through, bug #42033
-	strip-linguas -u */po
-
-	# Keep things sane
-	strip-flags
-
-	use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152
-
-	local x
-	echo
-	for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
-		einfo "$(printf '%10s' ${x}:) ${!x}"
-	done
-	echo
-
-	cd "${MY_BUILDDIR}" || die
-	local myconf=()
-
-	if use plugins ; then
-		myconf+=( --enable-plugins )
-	fi
-	# enable gold (installed as ld.gold) and ld's plugin architecture
-	if use gold ; then
-		myconf+=( --enable-gold )
-		if use default-gold; then
-			myconf+=( --enable-gold=default )
-		fi
-	fi
-
-	if use nls ; then
-		myconf+=( --without-included-gettext )
-		[[ ${CHOST} == *"-solaris"* ]] && append-libs -lintl
-	else
-		myconf+=( --disable-nls )
-	fi
-
-	myconf+=( --with-system-zlib )
-
-	# For bi-arch systems, enable a 64bit bfd. This matches the bi-arch
-	# logic in toolchain.eclass. bug #446946
-	#
-	# We used to do it for everyone, but it's slow on 32bit arches. bug #438522
-	case $(tc-arch) in
-		ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
-	esac
-
-	use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
-
-	[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
-
-	is_cross && myconf+=(
-		--with-sysroot="${EPREFIX}"/usr/${CTARGET}
-		--enable-poison-system-directories
-	)
-
-	myconf+=( --enable-secureplt )
-
-	# mips can't do hash-style=gnu ...
-	# let's not do this on Solaris either
-	if [[ $(tc-arch) != mips && ${CHOST} != *-solaris* ]] ; then
-		myconf+=( --enable-default-hash-style=gnu )
-	fi
-
-	myconf+=(
-		--prefix="${EPREFIX}"/usr
-		--host=${CHOST}
-		--target=${CTARGET}
-		--datadir="${EPREFIX}"${DATAPATH}
-		--datarootdir="${EPREFIX}"${DATAPATH}
-		--infodir="${EPREFIX}"${DATAPATH}/info
-		--mandir="${EPREFIX}"${DATAPATH}/man
-		--bindir="${EPREFIX}"${BINPATH}
-		--libdir="${EPREFIX}"${LIBPATH}
-		--libexecdir="${EPREFIX}"${LIBPATH}
-		--includedir="${EPREFIX}"${INCPATH}
-		--enable-obsolete
-		--enable-shared
-		--enable-threads
-		# Newer versions (>=2.27) offer a configure flag now.
-		--enable-relro
-		# Newer versions (>=2.24) make this an explicit option, bug #497268
-		--enable-install-libiberty
-		# Available from 2.35 on
-		--enable-textrel-check=warning
-
-		# Available from 2.39 on
-		--enable-warn-execstack
-		--enable-warn-rwx-segments
-		# TODO: Available from 2.39+ on but let's try the warning on for a bit
-		# first... (--enable-warn-execstack)
-		# Could put it under USE=hardened?
-		#--disable-default-execstack (or is it --enable-default-execstack=no? docs are confusing)
-
-		# Things to think about
-		#--enable-deterministic-archives
-
-		# Works better than vapier's patch, bug #808787
-		--enable-new-dtags
-
-		--disable-jansson
-		--disable-werror
-		--with-bugurl="$(toolchain-binutils_bugurl)"
-		--with-pkgversion="$(toolchain-binutils_pkgversion)"
-		$(use_enable static-libs static)
-		# Disable modules that are in a combined binutils/gdb tree, bug #490566
-		--disable-{gdb,libdecnumber,readline,sim}
-		# Strip out broken static link flags.
-		# https://gcc.gnu.org/PR56750
-		--without-stage1-ldflags
-		# Change SONAME to avoid conflict across
-		# {native,cross}/binutils, binutils-libs. bug #666100
-		--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
-
-		# Avoid automagic dependency on (currently prefix) systems
-		# systems with debuginfod library, bug #754753
-		--without-debuginfod
-
-		# Avoid automagic dev-libs/msgpack dep, bug #865875
-		--without-msgpack
-
-		# Allow user to opt into CET for host libraries.
-		# Ideally we would like automagic-or-disabled here.
-		# But the check does not quite work on i686: bug #760926.
-		$(use_enable cet)
-
-		# We can enable this by default in future, but it's brand new
-		# in 2.39 with several bugs:
-		# - Doesn't build on musl (https://sourceware.org/bugzilla/show_bug.cgi?id=29477)
-		# - No man pages (https://sourceware.org/bugzilla/show_bug.cgi?id=29521)
-		# - Broken at runtime without Java (https://sourceware.org/bugzilla/show_bug.cgi?id=29479)
-		# - binutils-config (and this ebuild?) needs adaptation first (https://bugs.gentoo.org/865113)
-		$(use_enable gprofng)
-	)
-
-	if ! is_cross ; then
-		myconf+=( $(use_enable pgo pgo-build lto) )
-
-		if use pgo ; then
-			export BUILD_CFLAGS="${CFLAGS}"
-		fi
-	fi
-
-	ECONF_SOURCE="${S}" econf "${myconf[@]}" || die
-
-	# Prevent makeinfo from running if doc is unset.
-	if ! use doc ; then
-		sed -i \
-			-e '/^MAKEINFO/s:=.*:= true:' \
-			Makefile || die
-	fi
-}
-
-src_compile() {
-	cd "${MY_BUILDDIR}" || die
-
-	# see Note [tooldir hack for ldscripts]
-	emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all
-
-	# only build info pages if the user wants them
-	if use doc ; then
-		emake V=1 info
-	fi
-
-	# we nuke the manpages when we're left with junk
-	# (like when we bootstrap, no perl -> no manpages)
-	find . -name '*.1' -a -size 0 -delete
-}
-
-src_test() {
-	cd "${MY_BUILDDIR}" || die
-
-	# bug #637066
-	filter-flags -Wall -Wreturn-type
-
-	emake -k V=1 check
-}
-
-src_install() {
-	local x d
-
-	cd "${MY_BUILDDIR}" || die
-
-	# see Note [tooldir hack for ldscripts]
-	emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
-	rm -rf "${ED}"/${LIBPATH}/bin || die
-	use static-libs || find "${ED}" -name '*.la' -delete
-
-	# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
-	cd "${ED}"/${LIBPATH} || die
-	for d in ../* ; do
-		[[ ${d} == ../${PV} ]] && continue
-		mv ${d}/* . || die
-		rmdir ${d} || die
-	done
-
-	# Now we collect everything intp the proper SLOT-ed dirs
-	# When something is built to cross-compile, it installs into
-	# /usr/$CHOST/ by default ... we have to 'fix' that :)
-	if is_cross ; then
-		cd "${ED}"/${BINPATH} || die
-		for x in * ; do
-			mv ${x} ${x/${CTARGET}-} || die
-		done
-
-		if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
-			mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
-			mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
-			rm -r "${ED}"/usr/${CHOST}/{include,lib}
-		fi
-	fi
-
-	insinto ${INCPATH}
-	local libiberty_headers=(
-		# Not all the libiberty headers.  See libiberty/Makefile.in:install_to_libdir.
-		demangle.h
-		dyn-string.h
-		fibheap.h
-		hashtab.h
-		libiberty.h
-		objalloc.h
-		splay-tree.h
-	)
-	doins "${libiberty_headers[@]/#/${S}/include/}"
-	if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
-		mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die
-		rm -r "${ED}"/${LIBPATH}/lib || die
-	fi
-
-	# Generate an env.d entry for this binutils
-	insinto /etc/env.d/binutils
-	cat <<-EOF > "${T}"/env.d
-		TARGET="${CTARGET}"
-		VER="${PV}"
-		LIBPATH="${EPREFIX}${LIBPATH}"
-	EOF
-	newins "${T}"/env.d ${CTARGET}-${PV}
-
-	# Handle documentation
-	if ! is_cross ; then
-		cd "${S}" || die
-		dodoc README
-
-		docinto bfd
-		dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
-
-		docinto binutils
-		dodoc binutils/ChangeLog binutils/NEWS binutils/README
-
-		docinto gas
-		dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
-
-		docinto gprof
-		dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
-
-		docinto ld
-		dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
-
-		docinto libiberty
-		dodoc libiberty/ChangeLog* libiberty/README
-
-		docinto opcodes
-		dodoc opcodes/ChangeLog*
-	fi
-
-	# Remove shared info pages
-	rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
-
-	# Trim all empty dirs
-	find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
-}
-
-pkg_postinst() {
-	# Make sure this ${CTARGET} has a binutils version selected
-	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
-	binutils-config ${CTARGET}-${PV}
-}
-
-pkg_postrm() {
-	local current_profile=$(binutils-config -c ${CTARGET})
-
-	# If no other versions exist, then uninstall for this
-	# target ... otherwise, switch to the newest version
-	# Note: only do this if this version is unmerged.  We
-	#       rerun binutils-config if this is a remerge, as
-	#       we want the mtimes on the symlinks updated (if
-	#       it is the same as the current selected profile)
-	if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
-		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
-		choice=${choice//$'\n'/ }
-		choice=${choice/* }
-		if [[ -z ${choice} ]] ; then
-			env -i ROOT="${ROOT}" binutils-config -u ${CTARGET}
-		else
-			binutils-config ${choice}
-		fi
-	elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
-		binutils-config ${CTARGET}-${PV}
-	fi
-}
-
-# Note [slotting support]
-# -----------------------
-# Gentoo's layout for binutils files is non-standard as Gentoo
-# supports slotted installation for binutils. Many tools
-# still expect binutils to reside in known locations.
-# binutils-config package restores symlinks into known locations,
-# like:
-#    /usr/bin/${CTARGET}-<tool>
-#    /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
-#    /usr/include/
-#
-# Note [tooldir hack for ldscripts]
-# ---------------------------------
-# Build system does not allow ./configure to tweak every location
-# we need for slotting binutils hence all the shuffling in
-# src_install(). This note is about SCRIPTDIR define handling.
-#
-# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
-# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
-# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
-# Thus we can't just move files around after compilation finished.
-#
-# Our goal is the following:
-# - at build-time set scriptdir to point to symlinked location:
-#   ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
-# - at install-time set scriptdir to point to slotted location:
-#   ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}

diff --git a/sys-devel/binutils/binutils-2.39-r4.ebuild b/sys-devel/binutils/binutils-2.39-r4.ebuild
deleted file mode 100644
index fd27c6420c..0000000000
--- a/sys-devel/binutils/binutils-2.39-r4.ebuild
+++ /dev/null
@@ -1,499 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs
-
-DESCRIPTION="Tools necessary to build programs"
-HOMEPAGE="https://sourceware.org/binutils/"
-
-LICENSE="GPL-3+"
-IUSE="cet default-gold doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla"
-REQUIRED_USE="default-gold? ( gold )"
-
-# Variables that can be set here  (ignored for live ebuilds)
-# PATCH_VER          - the patchset version
-#                      Default: empty, no patching
-# PATCH_BINUTILS_VER - the binutils version in the patchset name
-#                    - Default: PV
-# PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
-#                      for the patchsets
-
-PATCH_VER=5
-PATCH_DEV=dilfridge
-
-if [[ ${PV} == 9999* ]]; then
-	inherit git-r3
-	SLOT=${PV}
-else
-	PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
-	PATCH_DEV=${PATCH_DEV:-dilfridge}
-	SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz"
-	[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
-		https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
-	SLOT=$(ver_cut 1-2)
-	KEYWORDS="~amd64-linux ~x86-linux ~x64-solaris"
-fi
-
-#
-# The cross-compile logic
-#
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
-
-#
-# The dependencies
-#
-RDEPEND="
-	>=sys-devel/binutils-config-3
-	sys-libs/zlib
-"
-DEPEND="${RDEPEND}"
-BDEPEND="
-	doc? ( sys-apps/texinfo )
-	test? (
-		dev-util/dejagnu
-		sys-devel/bc
-	)
-	nls? ( sys-devel/gettext )
-	sys-devel/flex
-	app-alternatives/yacc
-"
-
-RESTRICT="!test? ( test )"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
-	"${FILESDIR}"/${PN}-2.39-protected-visibility-solaris.patch
-)
-
-MY_BUILDDIR=${WORKDIR}/build
-
-src_unpack() {
-	if [[ ${PV} == 9999* ]] ; then
-		EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git"
-		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
-		git-r3_src_unpack
-		mv patches-git/9999 patch || die
-
-		EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
-		S=${WORKDIR}/binutils
-		EGIT_CHECKOUT_DIR=${S}
-		git-r3_src_unpack
-	else
-		unpack ${P/-hppa64/}.tar.xz
-
-		cd "${WORKDIR}" || die
-		unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz
-
-		# _p patch versions are Gentoo specific tarballs ...
-		local dir=${P%_p?}
-		dir=${dir/-hppa64/}
-
-		S=${WORKDIR}/${dir}
-	fi
-
-	cd "${WORKDIR}" || die
-	mkdir -p "${MY_BUILDDIR}" || die
-}
-
-src_prepare() {
-	local patchsetname
-	if [[ ${PV} == 9999* ]] ; then
-		patchsetname="from git master"
-	else
-		patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}"
-	fi
-
-	if [[ -n ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then
-		if ! use vanilla; then
-			einfo "Applying binutils patchset ${patchsetname}"
-			eapply "${WORKDIR}/patch"
-			einfo "Done."
-		fi
-	fi
-
-	# Make sure our explicit libdir paths don't get clobbered, bug #562460
-	sed -i \
-		-e 's:@bfdlibdir@:@libdir@:g' \
-		-e 's:@bfdincludedir@:@includedir@:g' \
-		{bfd,opcodes}/Makefile.in || die
-
-	# Fix locale issues if possible, bug #122216
-	if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
-		einfo "Fixing misc issues in configure files"
-		for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
-			ebegin "  Updating ${f/${S}\/}"
-			patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
-				|| eerror "Please file a bug about this"
-			eend $?
-		done
-	fi
-
-	# Apply things from PATCHES and user dirs
-	default
-
-	# Run misc portage update scripts
-	gnuconfig_update
-	elibtoolize --portage --no-uclibc
-}
-
-toolchain-binutils_bugurl() {
-	printf "https://bugs.gentoo.org/"
-}
-toolchain-binutils_pkgversion() {
-	printf "Gentoo ${PV}"
-	[[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
-}
-
-src_configure() {
-	# See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
-	# Avoid really confusing logs from subconfigure spam, makes logs far
-	# more legible.
-	MAKEOPTS="--output-sync=line ${MAKEOPTS}"
-
-	# Setup some paths
-	LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
-	INCPATH=${LIBPATH}/include
-	DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
-	if is_cross ; then
-		TOOLPATH=/usr/${CHOST}/${CTARGET}
-	else
-		TOOLPATH=/usr/${CTARGET}
-	fi
-	BINPATH=${TOOLPATH}/binutils-bin/${PV}
-
-	# Make sure we filter $LINGUAS so that only ones that
-	# actually work make it through, bug #42033
-	strip-linguas -u */po
-
-	# Keep things sane
-	strip-flags
-
-	use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152
-
-	local x
-	echo
-	for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
-		einfo "$(printf '%10s' ${x}:) ${!x}"
-	done
-	echo
-
-	cd "${MY_BUILDDIR}" || die
-	local myconf=()
-
-	if use plugins ; then
-		myconf+=( --enable-plugins )
-	fi
-	# enable gold (installed as ld.gold) and ld's plugin architecture
-	if use gold ; then
-		myconf+=( --enable-gold )
-		if use default-gold; then
-			myconf+=( --enable-gold=default )
-		fi
-	fi
-
-	if use nls ; then
-		myconf+=( --without-included-gettext )
-		[[ ${CHOST} == *"-solaris"* ]] && append-libs -lintl
-	else
-		myconf+=( --disable-nls )
-	fi
-
-	myconf+=( --with-system-zlib )
-
-	# For bi-arch systems, enable a 64bit bfd. This matches the bi-arch
-	# logic in toolchain.eclass. bug #446946
-	#
-	# We used to do it for everyone, but it's slow on 32bit arches. bug #438522
-	case $(tc-arch) in
-		ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
-	esac
-
-	use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
-
-	[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
-
-	is_cross && myconf+=(
-		--with-sysroot="${EPREFIX}"/usr/${CTARGET}
-		--enable-poison-system-directories
-	)
-
-	myconf+=( --enable-secureplt )
-
-	# mips can't do hash-style=gnu ...
-	# let's not do this on Solaris either
-	if [[ $(tc-arch) != mips && ${CHOST} != *-solaris* ]] ; then
-		myconf+=( --enable-default-hash-style=gnu )
-	fi
-
-	myconf+=(
-		--prefix="${EPREFIX}"/usr
-		--host=${CHOST}
-		--target=${CTARGET}
-		--datadir="${EPREFIX}"${DATAPATH}
-		--datarootdir="${EPREFIX}"${DATAPATH}
-		--infodir="${EPREFIX}"${DATAPATH}/info
-		--mandir="${EPREFIX}"${DATAPATH}/man
-		--bindir="${EPREFIX}"${BINPATH}
-		--libdir="${EPREFIX}"${LIBPATH}
-		--libexecdir="${EPREFIX}"${LIBPATH}
-		--includedir="${EPREFIX}"${INCPATH}
-		--enable-obsolete
-		--enable-shared
-		--enable-threads
-		# Newer versions (>=2.27) offer a configure flag now.
-		--enable-relro
-		# Newer versions (>=2.24) make this an explicit option, bug #497268
-		--enable-install-libiberty
-		# Available from 2.35 on
-		--enable-textrel-check=warning
-
-		# These hardening options are available from 2.39+ but
-		# they unconditionally enable the behaviour even on arches
-		# where e.g. execstacks can't be avoided.
-		# See https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
-		#--enable-warn-execstack
-		#--enable-warn-rwx-segments
-		#--disable-default-execstack (or is it --enable-default-execstack=no? docs are confusing)
-
-		# Things to think about
-		#--enable-deterministic-archives
-
-		# Works better than vapier's patch, bug #808787
-		--enable-new-dtags
-
-		--disable-jansson
-		--disable-werror
-		--with-bugurl="$(toolchain-binutils_bugurl)"
-		--with-pkgversion="$(toolchain-binutils_pkgversion)"
-		$(use_enable static-libs static)
-		# Disable modules that are in a combined binutils/gdb tree, bug #490566
-		--disable-{gdb,libdecnumber,readline,sim}
-		# Strip out broken static link flags.
-		# https://gcc.gnu.org/PR56750
-		--without-stage1-ldflags
-		# Change SONAME to avoid conflict across
-		# {native,cross}/binutils, binutils-libs. bug #666100
-		--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
-
-		# Avoid automagic dependency on (currently prefix) systems
-		# systems with debuginfod library, bug #754753
-		--without-debuginfod
-
-		# Avoid automagic dev-libs/msgpack dep, bug #865875
-		--without-msgpack
-
-		# Allow user to opt into CET for host libraries.
-		# Ideally we would like automagic-or-disabled here.
-		# But the check does not quite work on i686: bug #760926.
-		$(use_enable cet)
-
-		# We can enable this by default in future, but it's brand new
-		# in 2.39 with several bugs:
-		# - Doesn't build on musl (https://sourceware.org/bugzilla/show_bug.cgi?id=29477)
-		# - No man pages (https://sourceware.org/bugzilla/show_bug.cgi?id=29521)
-		# - Broken at runtime without Java (https://sourceware.org/bugzilla/show_bug.cgi?id=29479)
-		# - binutils-config (and this ebuild?) needs adaptation first (https://bugs.gentoo.org/865113)
-		$(use_enable gprofng)
-	)
-
-	if ! is_cross ; then
-		myconf+=( $(use_enable pgo pgo-build lto) )
-
-		if use pgo ; then
-			export BUILD_CFLAGS="${CFLAGS}"
-		fi
-	fi
-
-	ECONF_SOURCE="${S}" econf "${myconf[@]}" || die
-
-	# Prevent makeinfo from running if doc is unset.
-	if ! use doc ; then
-		sed -i \
-			-e '/^MAKEINFO/s:=.*:= true:' \
-			Makefile || die
-	fi
-}
-
-src_compile() {
-	cd "${MY_BUILDDIR}" || die
-
-	# see Note [tooldir hack for ldscripts]
-	emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all
-
-	# only build info pages if the user wants them
-	if use doc ; then
-		emake V=1 info
-	fi
-
-	# we nuke the manpages when we're left with junk
-	# (like when we bootstrap, no perl -> no manpages)
-	find . -name '*.1' -a -size 0 -delete
-}
-
-src_test() {
-	cd "${MY_BUILDDIR}" || die
-
-	# bug #637066
-	filter-flags -Wall -Wreturn-type
-
-	emake -k V=1 check
-}
-
-src_install() {
-	local x d
-
-	cd "${MY_BUILDDIR}" || die
-
-	# see Note [tooldir hack for ldscripts]
-	emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
-	rm -rf "${ED}"/${LIBPATH}/bin || die
-	use static-libs || find "${ED}" -name '*.la' -delete
-
-	# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
-	cd "${ED}"/${LIBPATH} || die
-	for d in ../* ; do
-		[[ ${d} == ../${PV} ]] && continue
-		mv ${d}/* . || die
-		rmdir ${d} || die
-	done
-
-	# Now we collect everything intp the proper SLOT-ed dirs
-	# When something is built to cross-compile, it installs into
-	# /usr/$CHOST/ by default ... we have to 'fix' that :)
-	if is_cross ; then
-		cd "${ED}"/${BINPATH} || die
-		for x in * ; do
-			mv ${x} ${x/${CTARGET}-} || die
-		done
-
-		if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
-			mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
-			mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
-			rm -r "${ED}"/usr/${CHOST}/{include,lib}
-		fi
-	fi
-
-	insinto ${INCPATH}
-	local libiberty_headers=(
-		# Not all the libiberty headers.  See libiberty/Makefile.in:install_to_libdir.
-		demangle.h
-		dyn-string.h
-		fibheap.h
-		hashtab.h
-		libiberty.h
-		objalloc.h
-		splay-tree.h
-	)
-	doins "${libiberty_headers[@]/#/${S}/include/}"
-	if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
-		mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die
-		rm -r "${ED}"/${LIBPATH}/lib || die
-	fi
-
-	# Generate an env.d entry for this binutils
-	insinto /etc/env.d/binutils
-	cat <<-EOF > "${T}"/env.d
-		TARGET="${CTARGET}"
-		VER="${PV}"
-		LIBPATH="${EPREFIX}${LIBPATH}"
-	EOF
-	newins "${T}"/env.d ${CTARGET}-${PV}
-
-	# Handle documentation
-	if ! is_cross ; then
-		cd "${S}" || die
-		dodoc README
-
-		docinto bfd
-		dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
-
-		docinto binutils
-		dodoc binutils/ChangeLog binutils/NEWS binutils/README
-
-		docinto gas
-		dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
-
-		docinto gprof
-		dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
-
-		docinto ld
-		dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
-
-		docinto libiberty
-		dodoc libiberty/ChangeLog* libiberty/README
-
-		docinto opcodes
-		dodoc opcodes/ChangeLog*
-	fi
-
-	# Remove shared info pages
-	rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
-
-	# Trim all empty dirs
-	find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
-}
-
-pkg_postinst() {
-	# Make sure this ${CTARGET} has a binutils version selected
-	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
-	binutils-config ${CTARGET}-${PV}
-}
-
-pkg_postrm() {
-	local current_profile=$(binutils-config -c ${CTARGET})
-
-	# If no other versions exist, then uninstall for this
-	# target ... otherwise, switch to the newest version
-	# Note: only do this if this version is unmerged.  We
-	#       rerun binutils-config if this is a remerge, as
-	#       we want the mtimes on the symlinks updated (if
-	#       it is the same as the current selected profile)
-	if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
-		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
-		choice=${choice//$'\n'/ }
-		choice=${choice/* }
-		if [[ -z ${choice} ]] ; then
-			env -i ROOT="${ROOT}" binutils-config -u ${CTARGET}
-		else
-			binutils-config ${choice}
-		fi
-	elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
-		binutils-config ${CTARGET}-${PV}
-	fi
-}
-
-# Note [slotting support]
-# -----------------------
-# Gentoo's layout for binutils files is non-standard as Gentoo
-# supports slotted installation for binutils. Many tools
-# still expect binutils to reside in known locations.
-# binutils-config package restores symlinks into known locations,
-# like:
-#    /usr/bin/${CTARGET}-<tool>
-#    /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
-#    /usr/include/
-#
-# Note [tooldir hack for ldscripts]
-# ---------------------------------
-# Build system does not allow ./configure to tweak every location
-# we need for slotting binutils hence all the shuffling in
-# src_install(). This note is about SCRIPTDIR define handling.
-#
-# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
-# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
-# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
-# Thus we can't just move files around after compilation finished.
-#
-# Our goal is the following:
-# - at build-time set scriptdir to point to symlinked location:
-#   ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
-# - at install-time set scriptdir to point to slotted location:
-#   ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}

diff --git a/sys-devel/binutils/binutils-2.40-r2.ebuild b/sys-devel/binutils/binutils-2.40-r8.ebuild
similarity index 96%
rename from sys-devel/binutils/binutils-2.40-r2.ebuild
rename to sys-devel/binutils/binutils-2.40-r8.ebuild
index 08700c31bf..5f1cfd4510 100644
--- a/sys-devel/binutils/binutils-2.40-r2.ebuild
+++ b/sys-devel/binutils/binutils-2.40-r8.ebuild
@@ -9,7 +9,7 @@ DESCRIPTION="Tools necessary to build programs"
 HOMEPAGE="https://sourceware.org/binutils/"
 
 LICENSE="GPL-3+"
-IUSE="cet doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla zstd"
+IUSE="cet debuginfod doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla zstd"
 
 # Variables that can be set here  (ignored for live ebuilds)
 # PATCH_VER          - the patchset version
@@ -19,7 +19,7 @@ IUSE="cet doc gold gprofng multitarget +nls pgo +plugins static-libs test vanill
 # PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
 #                      for the patchsets
 
-PATCH_VER=2
+PATCH_VER=7
 PATCH_DEV=dilfridge
 
 if [[ ${PV} == 9999* ]]; then
@@ -52,6 +52,9 @@ is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
 RDEPEND="
 	>=sys-devel/binutils-config-3
 	sys-libs/zlib
+	debuginfod? (
+		dev-libs/elfutils[debuginfod(-)]
+	)
 	zstd? ( app-arch/zstd:= )
 "
 DEPEND="${RDEPEND}"
@@ -253,6 +256,11 @@ src_configure() {
 		--libdir="${EPREFIX}"${LIBPATH}
 		--libexecdir="${EPREFIX}"${LIBPATH}
 		--includedir="${EPREFIX}"${INCPATH}
+		# portage's econf() does not detect presence of --d-d-t
+		# because it greps only top-level ./configure. But not
+		# libiberty's or bfd's configure.
+		--disable-dependency-tracking
+		--disable-silent-rules
 		--enable-obsolete
 		--enable-shared
 		--enable-threads
@@ -336,11 +344,11 @@ src_compile() {
 	cd "${MY_BUILDDIR}" || die
 
 	# see Note [tooldir hack for ldscripts]
-	emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all
+	emake tooldir="${EPREFIX}${TOOLPATH}" all
 
 	# only build info pages if the user wants them
 	if use doc ; then
-		emake V=1 info
+		emake info
 	fi
 
 	# we nuke the manpages when we're left with junk
@@ -354,7 +362,7 @@ src_test() {
 	# bug #637066
 	filter-flags -Wall -Wreturn-type
 
-	emake -k V=1 check
+	emake -k check
 }
 
 src_install() {
@@ -363,7 +371,7 @@ src_install() {
 	cd "${MY_BUILDDIR}" || die
 
 	# see Note [tooldir hack for ldscripts]
-	emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
+	emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
 	rm -rf "${ED}"/${LIBPATH}/bin || die
 	use static-libs || find "${ED}" -name '*.la' -delete
 

diff --git a/sys-devel/binutils/files/binutils-2.24-cygwin-nointl.patch b/sys-devel/binutils/files/binutils-2.24-cygwin-nointl.patch
deleted file mode 100644
index 753996335b..0000000000
--- a/sys-devel/binutils/files/binutils-2.24-cygwin-nointl.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/bfd/configure b/bfd/configure
-index eeeb89a..6b7c5b8 100755
---- a/bfd/configure
-+++ b/bfd/configure
-@@ -15105,7 +15105,7 @@ if test "$enable_shared" = "yes"; then
-   case "${host}" in
-   *-*-cygwin*)
-     SHARED_LDFLAGS="-no-undefined"
--    SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
-+	SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl \$(LIBINTL) -lcygwin -lkernel32"
-   ;;
- 
-   # Hack to build or1k-src on OSX
-diff --git a/opcodes/configure b/opcodes/configure
-index e5048e2..1e9ca69 100755
---- a/opcodes/configure
-+++ b/opcodes/configure
-@@ -12456,7 +12456,7 @@ if test "$enable_shared" = "yes"; then
-   case "${host}" in
-     *-*-cygwin*)
-       SHARED_LDFLAGS="-no-undefined"
--      SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
-+	  SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl \$(LIBINTL) -lcygwin"
-       ;;
-    *-*-darwin*)
-      SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}"

diff --git a/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch b/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch
deleted file mode 100644
index 8e0669922d..0000000000
--- a/sys-devel/binutils/files/binutils-2.29.1-nogoldtest.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 40f6e93e5078f16897f23856886566fe3b546206 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
-Date: Fri, 3 Nov 2017 21:51:35 +0100
-Subject: [PATCH] Gentoo: Disable gold testsuite for users since it fails
- upstream
-
-https://bugs.gentoo.org/634348
-https://sourceware.org/bugzilla/show_bug.cgi?id=21090
----
- Makefile.in | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/Makefile.in b/Makefile.in
-index 3acb83b8de..49de829bfa 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -2340,7 +2340,6 @@ check-host:  \
-     maybe-check-mpc \
-     maybe-check-isl \
-     maybe-check-libelf \
--    maybe-check-gold \
-     maybe-check-gprof \
-     maybe-check-intl \
-     maybe-check-tcl \
--- 
-2.15.0
-

diff --git a/sys-devel/binutils/files/binutils-2.33-gcc-10.patch b/sys-devel/binutils/files/binutils-2.33-gcc-10.patch
deleted file mode 100644
index 9e1a999be9..0000000000
--- a/sys-devel/binutils/files/binutils-2.33-gcc-10.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-binutils: drop redundant 'program_name' definition
-
-https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=0b398d69acde3377dfbbeb8a4cfe87ae8c8562fa
---- a/binutils/coffdump.c
-+++ b/binutils/coffdump.c
-@@ -456,8 +456,6 @@ coff_dump (struct coff_ofile *ptr)
-     dump_coff_section (ptr->sections + i);
- }
- 
--char * program_name;
--
- static void
- show_usage (FILE *file, int status)
- {
---- a/binutils/srconv.c
-+++ b/binutils/srconv.c
-@@ -1687,8 +1687,6 @@ prescan (struct coff_ofile *otree)
-     }
- }
- 
--char *program_name;
--
- ATTRIBUTE_NORETURN static void
- show_usage (FILE *ffile, int status)
- {
---- a/binutils/sysdump.c
-+++ b/binutils/sysdump.c
-@@ -633,8 +633,6 @@ module (void)
-     }
- }
- 
--char *program_name;
--
- ATTRIBUTE_NORETURN static void
- show_usage (FILE *ffile, int status)
- {
--- 
-2.25.0
-

diff --git a/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch
deleted file mode 100644
index ac70e50491..0000000000
--- a/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-https://sourceware.org/PR25900
-https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8
-
-From a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 Mon Sep 17 00:00:00 2001
-From: Alan Modra <amodra@gmail.com>
-Date: Fri, 1 May 2020 15:32:00 +0930
-Subject: [PATCH] PR25900, RISC-V: null pointer dereference
-
-	PR 25900
-	* elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
-	accessing root.u.def of symbols.  Also check root.u.def.section
-	is non-NULL.  Reverse tests so as to make the logic positive.
-
---- a/bfd/elfnn-riscv.c
-+++ b/bfd/elfnn-riscv.c
-@@ -4161,15 +4161,16 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec,
- 	      symval = 0;
- 	      sym_sec = bfd_und_section_ptr;
- 	    }
--	  else if (h->root.u.def.section->output_section == NULL
--		   || (h->root.type != bfd_link_hash_defined
--		       && h->root.type != bfd_link_hash_defweak))
--	    continue;
--	  else
-+	  else if ((h->root.type == bfd_link_hash_defined
-+		    || h->root.type == bfd_link_hash_defweak)
-+		   && h->root.u.def.section != NULL
-+		   && h->root.u.def.section->output_section != NULL)
- 	    {
- 	      symval = h->root.u.def.value;
- 	      sym_sec = h->root.u.def.section;
- 	    }
-+	  else
-+	    continue;
- 
- 	  if (h->type != STT_FUNC)
- 	    reserve_size =
--- 
-2.18.2
-

diff --git a/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch b/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch
deleted file mode 100644
index 2e83e74b8d..0000000000
--- a/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From 2c43d202aefb2b6f202a44bbb8a0baf251aae845 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Mon, 22 Aug 2022 10:26:17 -0700
-Subject: [PATCH] x86: Ignore protected visibility in shared libraries on
- Solaris
-
-On x86, the PLT entry in executable may be used as function address for
-functions in shared libraries.  If functions are protected, the function
-address used in executable can be different from the function address
-used in shared library.  This will lead to incorrect run-time behavior
-if function pointer equality is needed.  By default, x86 linker issues
-an error in this case.
-
-On Solaris, linker issued an error for
-
-struct tm *tb = (kind == CPP_time_kind::FIXED ? gmtime : localtime) (&tt);
-
-where gmtime is a protected function in libc.so.  Use gmtime's PLT entry
-in executable as function address is safe since function pointer equality
-isn't needed.  Ignore protected visibility in shared libraries on Solaris
-to disable linker error.  If function pointer equality is needed, linker
-will silently generate executable with incorrect run-time behavior on
-Solaris.
-
-	PR ld/29512
-	* elf32-i386.c (elf_i386_scan_relocs): Ignore protected
-	visibility in shared libraries on Solaris.
-	* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
----
- bfd/elf32-i386.c   | 3 ++-
- bfd/elf64-x86-64.c | 3 ++-
- 2 files changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
-index 52b1db44546..9717e2c5ed6 100644
---- a/bfd/elf32-i386.c
-+++ b/bfd/elf32-i386.c
-@@ -1808,7 +1808,8 @@ elf_i386_scan_relocs (bfd *abfd,
- 		      || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
- 		    h->plt.refcount = 1;
- 
--		  if (h->pointer_equality_needed
-+		  if (htab->elf.target_os != is_solaris
-+		      && h->pointer_equality_needed
- 		      && h->type == STT_FUNC
- 		      && eh->def_protected
- 		      && !SYMBOL_DEFINED_NON_SHARED_P (h)
-diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
-index 62a9a22317a..f3b54400013 100644
---- a/bfd/elf64-x86-64.c
-+++ b/bfd/elf64-x86-64.c
-@@ -2251,7 +2251,8 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info,
- 		      || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
- 		    h->plt.refcount = 1;
- 
--		  if (h->pointer_equality_needed
-+		  if (htab->elf.target_os != is_solaris
-+		      && h->pointer_equality_needed
- 		      && h->type == STT_FUNC
- 		      && eh->def_protected
- 		      && !SYMBOL_DEFINED_NON_SHARED_P (h)
--- 
-2.31.1
-

diff --git a/sys-devel/binutils/files/binutils-configure-LANG.patch b/sys-devel/binutils/files/binutils-configure-LANG.patch
new file mode 100644
index 0000000000..5521d196cf
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-configure-LANG.patch
@@ -0,0 +1,65 @@
+The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in 
+option parsing, it may break.
+
+http://bugs.gentoo.org/103483
+http://bugs.gentoo.org/122216
+
+--- configure
++++ configure
+@@ -54,6 +54,19 @@
+ infodir='${prefix}/info'
+ mandir='${prefix}/man'
+ 
++# NLS nuisances.
++for as_var in \
++  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++  LC_TELEPHONE LC_TIME
++do
++  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
++    eval $as_var=C; export $as_var
++  else
++    unset $as_var
++  fi
++done
++
+ # Initialize some other variables.
+ subdirs=
+ MFLAGS= MAKEFLAGS=
+@@ -452,16 +463,6 @@
+   esac
+ done
+ 
+-# NLS nuisances.
+-# Only set these to C if already set.  These must not be set unconditionally
+-# because not all systems understand e.g. LANG=C (notably SCO).
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+-# Non-C LC_CTYPE values break the ctype check.
+-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+-
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
+ rm -rf conftest* confdefs.h
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline.
+@@ -1850,6 +1850,19 @@
+ # Compiler output produced by configure, useful for debugging
+ # configure, is in ./config.log if it exists.
+ 
++# NLS nuisances.
++for as_var in \
++  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++  LC_TELEPHONE LC_TIME
++do
++  if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then
++    eval \$as_var=C; export \$as_var
++  else
++    unset \$as_var
++  fi
++done
++
+ ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+ for ac_option
+ do


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

* [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
@ 2025-03-07 14:40 Fabian Groffen
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Groffen @ 2025-03-07 14:40 UTC (permalink / raw
  To: gentoo-commits

commit:     acaae649785f0dca7922195aff762ce926124d3c
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  7 14:40:24 2025 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Mar  7 14:40:24 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=acaae649

sys-devel/binutils-2.44: version bump

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-devel/binutils/Manifest                        |   2 +
 sys-devel/binutils/binutils-2.44.ebuild            | 592 +++++++++++++++++++++
 .../files/binutils-2.41-linker-prefix.patch        |  56 ++
 3 files changed, 650 insertions(+)

diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
index b6c1313f33..e7358667e3 100644
--- a/sys-devel/binutils/Manifest
+++ b/sys-devel/binutils/Manifest
@@ -1,2 +1,4 @@
 DIST binutils-2.40-patches-7.tar.xz 299188 BLAKE2B 170cd2432e0458889b240c3603461d0b4bfa62d5314634b101a629db455d87235ac14ad44c63920b713d5235fa8b73902960df1019153873ef06a33aa7050b4b SHA512 a60da163caee68fe1fa355385d404e8998ebed0e390d50e0713e95334733a8b4e37bc63d522817284c027953e43848dbc98042461a47131fb53bc69203b4ee87
 DIST binutils-2.40.tar.xz 25241484 BLAKE2B 8d799f7c595f878b9af5b17a490021dd8b8300ac2fe0ed8574c012929d22d2d0493e003a3e631a9436e8e712da801779b777c566167fe42b0bde119ffa5ad1c2 SHA512 a37e042523bc46494d99d5637c3f3d8f9956d9477b748b3b1f6d7dfbb8d968ed52c932e88a4e946c6f77b8f48f1e1b360ca54c3d298f17193f3b4963472f6925
+DIST binutils-2.44-patches-1.tar.xz 9156 BLAKE2B c72a7d0ffdb852f8de9c18e187b5768085b3a070744a4fadef508ab0e865d3a3967ec12a0ee7a325b6b689f39e5243aacd9d3f73ceb723d53592ec6ca640161b SHA512 053de98536e92837d0a08fac26bb0f057431747fe6e82f8b9ac54dd9aed65d8de379d653c0e8a8cd31267b9769825a420db5f40957f8c4eb54a7e4a9d76fadb8
+DIST binutils-2.44.tar.xz 27285788 BLAKE2B 0eb031ace9fb5a7047b81b5a05b1760f7d332c8ed67f98899f153a45f181b83e661a484551af05c0a9b2adc422da84619103c7b1f3c9fad5327872832b5446aa SHA512 b85d3bbc0e334cf67a96219d3c7c65fbf3e832b2c98a7417bf131f3645a0307057ec81cd2b29ff2563cec53e3d42f73e2c60cc5708e80d4a730efdcc6ae14ad7

diff --git a/sys-devel/binutils/binutils-2.44.ebuild b/sys-devel/binutils/binutils-2.44.ebuild
new file mode 100644
index 0000000000..5fc13a3fa6
--- /dev/null
+++ b/sys-devel/binutils/binutils-2.44.ebuild
@@ -0,0 +1,592 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs
+
+DESCRIPTION="Tools necessary to build programs"
+HOMEPAGE="https://sourceware.org/binutils/"
+
+LICENSE="GPL-3+"
+IUSE="cet debuginfod doc gprofng hardened multitarget +nls pgo +plugins static-libs test vanilla xxhash zstd"
+
+# Variables that can be set here  (ignored for live ebuilds)
+# PATCH_VER          - the patchset version
+#                      Default: empty, no patching
+# PATCH_BINUTILS_VER - the binutils version in the patchset name
+#                    - Default: PV
+# PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
+#                      for the patchsets
+
+PATCH_VER=1
+PATCH_DEV=dilfridge
+
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	SLOT=${PV}
+elif [[ ${PV} == *9999 ]]; then
+	inherit git-r3
+	SLOT=$(ver_cut 1-2)
+else
+	PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
+	PATCH_DEV=${PATCH_DEV:-dilfridge}
+	SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://sourceware.org/pub/binutils/releases/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz"
+	[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
+		https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
+	SLOT=$(ver_cut 1-2)
+	KEYWORDS="~amd64-linux ~x86-linux ~x64-solaris"
+fi
+
+#
+# The cross-compile logic
+#
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+#
+# The dependencies
+#
+RDEPEND="
+	>=sys-devel/binutils-config-3
+	sys-libs/zlib
+	debuginfod? (
+		dev-libs/elfutils[debuginfod(-)]
+	)
+	zstd? ( app-arch/zstd:= )
+"
+DEPEND="
+	${RDEPEND}
+	xxhash? ( dev-libs/xxhash )
+"
+BDEPEND="
+	doc? ( sys-apps/texinfo )
+	pgo? (
+		dev-util/dejagnu
+		app-alternatives/bc
+	)
+	test? (
+		dev-util/dejagnu
+		app-alternatives/bc
+	)
+	nls? ( sys-devel/gettext )
+	zstd? ( virtual/pkgconfig )
+	app-alternatives/lex
+	app-alternatives/yacc
+"
+
+RESTRICT="!test? ( test )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
+)
+
+MY_BUILDDIR=${WORKDIR}/build
+
+src_unpack() {
+	if [[ ${PV} == *9999 ]] ; then
+		EGIT_REPO_URI="
+			https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git
+			https://github.com/gentoo/binutils-patches
+		"
+		EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
+		git-r3_src_unpack
+		mv patches-git/9999 patch || die
+
+		if [[ ${PV} != 9999 ]] ; then
+			EGIT_BRANCH=binutils-$(ver_cut 1)_$(ver_cut 2)-branch
+		fi
+		EGIT_REPO_URI="
+			https://sourceware.org/git/binutils-gdb.git
+			https://git.sr.ht/~sourceware/binutils-gdb
+			https://gitlab.com/x86-binutils/binutils-gdb.git
+		"
+		S=${WORKDIR}/binutils
+		EGIT_CHECKOUT_DIR=${S}
+		git-r3_src_unpack
+	else
+		unpack ${P/-hppa64/}.tar.xz
+
+		cd "${WORKDIR}" || die
+		unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz
+
+		# _p patch versions are Gentoo specific tarballs ...
+		local dir=${P%_p?}
+		dir=${dir/-hppa64/}
+
+		S=${WORKDIR}/${dir}
+	fi
+
+	cd "${WORKDIR}" || die
+	mkdir -p "${MY_BUILDDIR}" || die
+}
+
+src_prepare() {
+	local patchsetname
+	if [[ ${PV} == 9999 ]] ; then
+		patchsetname="from git master"
+	elif [[ ${PV} == *9999 ]] ; then
+		patchsetname="from git branch ${EGIT_BRANCH}"
+	else
+		patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}"
+	fi
+
+	if [[ -n ${PATCH_VER} ]] || [[ ${PV} == *9999 ]] ; then
+		if ! use vanilla; then
+			einfo "Applying binutils patchset ${patchsetname}"
+			eapply "${WORKDIR}/patch"
+			einfo "Done."
+
+			# This is applied conditionally for now just out of caution.
+			# It should be okay on non-prefix systems though. See bug #892549.
+			if is_cross || use prefix; then
+				eapply "${FILESDIR}"/binutils-2.40-linker-search-path.patch \
+					   "${FILESDIR}"/binutils-2.41-linker-prefix.patch
+			fi
+		fi
+	fi
+
+	# Make sure our explicit libdir paths don't get clobbered, bug #562460
+	sed -i \
+		-e 's:@bfdlibdir@:@libdir@:g' \
+		-e 's:@bfdincludedir@:@includedir@:g' \
+		{bfd,opcodes}/Makefile.in || die
+
+	# Apply things from PATCHES and user dirs
+	default
+
+	# Run misc portage update scripts
+	gnuconfig_update
+	elibtoolize --portage --no-uclibc
+}
+
+toolchain-binutils_bugurl() {
+	printf "https://bugs.gentoo.org/"
+}
+toolchain-binutils_pkgversion() {
+	printf "Gentoo ${PV}"
+	[[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
+}
+
+src_configure() {
+	# See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
+	# Avoid really confusing logs from subconfigure spam, makes logs far
+	# more legible.
+	MAKEOPTS="--output-sync=line ${MAKEOPTS}"
+
+	# Setup some paths
+	LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+	INCPATH=${LIBPATH}/include
+	DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+	if is_cross ; then
+		TOOLPATH=/usr/${CHOST}/${CTARGET}
+	else
+		TOOLPATH=/usr/${CTARGET}
+	fi
+	BINPATH=${TOOLPATH}/binutils-bin/${PV}
+
+	# Make sure we filter $LINGUAS so that only ones that
+	# actually work make it through, bug #42033
+	strip-linguas -u */po
+
+	# Keep things sane
+	strip-flags
+	use cet && filter-flags -mindirect-branch -mindirect-branch=*
+	use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152
+
+	local x
+	echo
+	for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
+		einfo "$(printf '%10s' ${x}:) ${!x}"
+	done
+	echo
+
+	cd "${MY_BUILDDIR}" || die
+	local myconf=()
+
+	if use plugins ; then
+		myconf+=( --enable-plugins )
+	fi
+
+	if use nls ; then
+		myconf+=( --without-included-gettext )
+	else
+		myconf+=( --disable-nls )
+	fi
+
+	myconf+=( --with-system-zlib )
+
+	# For bi-arch systems, enable a 64bit bfd. This matches the bi-arch
+	# logic in toolchain.eclass. bug #446946
+	#
+	# We used to do it for everyone, but it's slow on 32bit arches. bug #438522
+	case $(tc-arch) in
+		ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
+	esac
+
+	use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
+
+	[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
+
+	is_cross && myconf+=(
+		--with-sysroot="${EPREFIX}"/usr/${CTARGET}
+		--enable-poison-system-directories
+	)
+
+	myconf+=( --enable-secureplt )
+
+	# mips can't do hash-style=gnu ...
+	# let's not do this on Solaris either
+	if [[ $(tc-arch) != mips && ${CHOST} != *-solaris* ]] ; then
+		myconf+=( --enable-default-hash-style=gnu )
+	fi
+
+	myconf+=(
+		--prefix="${EPREFIX}"/usr
+		--host=${CHOST}
+		--target=${CTARGET}
+		--datadir="${EPREFIX}"${DATAPATH}
+		--datarootdir="${EPREFIX}"${DATAPATH}
+		--infodir="${EPREFIX}"${DATAPATH}/info
+		--mandir="${EPREFIX}"${DATAPATH}/man
+		--bindir="${EPREFIX}"${BINPATH}
+		--libdir="${EPREFIX}"${LIBPATH}
+		--libexecdir="${EPREFIX}"${LIBPATH}
+		--includedir="${EPREFIX}"${INCPATH}
+		# portage's econf() does not detect presence of --d-d-t
+		# because it greps only top-level ./configure. But not
+		# libiberty's or bfd's configure.
+		--disable-dependency-tracking
+		--disable-silent-rules
+		--enable-obsolete
+		--enable-shared
+		--enable-threads
+		--enable-relro
+		--enable-install-libiberty
+		--enable-textrel-check=$(usex hardened error warning)
+		# Things to think about
+		#--enable-deterministic-archives
+		--enable-new-dtags
+		--disable-jansson
+		--disable-werror
+		--with-bugurl="$(toolchain-binutils_bugurl)"
+		--with-pkgversion="$(toolchain-binutils_pkgversion)"
+		$(use_enable static-libs static)
+		$(use_with xxhash)
+		$(use_with zstd)
+
+		# Disable modules that are in a combined binutils/gdb tree, bug #490566
+		--disable-{gdb,gdbserver,libbacktrace,libdecnumber,readline,sim}
+		# Strip out broken static link flags: https://gcc.gnu.org/PR56750
+		--without-stage1-ldflags
+		# Change SONAME to avoid conflict across {native,cross}/binutils, binutils-libs. bug #666100
+		--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
+
+		$(use_with debuginfod)
+
+		# Avoid automagic dev-libs/msgpack dep, bug #865875
+		--without-msgpack
+
+		# Allow user to opt into CET for host libraries.
+		# Ideally we would like automagic-or-disabled here.
+		# But the check does not quite work on i686: bug #760926.
+		$(use_enable cet)
+
+		# We can enable this by default in future, but it's brand new
+		# in 2.39 with several bugs:
+		# - Doesn't build on musl (https://sourceware.org/bugzilla/show_bug.cgi?id=29477)
+		# - No man pages (https://sourceware.org/bugzilla/show_bug.cgi?id=29521)
+		# - Broken at runtime without Java (https://sourceware.org/bugzilla/show_bug.cgi?id=29479)
+		# - binutils-config (and this ebuild?) needs adaptation first (https://bugs.gentoo.org/865113)
+		$(use_enable gprofng)
+
+		# Enables colored disassembly by default (equivalent to passing
+		# --disassembler-color=terminal to all objdump invocations).
+		--enable-colored-disassembly
+	)
+
+	case ${CTARGET} in
+		x86_64-*|aarch64*|arm64*|i[3456]*)
+			# These hardening options are available from 2.39+ but
+			# they unconditionally enable the behaviour even on arches
+			# where e.g. execstacks can't be avoided.
+			# See https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
+			#
+			# TODO: Get the logic for this fixed upstream so it doesn't
+			# create impossible broken combinations on some arches, like mips.
+			#
+			# TODO: Get the logic for this fixed upstream so --disable-* works
+			# as expected.
+			myconf+=(
+				--enable-warn-execstack=yes
+				--enable-warn-rwx-segments=yes
+			)
+
+			if use hardened ; then
+				myconf+=(
+					# TODO: breaks glibc test suite
+					#--enable-error-execstack=yes
+					#--enable-error-rwx-segments=yes
+					--enable-default-execstack=no
+				)
+			fi
+			;;
+		*)
+			;;
+	esac
+
+	if use elibc_musl ; then
+		# Override our earlier setting for musl, as textrels don't
+		# work there at all. See bug #707660.
+		myconf+=(
+			--enable-textrel-check=error
+		)
+	fi
+
+	if [[ ${CHOST} == *-solaris* ]]; then
+		# override earlier settings for Solaris, textrels and
+		# relocations in general cause relocation errors all over the
+		# place
+		myconf+=(
+			--enable-textrel-check=error
+		)
+	fi
+
+	if use test || { use pgo && tc-is-lto ; } ; then
+		# -Wa,* needs to be consistent everywhere or lto-wrapper will complain
+		filter-flags '-Wa,*'
+	fi
+
+	if ! is_cross ; then
+		myconf+=( $(use_enable pgo pgo-build $(tc-is-lto && echo "lto" || echo "yes")) )
+
+		if use pgo ; then
+			# We let configure handle it for us because it has to run
+			# the testsuite later on for profiling, and LTO isn't compatible
+			# with the testsuite.
+			filter-lto
+
+			export BUILD_CFLAGS="${CFLAGS}"
+		fi
+	fi
+
+	ECONF_SOURCE="${S}" econf "${myconf[@]}"
+
+	# Prevent makeinfo from running if doc is unset.
+	if ! use doc ; then
+		sed -i \
+			-e '/^MAKEINFO/s:=.*:= true:' \
+			Makefile || die
+	fi
+}
+
+src_compile() {
+	cd "${MY_BUILDDIR}" || die
+
+	# see Note [tooldir hack for ldscripts]
+	# see linker prefix patch
+	emake \
+		tooldir="${EPREFIX}${TOOLPATH}" \
+		gentoo_prefix=$(usex prefix-guest "${EPREFIX}"/usr /usr) \
+		all
+
+	# only build info pages if the user wants them
+	if use doc ; then
+		emake info
+	fi
+
+	# we nuke the manpages when we're left with junk
+	# (like when we bootstrap, no perl -> no manpages)
+	find . -name '*.1' -a -size 0 -delete
+}
+
+src_test() {
+	cd "${MY_BUILDDIR}" || die
+
+	(
+		# Tests don't expect LTO
+		filter-lto
+
+		# If we have e.g. -mfpmath=sse -march=pentium4 in CFLAGS,
+		# we'll get lto1 warnings for some tests which cause
+		# spurious failures because -mfpmath isn't passed at
+		# link-time. Filter accordingly.
+		#
+		# Alternatively, we could pass C{C,XX}_FOR_TARGET with
+		# some (ideally not all, surely would break some tests)
+		# stuffed in.
+		filter-flags '-mfpmath=*'
+
+		# lto-wrapper warnings which confuse tests
+		filter-flags '-Wa,*'
+
+		# bug #637066
+		filter-flags -Wall -Wreturn-type
+
+		emake -k check \
+			CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}" \
+			CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}" \
+			LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" \
+			CFLAGS="${CFLAGS}" \
+			CXXFLAGS="${CXXFLAGS}" \
+			LDFLAGS="${LDFLAGS}"
+	)
+}
+
+src_install() {
+	local x d
+
+	cd "${MY_BUILDDIR}" || die
+
+	# see Note [tooldir hack for ldscripts]
+	emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
+	rm -rf "${ED}"/${LIBPATH}/bin || die
+	use static-libs || find "${ED}" -name '*.la' -delete
+
+	# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
+	cd "${ED}"/${LIBPATH} || die
+	for d in ../* ; do
+		[[ ${d} == ../${PV} ]] && continue
+		mv ${d}/* . || die
+		rmdir ${d} || die
+	done
+
+	# Now we collect everything intp the proper SLOT-ed dirs
+	# When something is built to cross-compile, it installs into
+	# /usr/$CHOST/ by default ... we have to 'fix' that :)
+	if is_cross ; then
+		cd "${ED}"/${BINPATH} || die
+		for x in * ; do
+			mv ${x} ${x/${CTARGET}-} || die
+		done
+
+		if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
+			mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
+			mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
+			rm -r "${ED}"/usr/${CHOST}/{include,lib}
+		fi
+	fi
+
+	insinto ${INCPATH}
+	local libiberty_headers=(
+		# Not all the libiberty headers.  See libiberty/Makefile.in:install_to_libdir.
+		demangle.h
+		dyn-string.h
+		fibheap.h
+		hashtab.h
+		libiberty.h
+		objalloc.h
+		splay-tree.h
+	)
+	doins "${libiberty_headers[@]/#/${S}/include/}"
+	if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
+		mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die
+		rm -r "${ED}"/${LIBPATH}/lib || die
+	fi
+
+	# Generate an env.d entry for this binutils
+	insinto /etc/env.d/binutils
+	cat <<-EOF > "${T}"/env.d
+		TARGET="${CTARGET}"
+		VER="${PV}"
+		LIBPATH="${EPREFIX}${LIBPATH}"
+	EOF
+	newins "${T}"/env.d ${CTARGET}-${PV}
+
+	# Handle documentation
+	if ! is_cross ; then
+		cd "${S}" || die
+		dodoc README
+
+		docinto bfd
+		dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
+
+		docinto binutils
+		dodoc binutils/ChangeLog binutils/NEWS binutils/README
+
+		docinto gas
+		dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
+
+		docinto gprof
+		dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
+
+		docinto ld
+		dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
+
+		docinto libiberty
+		dodoc libiberty/ChangeLog* libiberty/README
+
+		docinto opcodes
+		dodoc opcodes/ChangeLog*
+	fi
+
+	# Remove shared info pages
+	rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
+
+	docompress "${DATAPATH}"/{info,man}
+
+	# Trim all empty dirs
+	find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
+}
+
+pkg_postinst() {
+	# Make sure this ${CTARGET} has a binutils version selected
+	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
+	binutils-config ${CTARGET}-${PV} || eerror binutils-config returned an error
+}
+
+pkg_postrm() {
+	local current_profile=$(binutils-config -c ${CTARGET})
+
+	# If no other versions exist, then uninstall for this
+	# target ... otherwise, switch to the newest version
+	# Note: only do this if this version is unmerged.  We
+	#       rerun binutils-config if this is a remerge, as
+	#       we want the mtimes on the symlinks updated (if
+	#       it is the same as the current selected profile)
+	if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
+		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
+		choice=${choice//$'\n'/ }
+		choice=${choice/* }
+		if [[ -z ${choice} ]] ; then
+			binutils-config -u ${CTARGET} || eerror binutils-config returned an error
+		else
+			binutils-config ${choice} || eerror binutils-config returned an error
+		fi
+	elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
+		binutils-config ${CTARGET}-${PV} || eerror binutils-config returned an error
+	fi
+}
+
+# Note [slotting support]
+# -----------------------
+# Gentoo's layout for binutils files is non-standard as Gentoo
+# supports slotted installation for binutils. Many tools
+# still expect binutils to reside in known locations.
+# binutils-config package restores symlinks into known locations,
+# like:
+#    /usr/bin/${CTARGET}-<tool>
+#    /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
+#    /usr/include/
+#
+# Note [tooldir hack for ldscripts]
+# ---------------------------------
+# Build system does not allow ./configure to tweak every location
+# we need for slotting binutils hence all the shuffling in
+# src_install(). This note is about SCRIPTDIR define handling.
+#
+# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
+# Thus we can't just move files around after compilation finished.
+#
+# Our goal is the following:
+# - at build-time set scriptdir to point to symlinked location:
+#   ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
+# - at install-time set scriptdir to point to slotted location:
+#   ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}

diff --git a/sys-devel/binutils/files/binutils-2.41-linker-prefix.patch b/sys-devel/binutils/files/binutils-2.41-linker-prefix.patch
new file mode 100644
index 0000000000..d97a155992
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.41-linker-prefix.patch
@@ -0,0 +1,56 @@
+https://bugs.gentoo.org/892549
+https://github.com/gentoo/binutils-gdb/pull/5
+
+From 531bc1536dfc3070c1f7d03e98fa14bcb81fdcd0 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 23 Dec 2023 13:48:10 +0000
+Subject: [PATCH 2/2] ld: Allow a Gentoo-specific prefix to override the prefix
+ used by ld.bfd
+
+This prefix is only used to locate $prefix/etc/ld.so.conf, with $prefix
+usually being /usr. This file is important on Gentoo Prefix systems,
+where the /usr prefix is within another directory. The problem is that
+Gentoo already passes the same directory as the sysroot, and ld.bfd
+therefore looks for /myprefix/myprefix/usr/etc/ld.so.conf.
+
+The sysroot is dynamic, while the prefix is hardcoded. A hardcoded
+prefix that isn't just /usr is unhelpful, not just because of the
+doubled prefix issue above, but also because it prevents ld.bfd from
+working effectively outside its native environment. We will therefore
+hardcode it to just /usr.
+
+This change does not simply do that though and sets up a $gentoo_prefix
+variable instead, with $prefix as a fallback. This is necessary because
+Gentoo prefix-guest systems, which use the host's libc, do not apply a
+sysroot like RAP prefix systems do. In that case, we must preserve the
+existing behaviour. The binutils ebuild will be responsible for setting
+this variable appropriately.
+---
+ ld/emultempl/elf.em | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
+index 3f67f8b09d9..78c8e909b6c 100644
+--- a/ld/emultempl/elf.em
++++ b/ld/emultempl/elf.em
+@@ -138,7 +138,7 @@ gld${EMULATION_NAME}_before_plugin_all_symbols_read (void)
+   ldelf_before_plugin_all_symbols_read ($IS_LIBPATH, $IS_NATIVE,
+ 				        $IS_LINUX_TARGET,
+ 					$IS_FREEBSD_TARGET,
+-					$ELFSIZE, "$prefix");
++					$ELFSIZE, "${gentoo_prefix-${prefix}}");
+ }
+ 
+ /* This is called after all the input files have been opened.  */
+@@ -147,7 +147,7 @@ static void
+ gld${EMULATION_NAME}_after_open (void)
+ {
+   ldelf_after_open ($IS_LIBPATH, $IS_NATIVE,
+-		    $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "$prefix");
++		    $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "${gentoo_prefix-${prefix}}");
+ }
+ 
+ EOF
+-- 
+2.43.0
+


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

end of thread, other threads:[~2025-03-07 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 14:40 [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/ Fabian Groffen
  -- strict thread matches above, loose matches on Subject: below --
2023-08-30  8:56 Fabian Groffen
2023-03-01  0:52 Sam James
2022-10-25  6:50 Fabian Groffen
2017-11-25 15:16 Fabian Groffen
2017-11-25 15:04 Fabian Groffen

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