├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── build └── patches ├── gcc-4.9.4_add-vrnd_f64-aarch64-intrinsics.patch ├── gcc-4.9.4_asan-fix-missing-include-signal-h.patch ├── gcc-4.9.4_compilation-error-with-new-isl-0.20-missing-includes.patch ├── gcc-4.9.4_do-not-use-the-ptr-macro.patch ├── gcc-4.9.4_isl-0.21-compat.patch ├── gcc-4.9.4_libsanitizer-use-pre-computed-size-of-struct-ustat-for-linux.patch ├── gcc-4.9.4_use-stack_t-instead-of-struct-sigaltstack.patch ├── gcc-5-12_do-not-use-the-ptr-macro.patch ├── gcc-5.5.0_compilation-error-with-new-isl-0.20-missing-includes.patch ├── gcc-5.5.0_isl-0.21-compat.patch ├── gcc-5.5.0_libsanitizer-use-pre-computed-size-of-struct-ustat-for-linux.patch ├── gcc-6.5.0_fix-layout-change-for-nested-std-pair.patch ├── gcc-6.5.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer.patch ├── gcc-7.5.0_ice-with-return-type-deduction-and-specialization.patch ├── gcc-7.5.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer.patch ├── gcc-8.3.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer.patch ├── gcc-9.2.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer.patch ├── glibc-2.36_gcc-6-aarch64-compat.patch ├── glibc-2.36_linux-compat.patch └── glibc-2.36_revert-linux-implement-a-useful-version-of-_startup_fatal.patch /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://paypal.me/krasCGQ', 'https://saweria.co/kudproject'] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | */ 2 | !patches/ 3 | patches/* 4 | !patches/*.patch 5 | !.github/ 6 | .github/* 7 | !.github/FUNDING.yml 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GCC toolchain build script 2 | 3 | This is a script to build GCC toolchains targeting arm, arm64, and x86 devices 4 | (primarily Android devices). 5 | 6 | 7 | ## Using the script 8 | 9 | To build a GCC toolchain, you will need the following: 10 | 11 | + A Linux distribution (the script has been tested on Debian 10 and Arch Linux) 12 | + A decent processor and amount of RAM (i5 and 8 GB of RAM or more is preferred) 13 | + Core developer packages 14 | + For Arch: ```sudo pacman -S base-devel git``` 15 | + For Debian: ```sudo apt-get install flex bison libncurses-dev texinfo gcc gperf patch libtool g++ libncurses5-dev gawk expat libexpat1-dev python3-all-dev binutils-dev lib32gcc1 bc libisl-dev libcap-dev libgmp-dev build-essential gcc-multilib g++-multilib pkg-config libmpc-dev libmpfr-dev autopoint gettext liblzma-dev libssl-dev zlib1g-dev zstd libzstd-dev``` 16 | + Some systems might require installing ```curl```, ```wget``` and ```rsync``` 17 | manually, especially on a clean chroot. 18 | 19 | Once you have set up your environment, run the following: 20 | 21 | ```bash 22 | git clone https://github.com/krasCGQ/build-tools-gcc 23 | cd build-tools-gcc 24 | ./build -h 25 | ``` 26 | 27 | The printout will show you how to run the script. 28 | 29 | Example commands: 30 | 31 | ```bash 32 | # Build a GNU 12.x toolchain for x86_64 33 | ./build -a x86_64 -s gnu -v 12 34 | 35 | # Build an Arm 11.x toolchain for arm64, while providing full output 36 | ./build -a arm64 -s linaro -v 11 -V 37 | 38 | # Build a Linaro 7.x toolchain for arm, while providing full output 39 | ./build -a arm -s linaro -v 7 -V 40 | ``` 41 | 42 | 43 | ## After compilation 44 | 45 | Once it is done building, you will have a folder with the compiled toolchain 46 | which you can then move to directory of your choice. 47 | 48 | Point your cross compiler to the proper file and compile! This is an easy 49 | shortcut for kernels (when run in the directory you moved the toolchain in): 50 | 51 | ```bash 52 | # The following sample is for arm64 53 | PATH=$(pwd)/bin:$PATH 54 | CROSS_COMPILE=aarch64-linux-gnu- 55 | export PATH CROSS_COMPILE 56 | ``` 57 | 58 | 59 | ## Pull requests/issues 60 | 61 | If you have any issues with this script, feel free to open an issue! 62 | 63 | Pull requests are more than welcome as well. However, there is a particular coding style that should be followed: 64 | 65 | + All variables are uppercased and use curly braces: ```${VARIABLE}``` instead of ```$variable``` 66 | + Four spaces for indents 67 | + Double brackets and single equal sign for string comparisons in if blocks: ```if [[ ${VARIABLE} = "yes" ]]; then``` 68 | 69 | Additionally, please be sure to run your change through shellcheck.net (either copy and paste the script there or download the binary and run `shellcheck build`). 70 | 71 | 72 | ## Credits/thanks 73 | 74 | + [USBHost](https://github.com/USBhost): For the initial script 75 | + [nathanchance](https://github.com/nathanchance): For great modifications! 76 | + [frap129](https://github.com/frap129): For some modifications to update the script/components 77 | + [msfjarvis](https://github.com/msfjarvis): For testing the arm option 78 | -------------------------------------------------------------------------------- /build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # shellcheck disable=SC1117 3 | # 4 | # SPDX-License-Identifier: GPL-3.0-or-later 5 | # 6 | # Copyright (C) 2016-2020 USBhost 7 | # Copyright (C) 2016-2017 Joe Maples 8 | # Copyright (C) 2017-2018 Nathan Chancellor 9 | # Copyright (C) 2017-2022 Albert I (krasCGQ) 10 | # 11 | # GCC cross compiler compilation script 12 | 13 | ########### 14 | # SOURCES # 15 | ########### 16 | 17 | # https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/ # credits for almost everything 18 | # https://wiki.archlinux.org/title/Cross-compiling_tools_package_guidelines 19 | # https://mpfr.loria.fr/ 20 | # https://gmplib.org/ 21 | # https://www.multiprecision.org/mpc/ 22 | # https://libisl.sourceforge.io/ 23 | # http://www.bastoul.net/cloog/ # original cloog 24 | # https://github.com/periscop/cloog # official continuation/fork of cloog 25 | # https://www.gnu.org/software/binutils/ 26 | # https://www.gnu.org/software/libc/ 27 | # https://www.kernel.org/ 28 | # https://facebook.github.io/zstd/ 29 | # https://gcc.gnu.org/ # gnu 30 | # https://releases.linaro.org/ # linaro <= 7 31 | # https://developer.arm.com/ # linaro/arm >= 8 32 | 33 | ############# 34 | # FUNCTIONS # 35 | ############# 36 | 37 | # Easy alias for escape codes 38 | function echo() { 39 | command echo -e "${@}" 40 | } 41 | 42 | # Easy alias without priting stacked directories 43 | function pushd() { 44 | # shellcheck disable=SC2164 45 | command pushd "${@}" >/dev/null 46 | } 47 | 48 | # Easy alias without printing stacked directories 49 | function popd() { 50 | # shellcheck disable=SC2164 51 | command popd >/dev/null 52 | } 53 | 54 | # Help menu function 55 | function _help_menu() { 56 | echo 57 | echo "${BOLD}OVERVIEW:${RST} Build a gcc toolchain" 58 | echo 59 | echo "${BOLD}USAGE:${RST} ${0} " 60 | echo 61 | echo "${BOLD}EXAMPLE:${RST} ${0} -a arm64 -s linaro -v 8" 62 | echo 63 | echo "${BOLD}EXAMPLE:${RST} ${0} -a x86_64 -s gnu -v 8" 64 | echo 65 | echo "${BOLD}REQUIRED PARAMETERS:${RST}" 66 | echo " -a | --arch: Possible values: arm, arm64, i686, or x86_64." 67 | echo " This is the toolchain's target architecture." 68 | echo " -s | --source: Possible values: gnu or linaro." 69 | echo " This is the GCC source (GNU official vs. Linaro/Arm fork)." 70 | echo " -v | --version: Possible values: integer from 4 to 12, with 12 is GNU-only for now." 71 | echo " This is the GCC version to build." 72 | echo 73 | echo "${BOLD}OPTIONAL PARAMETERS:${RST}" 74 | echo " -j | --jobs: Specify the amount of threads to use. This overrides the default detection." 75 | echo " -nt | --no-tmpfs: Do not use tmpfs for building (useful if you don't have much RAM)." 76 | echo " -V | --verbose: Make script print all output, not just errors and the ending information." 77 | echo 78 | } 79 | 80 | # Prints a formatted header to let the user know what's being done 81 | function _header() { 82 | [[ ${*} =~ "--no-first-echo" ]] || echo 83 | # shellcheck disable=SC2034 84 | echo "${RED}====$(for i in $(seq ${#1}); do echo "=\c"; done)====" 85 | echo "== ${1} ==" 86 | # shellcheck disable=SC2034 87 | echo "====$(for i in $(seq ${#1}); do echo "=\c"; done)====${RST}" 88 | [[ ${*} =~ "--no-second-echo" ]] || echo 89 | } 90 | 91 | # Prints an error in bold red 92 | function die() { 93 | [[ -z ${VERBOSE} ]] && exec 1>&5 2>&6 94 | echo "" 95 | echo "${RED}${1}${RST}" 96 | [[ ${*} =~ "-n" ]] && echo 97 | [[ ${*} =~ "-h" ]] && _help_menu 98 | exit 99 | } 100 | 101 | # Prints a warning in bold yellow 102 | function warn() { 103 | echo "" 104 | echo "${YLW}${1}${RST}" 105 | [[ ${*} =~ "-n" ]] && echo 106 | } 107 | 108 | # Check if user needs to enter sudo password or not 109 | function _check_sudo() { 110 | echo 111 | echo "Checking if sudo is available, please enter your password if a prompt appears!" 112 | if ! sudo true 2>/dev/null; then 113 | warn "Sudo is not available! Disabling the option for tmpfs..." -n 114 | NO_TMPFS=true 115 | fi 116 | } 117 | 118 | # Unmount tmpfs 119 | function unmount_tmpfs() { 120 | if [[ -z ${NO_TMPFS} ]]; then 121 | sudo umount -l build-glibc 2>/dev/null 122 | sudo umount -l build-gcc 2>/dev/null 123 | sudo umount -l build-binutils 2>/dev/null 124 | fi 125 | } 126 | 127 | # Initial setup 128 | function setup_variables() { 129 | # Colors 130 | BOLD="\033[1m" 131 | RED="\033[01;31m" 132 | RST="\033[0m" 133 | YLW="\033[01;33m" 134 | 135 | # Configuration variables 136 | REVISION=$(printf '%s r%s-g%s%s' "(build-tools-gcc" "$(git rev-list --count HEAD)" "$(git rev-parse --short=8 HEAD)" ")") 137 | CONFIGURATION=( 138 | "--disable-werror" 139 | "--with-bugurl=https://github.com/krasCGQ/build-tools-gcc/issues" 140 | ) 141 | JOBS="-j$(($(nproc --all) + 1))" 142 | 143 | # Binary versions 144 | BINUTILS="2.40" 145 | GMP="gmp-6.2.1" 146 | MPFR="mpfr-4.2.0" 147 | MPC="mpc-1.3.1" 148 | ISL="isl-0.24" # isl-0.25 C++17 tests need GCC 10.1+ on host to pass 149 | CLOOG="cloog-0.18.5" # required for graphite support on GCC 4.9 150 | ZSTD="zstd-1.5.5" # required for Zstd LTO bytecode support on GCC 10+ 151 | GLIBC_VERSION=2.37 152 | LINUX="6.3.2" 153 | } 154 | 155 | # Internal: Packaging logic for GNU Arm toolchains (formerly Linaro) 156 | # This is getting too repetitive that it now deserves internal function of its own 157 | function _get_arm_packaging() { 158 | if [[ ${VERSION} -ge 11 ]]; then 159 | GCC_base=arm-gnu-toolchain 160 | GCC_string="Arm GNU Toolchain" 161 | # ${GCC_type} being unset is intentional, see later notes 162 | elif [[ ${VERSION} -ge 8 ]]; then 163 | GCC_base=gcc-arm 164 | GCC_string="GNU Toolchain for the A-profile Architecture" 165 | GCC_type=-a 166 | fi 167 | } 168 | 169 | # Parse parameters 170 | function parse_parameters() { 171 | while [[ ${#} -ge 1 ]]; do 172 | case "${1}" in 173 | # REQUIRED FLAGS 174 | "-a" | "--arch") shift && ARCH=${1} ;; 175 | "-s" | "--source") shift && SOURCE=${1} ;; 176 | "-v" | "--version") shift && VERSION=${1} ;; 177 | 178 | # OPTIONAL FLAGS 179 | "-j" | "--jobs") shift && JOBS=-j${1} ;; 180 | "-nt" | "--no-tmpfs") NO_TMPFS=true ;; 181 | "-V" | "--verbose") VERBOSE=true ;; 182 | 183 | # HELP! 184 | "-h" | "--help") 185 | _help_menu 186 | exit 187 | ;; 188 | esac 189 | 190 | shift 191 | done 192 | 193 | [[ -z ${NO_TMPFS} ]] && _check_sudo 194 | [[ -z ${VERBOSE} ]] && exec 6>&2 5>&1 &>/dev/null 195 | 196 | # Default values 197 | case "${ARCH}" in 198 | "arm") TARGET="arm-linux-gnueabi" ;; 199 | "arm64") TARGET="aarch64-linux-gnu" ;; 200 | "i686") TARGET="i686-linux-gnu" ;; 201 | "x86_64") TARGET="x86_64-linux-gnu" ;; 202 | *) die "Absent or invalid arch specified!" -h ;; 203 | esac 204 | 205 | # Warn for unsupported build target being launched 206 | if [[ ! ${ARCH} =~ arm && ${SOURCE} == "linaro" ]]; then 207 | [[ -z ${VERBOSE} ]] && exec 1>&5 2>&6 208 | warn "Building Linaro/Arm GCC for non-ARM targets is strongly discouraged and not officially supported!" 209 | [[ -z ${VERBOSE} ]] && exec 6>&2 5>&1 &>/dev/null 210 | fi 211 | 212 | # Enable Cortex-A53 toolchain erratum fixes for AArch64 213 | [[ ${ARCH} == "arm64" ]] && AARCH64_CONFIGURATION="--enable-fix-cortex-a53-835769" 214 | # Kernel architecture; i686 and x86_64 targets use x86 215 | [[ ${ARCH} == "i686" || ${ARCH} == "x86_64" ]] && KERNEL_ARCH=x86 || KERNEL_ARCH=${ARCH} 216 | 217 | # Set GCC branch based on version and Linaro or not 218 | case "${SOURCE}:${VERSION}" in 219 | "gnu:4") 220 | GCC=gcc-4.9.4 221 | GLIBC_VERSION=2.28 # last supported version 222 | ISL="isl-0.18" # must match CLooG bundled version 223 | EXT=gz 224 | ;; 225 | "gnu:5") 226 | GCC=gcc-5.5.0 227 | GLIBC_VERSION=2.29 # last supported version 228 | ISL="isl-0.18" # isl-0.19+ requires backporting 5affe17f859a 229 | ;; 230 | "gnu:6") GCC=gcc-6.5.0 ;; 231 | "gnu:7") GCC=gcc-7.5.0 ;; 232 | "gnu:8") GCC=gcc-8.5.0 ;; 233 | "gnu:9") GCC=gcc-9.5.0 ;; 234 | "gnu:10") GCC=gcc-10.4.0 ;; 235 | "gnu:11") GCC=gcc-11.3.0 ;; 236 | "gnu:12") GCC=gcc-12.3.0 ;; 237 | "gnu:13") GCC=gcc-13.1.0 ;; 238 | "gnu:14") die "GCC 14.0 is currently a WIP so there is no tarball to download!" ;; 239 | "linaro:4") 240 | GCC_ver=4.9-2017.01 241 | GLIBC_VERSION=2.28 # last supported version 242 | ISL="isl-0.18" # must match CLooG bundled version 243 | ;; 244 | "linaro:5") 245 | GCC_ver=5.5-2017.10 246 | GLIBC_VERSION=2.29 # last supported version 247 | ISL="isl-0.18" # isl-0.19+ requires backporting 5affe17f859a 248 | ;; 249 | "linaro:6") GCC_ver=6.5-2018.12 ;; 250 | "linaro:7") GCC_ver=7.5-2019.12 ;; 251 | # ARM has taken the responsibility from Linaro since 8.x 252 | # See later in this script why we are defining them the hard way 253 | "linaro:8") 254 | _get_arm_packaging 255 | GCC_ver=8.3-2019.03 256 | ;; 257 | "linaro:9") 258 | _get_arm_packaging 259 | GCC_ver=9.2-2019.12 260 | ;; 261 | "linaro:10") 262 | _get_arm_packaging 263 | GCC_ver=10.3-2021.07 264 | ;; 265 | "linaro:11") 266 | _get_arm_packaging 267 | GCC_ver=11.3.rel1 268 | ;; 269 | "linaro:12") 270 | _get_arm_packaging 271 | GCC_ver=12.2.rel1 272 | ;; 273 | "linaro:13" | "linaro:14") die "Linaro ${VERSION}.x is not available yet!" -h ;; 274 | *) die "Absent or invalid GCC version or source specified!" -h ;; 275 | esac 276 | 277 | # As we don't handle this on _get_arm_packaging (because it's unnecessary), 278 | # just set it here after all the parsing being done 279 | [[ -z ${GCC_string} && ${SOURCE} == "linaro" ]] && GCC_string="Linaro GCC" 280 | 281 | # Setup final variables for some components here and set them read-only. 282 | # Variables should no longer be modified anymore beyond this point 283 | readonly GLIBC="glibc-${GLIBC_VERSION}" 284 | readonly GLIBC_VERSION 285 | } 286 | 287 | # Clean up from a previous compilation 288 | function clean_up() { #FIXME: we dont need to remove everything everytime. 289 | _header "CLEANING UP" 290 | 291 | unmount_tmpfs 292 | git clean -fxdq -e sources -e prebuilts -e patches 293 | find . -maxdepth 1 -type l -exec rm -rf {} \; #FIXME 294 | if [[ -d binutils ]] || 295 | [[ -d build-binutils ]] || 296 | [[ -d build-gcc ]] || 297 | [[ -d build-glibc ]] || 298 | [[ -d gcc ]] || 299 | [[ -d linux ]] || 300 | [[ -f ${TARGET} ]] || 301 | [[ $(for FILE in *.tar.*; do if [[ -f ${FILE} ]]; then 302 | echo "true" 303 | break 304 | else echo "false"; fi; done) == "true" ]]; then 305 | 306 | die "Clean up failed! Aborting. Try checking that you have proper permissions to delete files." 307 | else 308 | echo "Clean up successful!" 309 | fi 310 | } 311 | 312 | function build_binaries() { 313 | ROOT=${PWD} 314 | PREBUILTS_BIN=${ROOT}/prebuilts/bin 315 | mkdir -p sources 316 | 317 | if [[ ! -f ${PREBUILTS_BIN}/pigz ]]; then 318 | PIGZ=${ROOT}/sources/pigz 319 | [[ ! -d ${PIGZ} ]] && git -C "$(dirname "${PIGZ}")" clone --depth=1 https://github.com/madler/pigz 320 | git -C "${PIGZ}" clean -fxdq 321 | git -C "${PIGZ}" pull 322 | make -C "${PIGZ}" "${JOBS}" pigz || die "Error building pigz!" 323 | mv "${PIGZ}"/pigz "${PREBUILTS_BIN}" 324 | fi 325 | 326 | if [[ ! -f ${PREBUILTS_BIN}/pxz ]]; then 327 | PXZ=${ROOT}/sources/pxz 328 | [[ ! -d ${PXZ} ]] && git -C "$(dirname "${PXZ}")" clone --depth=1 https://github.com/krasCGQ/pxz 329 | git -C "${PXZ}" clean -fxdq 330 | git -C "${PXZ}" pull 331 | make -C "${PXZ}" "${JOBS}" pxz || die "Error building pxz!" 332 | mv "${PXZ}"/pxz "${PREBUILTS_BIN}" 333 | fi 334 | 335 | pushd sources || die "Failed to create sources directory!" 336 | 337 | if [[ ! -f $(dirname "${PREBUILTS_BIN}")/lib/liblz.a ]]; then 338 | LZLIB=lzlib-1.13 339 | [[ ! -f ${LZLIB}.tar.gz ]] && wget https://download.savannah.gnu.org/releases/lzip/lzlib/${LZLIB}.tar.gz 340 | [[ ! -d ${LZLIB} ]] && tar -xf ${LZLIB}.tar.gz 341 | pushd "${LZLIB}" || die "Issue with extracting lzlib source!" 342 | ./configure --prefix="$(dirname "${PREBUILTS_BIN}")" 343 | make "${JOBS}" || die "Error building lzlib!" 344 | make install "${JOBS}" || die "Error installing lzlib!" 345 | popd || die "Unable to change directory!" 346 | fi 347 | 348 | if [[ ! -f ${PREBUILTS_BIN}/plzip ]]; then 349 | PLZIP=plzip-1.9 350 | [[ ! -f ${PLZIP}.tar.gz ]] && wget https://download.savannah.gnu.org/releases/lzip/plzip/${PLZIP}.tar.gz 351 | [[ ! -d ${PLZIP} ]] && tar -xf ${PLZIP}.tar.gz 352 | pushd ${PLZIP} || die "Issue with extracting plzip source!" 353 | ./configure --prefix="$(dirname "${PREBUILTS_BIN}")" CXXFLAGS="-Wall -W -O2 -I$(dirname "${PREBUILTS_BIN}")/include -L$(dirname "${PREBUILTS_BIN}")/lib" 354 | make "${JOBS}" || die "Error building plzip!" 355 | make install "${JOBS}" || die "Error installing plzip!" 356 | popd || die "Unable to change directory!" 357 | fi 358 | 359 | popd || die "Unable to change directory!" 360 | export PATH=${PREBUILTS_BIN}:${PATH} 361 | } 362 | 363 | function download_sources() { 364 | pushd sources || die "Failed to create sources directory!" 365 | 366 | if [[ ! -f ${MPFR}.tar.xz ]]; then 367 | _header "DOWNLOADING MPFR" 368 | wget https://www.mpfr.org/mpfr-current/${MPFR}.tar.xz 369 | fi 370 | 371 | if [[ ! -f ${GMP}.tar.lz ]]; then 372 | _header "DOWNLOADING GMP" 373 | wget https://ftp.gnu.org/gnu/gmp/${GMP}.tar.lz 374 | fi 375 | 376 | if [[ ! -f ${MPC}.tar.gz ]]; then 377 | _header "DOWNLOADING MPC" 378 | wget https://ftp.gnu.org/gnu/mpc/${MPC}.tar.gz 379 | fi 380 | 381 | if [[ ! -f ${GLIBC}.tar.xz ]]; then 382 | _header "DOWNLOADING GLIBC ${GLIBC} FOR GCC ${VERSION}" 383 | wget https://ftp.gnu.org/gnu/glibc/${GLIBC}.tar.xz 384 | fi 385 | 386 | if [[ ! -f linux-${LINUX}.tar.xz ]]; then 387 | _header "DOWNLOADING LINUX KERNEL" 388 | wget https://cdn.kernel.org/pub/linux/kernel/v${LINUX/.*/}.x/linux-${LINUX}.tar.xz 389 | fi 390 | 391 | if [[ ! -f binutils-${BINUTILS}.tar.lz ]]; then 392 | _header "DOWNLOADING BINUTILS ${BINUTILS} FOR GCC ${VERSION}" 393 | wget https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS}.tar.lz 394 | fi 395 | 396 | if [[ ! -f ${ISL}.tar.xz ]]; then 397 | _header "DOWNLOADING ISL ${ISL} FOR GCC ${VERSION}" 398 | wget -U curl -O ${ISL}.tar.xz https://sourceforge.net/projects/libisl/files/${ISL}.tar.xz/download 399 | fi 400 | 401 | if [[ ${VERSION} -eq 4 && ! -f ${CLOOG}.tar.gz ]]; then 402 | _header "DOWNLOADING CLOOG" 403 | wget https://github.com/periscop/cloog/releases/download/${CLOOG}/${CLOOG}.tar.gz 404 | fi 405 | 406 | if [[ ${VERSION} -ge 10 && ! -f ${ZSTD}.tar.zst ]]; then 407 | _header "DOWNLOADING ZSTD" 408 | wget https://github.com/facebook/zstd/releases/download/v${ZSTD/zstd-/}/${ZSTD}.tar.zst 409 | fi 410 | 411 | # GNU, any version 412 | if [[ ${SOURCE} == "gnu" ]]; then 413 | if [[ ! -f ${GCC}.tar.${EXT:-xz} ]]; then 414 | _header "DOWNLOADING GCC" 415 | wget https://mirrors.kernel.org/gnu/gcc/${GCC}/${GCC}.tar.${EXT:-xz} 416 | fi 417 | GCC_TAR=${GCC}.tar.${EXT:-xz} 418 | # Linaro, 8.x and newer 419 | elif [[ ${VERSION} -ge 8 ]]; then 420 | if [[ ! -f ${GCC_base}-src-snapshot-${GCC_ver}.tar.xz ]]; then 421 | _header "DOWNLOADING GCC" 422 | # Note that ${GCC_type} might be undefined for 11+. 423 | # This approach is intentional as releases are now merged for A-profile and Embedded 424 | wget https://developer.arm.com/-/media/Files/downloads/gnu${GCC_type}/${GCC_ver}/srcrel/${GCC_base}-src-snapshot-${GCC_ver}.tar.xz 425 | fi 426 | GCC_TAR=${GCC_base}-src-snapshot-${GCC_ver}.tar.xz 427 | # Linaro, 7.x and older 428 | else 429 | if [[ ! -f gcc-linaro-${GCC_ver}.tar.xz ]]; then 430 | _header "DOWNLOADING GCC" 431 | wget https://releases.linaro.org/components/toolchain/gcc-linaro/${GCC_ver}/gcc-linaro-${GCC_ver}.tar.xz 432 | fi 433 | GCC_TAR=gcc-linaro-${GCC_ver}.tar.xz 434 | fi 435 | 436 | popd || die "Unable to change directory!" 437 | } 438 | 439 | # Wrapper for source tarball extraction 440 | function _extract() { 441 | case "${1}" in 442 | *.gz) UNPACK=pigz ;; 443 | *.lz) UNPACK=plzip ;; 444 | *.xz) UNPACK=pxz ;; 445 | *.zst) UNPACK=zstd ;; 446 | esac 447 | mkdir -p "${2}" 448 | ${UNPACK} -d <"${1}" | tar -xC "${2}" --strip-components=1 449 | } 450 | 451 | # Extract tarballs to their proper locations 452 | function extract_sources() { 453 | _header "EXTRACTING DOWNLOADED TARBALLS" 454 | pushd sources || die "Failed to create sources directory!" 455 | 456 | _extract ${MPFR}.tar.xz ../${MPFR} 457 | _extract ${GMP}.tar.lz ../${GMP} 458 | _extract ${MPC}.tar.gz ../${MPC} 459 | _extract ${GLIBC}.tar.xz ../${GLIBC} 460 | _extract linux-${LINUX}.tar.xz ../linux 461 | _extract binutils-${BINUTILS}.tar.lz ../binutils 462 | _extract ${ISL}.tar.xz ../${ISL} 463 | [[ ${VERSION} -eq 4 ]] && _extract ${CLOOG}.tar.gz ../${CLOOG} 464 | [[ ${VERSION} -ge 10 ]] && _extract ${ZSTD}.tar.zst ../${ZSTD} 465 | if [[ ${SOURCE} == "linaro" && ${VERSION} -ge 8 ]]; then 466 | # We can't use extract() here as this ships all build dependencies 467 | # Only extract GCC source and later rename it to gcc 468 | pxz -d <${GCC_TAR} | tar -xC .. ${GCC_base}-src-snapshot-${GCC_ver} 469 | mv -f ../${GCC_base}-src-snapshot-${GCC_ver} ../gcc 470 | else 471 | _extract ${GCC_TAR} ../gcc 472 | fi 473 | 474 | popd || die "Unable to change directory!" 475 | } 476 | 477 | # Setup source folders and build folders 478 | function setup_env() { 479 | INSTALL=${ROOT}/${TARGET} 480 | export PATH=${INSTALL}/bin:${PATH} 481 | 482 | [[ ! -d gcc ]] && die "GCC source is missing! Please check your connection and rerun the script!" -h 483 | 484 | mkdir build-glibc 485 | mkdir build-gcc 486 | mkdir build-binutils 487 | 488 | if [[ -z ${NO_TMPFS} ]]; then 489 | sudo mount -t tmpfs -o rw none build-glibc 490 | sudo mount -t tmpfs -o rw none build-gcc 491 | sudo mount -t tmpfs -o rw none build-binutils 492 | fi 493 | 494 | pushd gcc || die "GCC folder does not exist!" 495 | 496 | ln -s -f "${ROOT}/${MPFR}" mpfr 497 | ln -s -f "${ROOT}/${GMP}" gmp 498 | ln -s -f "${ROOT}/${MPC}" mpc 499 | ln -s -f "${ROOT}/${ISL}" isl 500 | [[ ${VERSION} -eq 4 ]] && ln -s -f "${ROOT}/${CLOOG}" cloog 501 | 502 | # Apply fixes and workarounds for GCC 503 | GCC_PATCHES=() 504 | case "${SOURCE}:${VERSION}" in 505 | "gnu:4") 506 | # Linaro backport of 51e1cdb2bd29 is required AArch64 with Glibc 2.27+ 507 | GCC_PATCHES+=("gcc-4.9.4_add-vrnd_f64-aarch64-intrinsics") 508 | ;& # fallthrough 509 | "linaro:4") 510 | GCC_PATCHES+=( 511 | # https://patchwork.ozlabs.org/patch/725596/ 512 | "gcc-4.9.4_asan-fix-missing-include-signal-h" 513 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066 514 | "gcc-4.9.4_use-stack_t-instead-of-struct-sigaltstack" 515 | # https://reviews.llvm.org/D47281 516 | "gcc-4.9.4_libsanitizer-use-pre-computed-size-of-struct-ustat-for-linux" 517 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724 518 | "gcc-4.9.4_compilation-error-with-new-isl-0.20-missing-includes" 519 | # Deprecated isl_map_n_out is dropped from isl-0.21+ 520 | "gcc-4.9.4_isl-0.21-compat" 521 | # Use (void *) instead of PTR macro for headers 522 | "gcc-4.9.4_do-not-use-the-ptr-macro" 523 | ) 524 | ;; 525 | "gnu:5" | "linaro:5") 526 | GCC_PATCHES+=( 527 | # https://reviews.llvm.org/D47281 528 | "gcc-5.5.0_libsanitizer-use-pre-computed-size-of-struct-ustat-for-linux" 529 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724 530 | "gcc-5.5.0_compilation-error-with-new-isl-0.20-missing-includes" 531 | # Deprecated isl_map_n_out is dropped from isl-0.21+ 532 | "gcc-5.5.0_isl-0.21-compat" 533 | ) 534 | ;; 535 | "gnu:6" | "linaro:6") 536 | GCC_PATCHES+=( 537 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87822 538 | "gcc-6.5.0_fix-layout-change-for-nested-std-pair" 539 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154 540 | "gcc-6.5.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer" 541 | ) 542 | ;; 543 | "gnu:7" | "linaro:7") 544 | GCC_PATCHES+=( 545 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84080 546 | "gcc-7.5.0_ice-with-return-type-deduction-and-specialization" 547 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154 548 | "gcc-7.5.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer" 549 | ) 550 | ;; 551 | "linaro:8") 552 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154 553 | GCC_PATCHES+=("gcc-8.3.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer") 554 | ;; 555 | "linaro:9") 556 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92154 557 | GCC_PATCHES+=("gcc-9.2.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer") 558 | ;; 559 | esac 560 | # Use (void *) instead of PTR macro for headers (GCC 5-12) 561 | [[ ${VERSION} -ge 5 && ${VERSION} -le 12 ]] && GCC_PATCHES+=("gcc-5-12_do-not-use-the-ptr-macro") 562 | 563 | for GCC_PATCH in "${GCC_PATCHES[@]}"; do 564 | patch -Np1 <"${ROOT}"/patches/"${GCC_PATCH}".patch || die "Failed to patch GCC source!" 565 | done 566 | 567 | popd || die "Unable to change directory!" 568 | 569 | # Apply fixes and workarounds for Glibc 2.36 570 | if [[ ${GLIBC_VERSION} == "2.36" ]]; then 571 | pushd "${ROOT}"/${GLIBC} || die "Glibc source is missing! Please check your connection and rerun the script!" -h 572 | # https://sourceware.org/bugzilla/show_bug.cgi?id=29249 573 | patch -Np1 <"${ROOT}"/patches/${GLIBC}_revert-linux-implement-a-useful-version-of-_startup_fatal.patch || die "Failed to patch Glibc source!" 574 | # sys/mount.h has clashes with definitions from kernel's linux/mount.h 575 | # This issue was fixed on release/2.36/master git branch 576 | patch -Np1 <"${ROOT}"/patches/${GLIBC}_linux-compat.patch || die "Failed to patch Glibc source!" 577 | # Allows linking with GCC 6 for AArch64 by not using builtin functions for Float128 578 | patch -Np1 <"${ROOT}"/patches/${GLIBC}_gcc-6-aarch64-compat.patch || die "Failed to patch Glibc source!" 579 | popd || die "Unable to change directory!" 580 | fi 581 | 582 | if [[ -z ${VERBOSE} ]]; then 583 | exec 1>&5 2>&6 584 | _header "BUILDING TOOLCHAIN" 585 | exec 6>&2 5>&1 &>/dev/null 586 | fi 587 | } 588 | 589 | # Prepare and install Linux kernel headers 590 | function install_linux_headers() { 591 | _header "INSTALLING LINUX KERNEL HEADERS" 592 | pushd linux || die "Linux kernel folder does not exist!" 593 | make ARCH="${KERNEL_ARCH}" \ 594 | INSTALL_HDR_PATH="${INSTALL}/${TARGET}" \ 595 | headers_install "${JOBS}" || die "Error while preparing/installing Linux kernel headers!" -n 596 | popd || die "Unable to change directory!" 597 | } 598 | 599 | # Install Glibc headers using dummy configuration 600 | function install_glibc_headers() { 601 | # Re-use these configuration flags later during Glibc build 602 | GLIBC_CONFIGURATION=( 603 | "CFLAGS=-O2" 604 | "CXXFLAGS=-O2" 605 | "--prefix=${INSTALL}/${TARGET}" 606 | "--build=${MACHTYPE}" 607 | "--host=${TARGET}" 608 | "--target=${TARGET}" 609 | "--with-headers=${INSTALL}/${TARGET}/include" 610 | "--with-pkgversion=GNU libc ${REVISION}" 611 | "${CONFIGURATION[@]}" 612 | "--without-selinux" 613 | "--enable-kernel=4.15.0" 614 | "--enable-stack-protector=all" 615 | ) 616 | 617 | _header "INSTALLING GLIBC HEADERS" 618 | pushd build-glibc || die "Glibc build folder does not exist!" 619 | # Use CC=gcc as cross compiler doesn't exist yet at this point 620 | CC=gcc \ 621 | ../${GLIBC}/configure \ 622 | "${GLIBC_CONFIGURATION[@]}" \ 623 | --disable-sanity-checks \ 624 | --enable-hacker-mode \ 625 | libc_cv_forced_unwind=yes 626 | make install-bootstrap-headers=yes \ 627 | install-headers "${JOBS}" || die "Error while building/installing Glibc headers!" -n 628 | touch "${INSTALL}/${TARGET}/include/gnu/stubs.h" || die "Error while creating stubs.h header for Glibc!" -n 629 | popd || die "Unable to change directory!" 630 | } 631 | 632 | # Build and install Binutils 633 | function build_binutils() { 634 | _header "BUILDING BINUTILS" 635 | pushd build-binutils || die "Binutils build folder does not exist!" 636 | ../binutils/configure \ 637 | CFLAGS="-O2 -fno-stack-protector" CXXFLAGS="-O2 -fno-stack-protector" \ 638 | --prefix="${INSTALL}" \ 639 | --target=${TARGET} \ 640 | --with-pkgversion="GNU Binutils ${REVISION}" \ 641 | "${CONFIGURATION[@]}" \ 642 | "${AARCH64_CONFIGURATION}" \ 643 | --disable-default-execstack \ 644 | --disable-gdb \ 645 | --disable-multilib \ 646 | --disable-nls 647 | make "${JOBS}" || die "Error while building Binutils!" -n 648 | make install "${JOBS}" || die "Error while installing Binutils!" -n 649 | popd || die "Unable to change directory!" 650 | } 651 | 652 | # Build and install libzstd for GCC 10+ 653 | function build_libzstd() { 654 | if [[ ${VERSION} -ge 10 ]]; then 655 | _header "BUILDING LIBZSTD" 656 | [[ -d ${ZSTD} ]] || die "Zstd folder does not exist!" 657 | make -C ${ZSTD} lib-release "${JOBS}" || die "Error while building libzstd for GCC!" -n 658 | make -C ${ZSTD}/lib PREFIX="${INSTALL}" install "${JOBS}" || die "Error while installing libzstd for GCC!" -n 659 | # Tell GCC to use our own libzstd instead of system-installed one 660 | WITH_LIBZSTD="--with-zstd=${INSTALL}" 661 | fi 662 | } 663 | 664 | # Build and install minimal GCC for static linking 665 | function build_minimal_gcc() { 666 | _header "BUILDING MINIMAL GCC" 667 | pushd build-gcc || die "GCC build folder does not exist!" 668 | ../gcc/configure \ 669 | CFLAGS="-O2 -fno-stack-protector" CXXFLAGS="-O2 -fno-stack-protector" \ 670 | --prefix="${INSTALL}" \ 671 | --target=${TARGET} \ 672 | --with-glibc-version=${GLIBC_VERSION} \ 673 | --with-pkgversion="${GCC_string:-GCC}${GCC_string:+ ${GCC_ver}} ${REVISION}" \ 674 | "${CONFIGURATION[@]}" \ 675 | "${AARCH64_CONFIGURATION}" \ 676 | "${WITH_LIBZSTD}" \ 677 | --disable-bootstrap \ 678 | --disable-libmpx \ 679 | --disable-libssp \ 680 | --disable-multilib \ 681 | --disable-nls \ 682 | --enable-languages=c,c++ 683 | # Force GCC to expect a limits.h header as we haven't build Glibc at this stage yet 684 | make LIMITS_H_TEST=true all-gcc "${JOBS}" || die "Error while building minimal GCC!" -n 685 | make install-gcc "${JOBS}" || die "Error while installing minimal GCC!" -n 686 | popd || die "Unable to change directory!" 687 | } 688 | 689 | # Build and install C start-up and stub C libraries 690 | function build_bootstrap_libc() { 691 | _header "BUILDING BOOTSTRAP LIBC" 692 | pushd build-glibc || die "Glibc build folder does not exist!" 693 | ../${GLIBC}/configure \ 694 | "${GLIBC_CONFIGURATION[@]}" \ 695 | libc_cv_forced_unwind=yes 696 | make csu/subdir_lib "${JOBS}" || die "Error while building C start-up libraries!" -n 697 | install csu/crt1.o csu/crti.o csu/crtn.o "${INSTALL}/${TARGET}/lib" || die "Error while installing C start-up libraries!" -n 698 | ${TARGET}-gcc -nostdlib -nostartfiles -shared \ 699 | -x c /dev/null -o "${INSTALL}/${TARGET}/lib/libc.so" || die "Error while compiling stub libc!" -n 700 | popd || die "Unable to change directory!" 701 | } 702 | 703 | # Build and install libgcc for target system 704 | function build_libgcc() { 705 | _header "BUILDING LIBGCC" 706 | pushd build-gcc || die "GCC build folder does not exist!" 707 | make all-target-libgcc "${JOBS}" || die "Error while building libgcc for target!" -n 708 | make install-target-libgcc "${JOBS}" || die "Error while installing libgcc for target!" -n 709 | popd || die "Unable to change directory!" 710 | } 711 | 712 | # Build and install Glibc for target system 713 | function build_glibc() { 714 | _header "BUILDING GLIBC" 715 | pushd build-glibc || die "Glibc build folder does not exist!" 716 | make "${JOBS}" || die "Error while building Glibc for target!" -n 717 | make install "${JOBS}" || die "Error while installing Glibc for target!" -n 718 | popd || die "Unable to change directory!" 719 | } 720 | 721 | # Build and install rest of GCC 722 | function build_final_gcc() { 723 | _header "BUILDING FINAL GCC" 724 | pushd build-gcc || die "GCC build folder does not exist!" 725 | make all "${JOBS}" || die "Error while building final GCC!" -n 726 | make install "${JOBS}" || die "Error while installing final GCC!" -n 727 | popd || die "Unable to change directory!" 728 | } 729 | 730 | # Ending information 731 | function ending_info() { 732 | [[ -z ${VERBOSE} ]] && exec 1>&5 2>&6 733 | _header "BUILD SUCCESSFUL" ${VERBOSE:-"--no-first-echo"} 734 | echo "${BOLD}GCC version:${RST} $(${TARGET}/bin/${TARGET}-gcc --version | head -n 1)" 735 | echo "${BOLD}Toolchain location:${RST} $(pwd)/${TARGET}" 736 | 737 | # Alert to script end 738 | echo "\a" 739 | } 740 | 741 | setup_variables 742 | parse_parameters "${@}" 743 | trap 'unmount_tmpfs; die "Manually aborted!" -n' SIGINT SIGTERM 744 | trap 'unmount_tmpfs' EXIT 745 | clean_up 746 | build_binaries 747 | download_sources 748 | extract_sources 749 | setup_env 750 | install_linux_headers 751 | install_glibc_headers 752 | build_binutils 753 | build_libzstd 754 | build_minimal_gcc 755 | build_bootstrap_libc 756 | build_libgcc 757 | build_glibc 758 | build_final_gcc 759 | ending_info 760 | -------------------------------------------------------------------------------- /patches/gcc-4.9.4_add-vrnd_f64-aarch64-intrinsics.patch: -------------------------------------------------------------------------------- 1 | --- gcc/gcc/config/aarch64/aarch64-builtins.c.orig 2014-03-24 20:05:38.000000000 +0800 2 | +++ gcc/gcc/config/aarch64/aarch64-builtins.c 2022-09-09 07:30:41.360012739 +0800 3 | @@ -311,6 +311,8 @@ 4 | VAR7 (T, N, MAP, v8qi, v16qi, v4hi, v8hi, v2si, v4si, v2di) 5 | #define BUILTIN_VDQF(T, N, MAP) \ 6 | VAR3 (T, N, MAP, v2sf, v4sf, v2df) 7 | +#define BUILTIN_VDQF_DF(T, N, MAP) \ 8 | + VAR4 (T, N, MAP, v2sf, v4sf, v2df, df) 9 | #define BUILTIN_VDQH(T, N, MAP) \ 10 | VAR2 (T, N, MAP, v4hi, v8hi) 11 | #define BUILTIN_VDQHS(T, N, MAP) \ 12 | --- gcc/gcc/config/aarch64/aarch64.md.orig 2016-01-12 22:04:26.000000000 +0800 13 | +++ gcc/gcc/config/aarch64/aarch64.md 2022-09-09 07:30:41.361012742 +0800 14 | @@ -3191,7 +3191,7 @@ 15 | ;; ------------------------------------------------------------------- 16 | 17 | ;; frint floating-point round to integral standard patterns. 18 | -;; Expands to btrunc, ceil, floor, nearbyint, rint, round. 19 | +;; Expands to btrunc, ceil, floor, nearbyint, rint, round, frintn. 20 | 21 | (define_insn "2" 22 | [(set (match_operand:GPF 0 "register_operand" "=w") 23 | --- gcc/gcc/config/aarch64/aarch64-simd-builtins.def.orig 2014-03-24 20:05:38.000000000 +0800 24 | +++ gcc/gcc/config/aarch64/aarch64-simd-builtins.def 2022-09-09 07:30:41.360012739 +0800 25 | @@ -265,7 +265,7 @@ 26 | BUILTIN_VDQF (UNOP, nearbyint, 2) 27 | BUILTIN_VDQF (UNOP, rint, 2) 28 | BUILTIN_VDQF (UNOP, round, 2) 29 | - BUILTIN_VDQF (UNOP, frintn, 2) 30 | + BUILTIN_VDQF_DF (UNOP, frintn, 2) 31 | 32 | /* Implemented by l2. */ 33 | VAR1 (UNOP, lbtruncv2sf, 2, v2si) 34 | --- gcc/gcc/config/aarch64/aarch64-simd.md.orig 2016-05-20 17:12:59.000000000 +0800 35 | +++ gcc/gcc/config/aarch64/aarch64-simd.md 2022-09-09 07:30:41.361012742 +0800 36 | @@ -1576,7 +1576,7 @@ 37 | ) 38 | 39 | ;; Vector versions of the floating-point frint patterns. 40 | -;; Expands to btrunc, ceil, floor, nearbyint, rint, round. 41 | +;; Expands to btrunc, ceil, floor, nearbyint, rint, round, frintn. 42 | (define_insn "2" 43 | [(set (match_operand:VDQF 0 "register_operand" "=w") 44 | (unspec:VDQF [(match_operand:VDQF 1 "register_operand" "w")] 45 | --- gcc/gcc/config/aarch64/arm_neon.h.orig 2014-09-11 23:12:08.000000000 +0800 46 | +++ gcc/gcc/config/aarch64/arm_neon.h 2022-09-09 07:30:41.363012749 +0800 47 | @@ -22469,6 +22469,12 @@ 48 | return __builtin_aarch64_btruncv2sf (__a); 49 | } 50 | 51 | +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) 52 | +vrnd_f64 (float64x1_t __a) 53 | +{ 54 | + return vset_lane_f64 (__builtin_trunc (vget_lane_f64 (__a, 0)), __a, 0); 55 | +} 56 | + 57 | __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) 58 | vrndq_f32 (float32x4_t __a) 59 | { 60 | @@ -22489,6 +22495,12 @@ 61 | return __builtin_aarch64_roundv2sf (__a); 62 | } 63 | 64 | +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) 65 | +vrnda_f64 (float64x1_t __a) 66 | +{ 67 | + return vset_lane_f64 (__builtin_round (vget_lane_f64 (__a, 0)), __a, 0); 68 | +} 69 | + 70 | __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) 71 | vrndaq_f32 (float32x4_t __a) 72 | { 73 | @@ -22509,6 +22521,12 @@ 74 | return __builtin_aarch64_nearbyintv2sf (__a); 75 | } 76 | 77 | +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) 78 | +vrndi_f64 (float64x1_t __a) 79 | +{ 80 | + return vset_lane_f64 (__builtin_nearbyint (vget_lane_f64 (__a, 0)), __a, 0); 81 | +} 82 | + 83 | __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) 84 | vrndiq_f32 (float32x4_t __a) 85 | { 86 | @@ -22529,6 +22547,12 @@ 87 | return __builtin_aarch64_floorv2sf (__a); 88 | } 89 | 90 | +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) 91 | +vrndm_f64 (float64x1_t __a) 92 | +{ 93 | + return vset_lane_f64 (__builtin_floor (vget_lane_f64 (__a, 0)), __a, 0); 94 | +} 95 | + 96 | __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) 97 | vrndmq_f32 (float32x4_t __a) 98 | { 99 | @@ -22548,6 +22572,13 @@ 100 | { 101 | return __builtin_aarch64_frintnv2sf (__a); 102 | } 103 | + 104 | +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) 105 | +vrndn_f64 (float64x1_t __a) 106 | +{ 107 | + return __builtin_aarch64_frintndf (__a); 108 | +} 109 | + 110 | __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) 111 | vrndnq_f32 (float32x4_t __a) 112 | { 113 | @@ -22568,6 +22599,12 @@ 114 | return __builtin_aarch64_ceilv2sf (__a); 115 | } 116 | 117 | +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) 118 | +vrndp_f64 (float64x1_t __a) 119 | +{ 120 | + return vset_lane_f64 (__builtin_ceil (vget_lane_f64 (__a, 0)), __a, 0); 121 | +} 122 | + 123 | __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) 124 | vrndpq_f32 (float32x4_t __a) 125 | { 126 | @@ -22588,6 +22625,12 @@ 127 | return __builtin_aarch64_rintv2sf (__a); 128 | } 129 | 130 | +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) 131 | +vrndx_f64 (float64x1_t __a) 132 | +{ 133 | + return vset_lane_f64 (__builtin_rint (vget_lane_f64 (__a, 0)), __a, 0); 134 | +} 135 | + 136 | __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) 137 | vrndxq_f32 (float32x4_t __a) 138 | { 139 | -------------------------------------------------------------------------------- /patches/gcc-4.9.4_asan-fix-missing-include-signal-h.patch: -------------------------------------------------------------------------------- 1 | From 205aa8e97bab553e5e6fe45896325e97962de704 Mon Sep 17 00:00:00 2001 2 | From: Rolf Eike Beer 3 | Date: Wed, 8 Feb 2017 11:42:52 +0100 4 | Subject: [PATCH] asan: fix missing include of signal.h 5 | 6 | This breaks when building gcc 4.9.4 / 5.4.0 with 7 | target_platform=powerpc-unknown-linux-gnu with glibc 2.25: 8 | 9 | ../../../../gcc-host/libsanitizer/asan/asan_linux.cc: In function 'bool __asan::AsanInterceptsSignal(int)': 10 | ../../../../gcc-host/libsanitizer/asan/asan_linux.cc:222:20: error: 'SIGSEGV' was not declared in this scope 11 | return signum == SIGSEGV && common_flags()->handle_segv; 12 | 13 | This has been verified to apply to at least 4.9.4 and up to 5.4, 14 | the code has been reworked for gcc 6. 15 | 16 | Resolves (Buildroot) Bug: https://bugs.busybox.net/show_bug.cgi?id=10061 17 | 18 | Upstream: https://patchwork.ozlabs.org/patch/725596/ 19 | 20 | Signed-off-by: Matthew Weber 21 | --- 22 | libsanitizer/asan/asan_linux.cc | 1 + 23 | 1 file changed, 1 insertion(+) 24 | 25 | diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc 26 | index c504168..59087b9 100644 27 | --- a/libsanitizer/asan/asan_linux.cc 28 | +++ b/libsanitizer/asan/asan_linux.cc 29 | @@ -29,6 +29,7 @@ 30 | #include 31 | #include 32 | #include 33 | +#include 34 | #include 35 | #include 36 | #include 37 | -------------------------------------------------------------------------------- /patches/gcc-4.9.4_compilation-error-with-new-isl-0.20-missing-includes.patch: -------------------------------------------------------------------------------- 1 | --- gcc/gcc/graphite-blocking.c.orig 2015-11-19 23:19:13.000000000 +0800 2 | +++ gcc/gcc/graphite-blocking.c 2022-09-10 15:14:57.167575621 +0800 3 | @@ -29,6 +29,7 @@ 4 | #include 5 | #include 6 | #include 7 | +#include 8 | #include 9 | #include 10 | #endif 11 | --- gcc/gcc/graphite-clast-to-gimple.c.orig 2014-12-05 02:25:37.000000000 +0800 12 | +++ gcc/gcc/graphite-clast-to-gimple.c 2022-09-10 15:15:16.289715301 +0800 13 | @@ -28,6 +28,7 @@ 14 | #include 15 | #include 16 | #include 17 | +#include 18 | #include 19 | #include 20 | #ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE 21 | --- gcc/gcc/graphite-dependences.c.orig 2015-11-19 23:19:13.000000000 +0800 22 | +++ gcc/gcc/graphite-dependences.c 2022-09-10 15:18:19.714056907 +0800 23 | @@ -28,6 +28,8 @@ 24 | #include 25 | #include 26 | #include 27 | +#include 28 | +#include 29 | #include 30 | #include 31 | #endif 32 | --- gcc/gcc/graphite-interchange.c.orig 2015-11-19 23:19:13.000000000 +0800 33 | +++ gcc/gcc/graphite-interchange.c 2022-09-10 15:16:19.618178174 +0800 34 | @@ -30,6 +30,7 @@ 35 | #include 36 | #include 37 | #include 38 | +#include 39 | #include 40 | #include 41 | #ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE 42 | --- gcc/gcc/graphite-optimize-isl.c.orig 2015-11-19 23:19:13.000000000 +0800 43 | +++ gcc/gcc/graphite-optimize-isl.c 2022-09-10 15:16:43.969356259 +0800 44 | @@ -30,6 +30,7 @@ 45 | #include 46 | #include 47 | #include 48 | +#include 49 | #ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE 50 | #include 51 | #include 52 | --- gcc/gcc/graphite-poly.c.orig 2015-11-19 23:19:13.000000000 +0800 53 | +++ gcc/gcc/graphite-poly.c 2022-09-10 15:16:58.648463631 +0800 54 | @@ -29,6 +29,7 @@ 55 | #include 56 | #include 57 | #include 58 | +#include 59 | #include 60 | #include 61 | #ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE 62 | --- gcc/gcc/graphite-sese-to-poly.c.orig 2015-11-19 23:19:13.000000000 +0800 63 | +++ gcc/gcc/graphite-sese-to-poly.c 2022-09-10 15:18:30.306134463 +0800 64 | @@ -27,6 +27,8 @@ 65 | #include 66 | #include 67 | #include 68 | +#include 69 | +#include 70 | #include 71 | #include 72 | #include 73 | -------------------------------------------------------------------------------- /patches/gcc-4.9.4_do-not-use-the-ptr-macro.patch: -------------------------------------------------------------------------------- 1 | --- gcc/gcc/basic-block.h.orig 2014-01-03 06:23:26.000000000 +0800 2 | +++ gcc/gcc/basic-block.h 2022-09-17 06:23:08.379634136 +0800 3 | @@ -43,7 +43,7 @@ 4 | } insns; 5 | 6 | /* Auxiliary info specific to a pass. */ 7 | - PTR aux; 8 | + void *aux; 9 | 10 | /* Location of any goto implicit in the edge. */ 11 | location_t goto_locus; 12 | @@ -170,7 +170,7 @@ 13 | vec *succs; 14 | 15 | /* Auxiliary info specific to a pass. */ 16 | - PTR GTY ((skip (""))) aux; 17 | + void * GTY ((skip (""))) aux; 18 | 19 | /* Innermost loop containing the block. */ 20 | struct loop *loop_father; 21 | --- gcc/gcc/cfgloop.h.orig 2014-01-03 06:23:26.000000000 +0800 22 | +++ gcc/gcc/cfgloop.h 2022-09-17 06:23:08.380634134 +0800 23 | @@ -133,7 +133,7 @@ 24 | struct loop *next; 25 | 26 | /* Auxiliary info specific to a pass. */ 27 | - PTR GTY ((skip (""))) aux; 28 | + void * GTY ((skip (""))) aux; 29 | 30 | /* The number of times the latch of the loop is executed. This can be an 31 | INTEGER_CST, or a symbolic expression representing the number of 32 | --- gcc/gcc/cgraph.h.orig 2022-09-17 06:23:08.382634130 +0800 33 | +++ gcc/gcc/cgraph.h 2022-09-17 06:29:18.713327125 +0800 34 | @@ -150,7 +150,7 @@ 35 | /* File stream where this node is being written to. */ 36 | struct lto_file_decl_data * lto_file_data; 37 | 38 | - PTR GTY ((skip)) aux; 39 | + void * GTY ((skip)) aux; 40 | }; 41 | 42 | enum availability 43 | @@ -583,7 +583,7 @@ 44 | /* Additional information about an indirect call. Not cleared when an edge 45 | becomes direct. */ 46 | struct cgraph_indirect_call_info *indirect_info; 47 | - PTR GTY ((skip (""))) aux; 48 | + void * GTY ((skip (""))) aux; 49 | /* When equal to CIF_OK, inline this call. Otherwise, points to the 50 | explanation why function was not inlined. */ 51 | enum cgraph_inline_failed_t inline_failed; 52 | --- gcc/gcc/ipa-utils.h.orig 2014-02-12 06:54:21.000000000 +0800 53 | +++ gcc/gcc/ipa-utils.h 2022-09-17 06:23:08.383634128 +0800 54 | @@ -31,7 +31,7 @@ 55 | bool new_node; 56 | bool on_stack; 57 | struct cgraph_node* next_cycle; 58 | - PTR aux; 59 | + void *aux; 60 | }; 61 | 62 | /* Context of polymorphic call. This is used by ipa-devirt walkers of the 63 | -------------------------------------------------------------------------------- /patches/gcc-4.9.4_isl-0.21-compat.patch: -------------------------------------------------------------------------------- 1 | --- gcc/gcc/graphite-poly.h.orig 2015-11-19 23:19:13.000000000 +0800 2 | +++ gcc/gcc/graphite-poly.h 2022-09-10 15:01:44.052842691 +0800 3 | @@ -371,7 +371,7 @@ 4 | out dimension of transformed to count the scatterting transform dimension. 5 | */ 6 | #define PBB_NB_LOCAL_VARIABLES(PBB) (0) 7 | -#define PBB_NB_SCATTERING_TRANSFORM(PBB) (isl_map_n_out (PBB->transformed)) 8 | +#define PBB_NB_SCATTERING_TRANSFORM(PBB) (isl_map_dim(PBB->transformed, isl_dim_out)) 9 | #define PBB_IS_REDUCTION(PBB) (PBB->is_reduction) 10 | 11 | extern poly_bb_p new_poly_bb (scop_p, void *); 12 | -------------------------------------------------------------------------------- /patches/gcc-4.9.4_libsanitizer-use-pre-computed-size-of-struct-ustat-for-linux.patch: -------------------------------------------------------------------------------- 1 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2013-12-19 20:54:11.000000000 +0800 2 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2022-09-09 07:54:15.119907994 +0800 3 | @@ -81,7 +81,6 @@ 4 | #include 5 | #include 6 | #include 7 | -#include 8 | #include 9 | #include 10 | #include 11 | @@ -163,7 +162,19 @@ 12 | unsigned struct_old_utsname_sz = sizeof(struct old_utsname); 13 | unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname); 14 | unsigned struct_itimerspec_sz = sizeof(struct itimerspec); 15 | - unsigned struct_ustat_sz = sizeof(struct ustat); 16 | + // Use pre-computed size of struct ustat to avoid which 17 | + // has been removed from glibc 2.28. 18 | +#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ 19 | + || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \ 20 | + || defined(__x86_64__) 21 | +#define SIZEOF_STRUCT_USTAT 32 22 | +#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \ 23 | + || defined(__powerpc__) || defined(__s390__) || defined(__sparc__) 24 | +#define SIZEOF_STRUCT_USTAT 20 25 | +#else 26 | +#error Unknown size of struct ustat 27 | +#endif 28 | + unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT; 29 | #endif // SANITIZER_LINUX 30 | 31 | #if SANITIZER_LINUX && !SANITIZER_ANDROID 32 | -------------------------------------------------------------------------------- /patches/gcc-4.9.4_use-stack_t-instead-of-struct-sigaltstack.patch: -------------------------------------------------------------------------------- 1 | https://bugs.gentoo.org/629502 2 | 3 | commit 67dce0587409353e1b6e38c4b33ed89d4ccabe5c 4 | Author: jakub 5 | Date: Fri Jul 14 09:10:45 2017 +0000 6 | 7 | PR sanitizer/81066 8 | * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969. 9 | * sanitizer_common/sanitizer_linux.cc: Likewise. 10 | * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise. 11 | * tsan/tsan_platform_linux.cc: Likewise. 12 | 13 | 14 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250200 138bc75d-0d04-0410-961f-82ee72b054a4 15 | 16 | diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc 17 | index 806fcd5e284..5b6f18602e7 100644 18 | --- a/libsanitizer/sanitizer_common/sanitizer_linux.cc 19 | +++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc 20 | @@ -605,3 +605,2 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) { 21 | 22 | -uptr internal_sigaltstack(const struct sigaltstack *ss, 23 | - struct sigaltstack *oss) { 24 | +uptr internal_sigaltstack(const void *ss, void *oss) { 25 | diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h 26 | index 895bfc18195..a42df576405 100644 27 | --- a/libsanitizer/sanitizer_common/sanitizer_linux.h 28 | +++ b/libsanitizer/sanitizer_common/sanitizer_linux.h 29 | @@ -19,7 +19,6 @@ 30 | #include "sanitizer_platform_limits_posix.h" 31 | 32 | struct link_map; // Opaque type returned by dlopen(). 33 | -struct sigaltstack; 34 | 35 | namespace __sanitizer { 36 | // Dirent structure for getdents(). Note that this structure is different from 37 | @@ -28,2 +27,1 @@ struct linux_dirent; 38 | -uptr internal_sigaltstack(const struct sigaltstack* ss, 39 | - struct sigaltstack* oss); 40 | +uptr internal_sigaltstack(const void* ss, void* oss); 41 | diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc 42 | index 891386dc0ba..234e8c652c6 100644 43 | --- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc 44 | +++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc 45 | @@ -273,7 +273,7 @@ static int TracerThread(void* argument) { 46 | 47 | // Alternate stack for signal handling. 48 | InternalScopedBuffer handler_stack_memory(kHandlerStackSize); 49 | - struct sigaltstack handler_stack; 50 | + stack_t handler_stack; 51 | internal_memset(&handler_stack, 0, sizeof(handler_stack)); 52 | handler_stack.ss_sp = handler_stack_memory.data(); 53 | handler_stack.ss_size = kHandlerStackSize; 54 | diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc 55 | index 2ed5718a12e..6f972ab0dd6 100644 56 | --- a/libsanitizer/tsan/tsan_platform_linux.cc 57 | +++ b/libsanitizer/tsan/tsan_platform_linux.cc 58 | @@ -287,7 +287,7 @@ void InitializePlatform() { 59 | int ExtractResolvFDs(void *state, int *fds, int nfd) { 60 | #if SANITIZER_LINUX && !SANITIZER_ANDROID 61 | int cnt = 0; 62 | - __res_state *statp = (__res_state*)state; 63 | + struct __res_state *statp = (struct __res_state*)state; 64 | for (int i = 0; i < MAXNS && cnt < nfd; i++) { 65 | if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) 66 | fds[cnt++] = statp->_u._ext.nssocks[i]; 67 | -------------------------------------------------------------------------------- /patches/gcc-5-12_do-not-use-the-ptr-macro.patch: -------------------------------------------------------------------------------- 1 | --- gcc/gcc/basic-block.h.orig 2022-08-19 16:09:52.524661754 +0800 2 | +++ gcc/gcc/basic-block.h 2022-09-17 02:59:10.594889851 +0800 3 | @@ -36,7 +36,7 @@ 4 | } insns; 5 | 6 | /* Auxiliary info specific to a pass. */ 7 | - PTR aux; 8 | + void *aux; 9 | 10 | /* Location of any goto implicit in the edge. */ 11 | location_t goto_locus; 12 | @@ -120,7 +120,7 @@ 13 | vec *succs; 14 | 15 | /* Auxiliary info specific to a pass. */ 16 | - PTR GTY ((skip (""))) aux; 17 | + void * GTY ((skip (""))) aux; 18 | 19 | /* Innermost loop containing the block. */ 20 | class loop *loop_father; 21 | --- gcc/gcc/cfgloop.h.orig 2022-08-19 16:09:52.544662011 +0800 22 | +++ gcc/gcc/cfgloop.h 2022-09-17 03:01:57.855513807 +0800 23 | @@ -148,7 +148,7 @@ 24 | class loop *next; 25 | 26 | /* Auxiliary info specific to a pass. */ 27 | - PTR GTY ((skip (""))) aux; 28 | + void * GTY ((skip (""))) aux; 29 | 30 | /* The number of times the latch of the loop is executed. This can be an 31 | INTEGER_CST, or a symbolic expression representing the number of 32 | --- gcc/gcc/cgraph.h.orig 2022-08-19 16:09:52.548662062 +0800 33 | +++ gcc/gcc/cgraph.h 2022-09-17 03:01:06.488031856 +0800 34 | @@ -628,7 +628,7 @@ 35 | /* File stream where this node is being written to. */ 36 | struct lto_file_decl_data * lto_file_data; 37 | 38 | - PTR GTY ((skip)) aux; 39 | + void * GTY ((skip)) aux; 40 | 41 | /* Comdat group the symbol is in. Can be private if GGC allowed that. */ 42 | tree x_comdat_group; 43 | @@ -1895,7 +1895,7 @@ 44 | /* Additional information about an indirect call. Not cleared when an edge 45 | becomes direct. */ 46 | cgraph_indirect_call_info *indirect_info; 47 | - PTR GTY ((skip (""))) aux; 48 | + void * GTY ((skip (""))) aux; 49 | /* When equal to CIF_OK, inline this call. Otherwise, points to the 50 | explanation why function was not inlined. */ 51 | enum cgraph_inline_failed_t inline_failed; 52 | --- gcc/gcc/ipa-utils.h.orig 2022-08-19 16:09:52.916666772 +0800 53 | +++ gcc/gcc/ipa-utils.h 2022-09-17 03:03:01.389092220 +0800 54 | @@ -30,7 +30,7 @@ 55 | bool new_node; 56 | bool on_stack; 57 | struct cgraph_node* next_cycle; 58 | - PTR aux; 59 | + void *aux; 60 | }; 61 | 62 | 63 | -------------------------------------------------------------------------------- /patches/gcc-5.5.0_compilation-error-with-new-isl-0.20-missing-includes.patch: -------------------------------------------------------------------------------- 1 | --- gcc/gcc/graphite-blocking.c.orig 2015-10-12 18:59:21.000000000 +0800 2 | +++ gcc/gcc/graphite-blocking.c 2022-09-08 04:21:32.728200031 +0800 3 | @@ -29,6 +29,7 @@ 4 | #include 5 | #include 6 | #include 7 | +#include 8 | #endif 9 | 10 | #include "system.h" 11 | --- gcc/gcc/graphite.c.orig 2015-10-12 18:59:21.000000000 +0800 12 | +++ gcc/gcc/graphite.c 2022-09-08 04:22:10.055999612 +0800 13 | @@ -40,6 +40,7 @@ 14 | #include 15 | #include 16 | #include 17 | +#include 18 | #endif 19 | 20 | #include "system.h" 21 | --- gcc/gcc/graphite-dependences.c.orig 2015-10-12 18:59:21.000000000 +0800 22 | +++ gcc/gcc/graphite-dependences.c 2022-09-08 04:22:21.191943353 +0800 23 | @@ -28,6 +28,7 @@ 24 | #include 25 | #include 26 | #include 27 | +#include 28 | #endif 29 | 30 | #include "system.h" 31 | --- gcc/gcc/graphite-interchange.c.orig 2015-10-12 18:59:21.000000000 +0800 32 | +++ gcc/gcc/graphite-interchange.c 2022-09-08 04:22:33.335883774 +0800 33 | @@ -31,6 +31,7 @@ 34 | #include 35 | #include 36 | #include 37 | +#include 38 | 39 | /* Since ISL-0.13, the extern is in val_gmp.h. */ 40 | #if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) 41 | --- gcc/gcc/graphite-isl-ast-to-gimple.c.orig 2017-09-26 07:49:58.000000000 +0800 42 | +++ gcc/gcc/graphite-isl-ast-to-gimple.c 2022-09-08 04:25:20.761229762 +0800 43 | @@ -27,6 +27,8 @@ 44 | #include 45 | #include 46 | #include 47 | +#include 48 | +#include 49 | 50 | /* Since ISL-0.13, the extern is in val_gmp.h. */ 51 | #if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) 52 | --- gcc/gcc/graphite-optimize-isl.c.orig 2015-10-12 18:59:21.000000000 +0800 53 | +++ gcc/gcc/graphite-optimize-isl.c 2022-09-08 04:22:58.199767397 +0800 54 | @@ -30,6 +30,7 @@ 55 | #include 56 | #include 57 | #include 58 | +#include 59 | #endif 60 | 61 | #include "system.h" 62 | --- gcc/gcc/graphite-poly.c.orig 2015-10-12 18:59:21.000000000 +0800 63 | +++ gcc/gcc/graphite-poly.c 2022-09-08 04:23:08.655720637 +0800 64 | @@ -30,6 +30,7 @@ 65 | #include 66 | #include 67 | #include 68 | +#include 69 | 70 | /* Since ISL-0.13, the extern is in val_gmp.h. */ 71 | #if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) 72 | --- gcc/gcc/graphite-scop-detection.c.orig 2015-10-12 18:59:21.000000000 +0800 73 | +++ gcc/gcc/graphite-scop-detection.c 2022-09-08 04:23:24.592651770 +0800 74 | @@ -26,6 +26,7 @@ 75 | #include 76 | #include 77 | #include 78 | +#include 79 | #endif 80 | 81 | #include "system.h" 82 | --- gcc/gcc/graphite-sese-to-poly.c.orig 2015-10-12 18:59:21.000000000 +0800 83 | +++ gcc/gcc/graphite-sese-to-poly.c 2022-09-08 04:25:33.528191191 +0800 84 | @@ -28,6 +28,8 @@ 85 | #include 86 | #include 87 | #include 88 | +#include 89 | +#include 90 | 91 | /* Since ISL-0.13, the extern is in val_gmp.h. */ 92 | #if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) 93 | -------------------------------------------------------------------------------- /patches/gcc-5.5.0_isl-0.21-compat.patch: -------------------------------------------------------------------------------- 1 | --- gcc/gcc/graphite-poly.h.orig 2015-10-12 18:59:21.000000000 +0800 2 | +++ gcc/gcc/graphite-poly.h 2022-09-08 04:44:31.241196060 +0800 3 | @@ -374,7 +374,7 @@ 4 | out dimension of transformed to count the scatterting transform dimension. 5 | */ 6 | #define PBB_NB_LOCAL_VARIABLES(PBB) (0) 7 | -#define PBB_NB_SCATTERING_TRANSFORM(PBB) (isl_map_n_out (PBB->transformed)) 8 | +#define PBB_NB_SCATTERING_TRANSFORM(PBB) (isl_map_dim(PBB->transformed, isl_dim_out)) 9 | #define PBB_IS_REDUCTION(PBB) (PBB->is_reduction) 10 | 11 | extern poly_bb_p new_poly_bb (scop_p, void *); 12 | -------------------------------------------------------------------------------- /patches/gcc-5.5.0_libsanitizer-use-pre-computed-size-of-struct-ustat-for-linux.patch: -------------------------------------------------------------------------------- 1 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2017-02-18 03:23:28.000000000 +0800 2 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2022-09-09 05:19:24.474279496 +0800 3 | @@ -138,7 +138,6 @@ 4 | #include 5 | #include 6 | #include 7 | -#include 8 | #include 9 | #include 10 | #include 11 | @@ -231,7 +230,19 @@ 12 | #endif // SANITIZER_LINUX || SANITIZER_FREEBSD 13 | 14 | #if SANITIZER_LINUX && !SANITIZER_ANDROID 15 | - unsigned struct_ustat_sz = sizeof(struct ustat); 16 | + // Use pre-computed size of struct ustat to avoid which 17 | + // has been removed from glibc 2.28. 18 | +#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ 19 | + || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \ 20 | + || defined(__x86_64__) 21 | +#define SIZEOF_STRUCT_USTAT 32 22 | +#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \ 23 | + || defined(__powerpc__) || defined(__s390__) || defined(__sparc__) 24 | +#define SIZEOF_STRUCT_USTAT 20 25 | +#else 26 | +#error Unknown size of struct ustat 27 | +#endif 28 | + unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT; 29 | unsigned struct_rlimit64_sz = sizeof(struct rlimit64); 30 | unsigned struct_statvfs64_sz = sizeof(struct statvfs64); 31 | #endif // SANITIZER_LINUX && !SANITIZER_ANDROID 32 | -------------------------------------------------------------------------------- /patches/gcc-6.5.0_fix-layout-change-for-nested-std-pair.patch: -------------------------------------------------------------------------------- 1 | Author: Jonathan Wakely 2 | Date: Wed Oct 31 13:03:25 2018 +0000 3 | 4 | PR libstdc++/87822 fix layout change for nested std::pair 5 | 6 | The introduction of the empty __pair_base base class for PR 86751 7 | changed the layout of std::pair, ...>. The outer pair and 8 | its first member both have a base class of the same type, which cannot 9 | exist at the same address. This causes the first member to be at a 10 | non-zero offset. 11 | 12 | The solution is to make the base class depend on the template 13 | parameters, so that each pair type has a different base class type, 14 | which allows the base classes of the outer pair and its first member to 15 | have the same address. 16 | 17 | PR libstdc++/87822 18 | * include/bits/stl_pair.h (__pair_base): Change to class template. 19 | (pair): Make base class type depend on template parameters. 20 | 21 | diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h 22 | index a30b630b4fd..5a4823ab018 100644 23 | --- a/libstdc++-v3/include/bits/stl_pair.h 24 | +++ b/libstdc++-v3/include/bits/stl_pair.h 25 | @@ -183,7 +183,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 26 | }; 27 | #endif // C++11 28 | 29 | - class __pair_base 30 | + template class __pair_base 31 | { 32 | #if __cplusplus >= 201103L 33 | template friend struct pair; 34 | @@ -202,7 +202,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 35 | */ 36 | template 37 | struct pair 38 | - : private __pair_base 39 | + : private __pair_base<_T1, _T2> 40 | { 41 | typedef _T1 first_type; /// @c first_type is the first bound type 42 | typedef _T2 second_type; /// @c second_type is the second bound type 43 | -------------------------------------------------------------------------------- /patches/gcc-6.5.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer.patch: -------------------------------------------------------------------------------- 1 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2018-09-23 16:36:14.000000000 +0800 2 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2022-09-03 23:31:01.513932360 +0800 3 | @@ -1130,8 +1130,9 @@ 4 | #ifndef __GLIBC_PREREQ 5 | #define __GLIBC_PREREQ(x, y) 0 6 | #endif 7 | -#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) 8 | -/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ 9 | +#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) 10 | +/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit 11 | + on many architectures. */ 12 | CHECK_SIZE_AND_OFFSET(ipc_perm, mode); 13 | #endif 14 | 15 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h.orig 2017-06-30 02:26:45.000000000 +0800 16 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2022-09-03 23:31:50.120260677 +0800 17 | @@ -200,27 +200,14 @@ 18 | unsigned __seq; 19 | u64 __unused1; 20 | u64 __unused2; 21 | -#elif defined(__mips__) || defined(__aarch64__) 22 | - unsigned int mode; 23 | - unsigned short __seq; 24 | - unsigned short __pad1; 25 | - unsigned long __unused1; 26 | - unsigned long __unused2; 27 | #elif defined(__sparc__) 28 | -# if defined(__arch64__) 29 | unsigned mode; 30 | - unsigned short __pad1; 31 | -# else 32 | - unsigned short __pad1; 33 | - unsigned short mode; 34 | unsigned short __pad2; 35 | -# endif 36 | unsigned short __seq; 37 | unsigned long long __unused1; 38 | unsigned long long __unused2; 39 | #else 40 | - unsigned short mode; 41 | - unsigned short __pad1; 42 | + unsigned int mode; 43 | unsigned short __seq; 44 | unsigned short __pad2; 45 | #if defined(__x86_64__) && !defined(_LP64) 46 | -------------------------------------------------------------------------------- /patches/gcc-7.5.0_ice-with-return-type-deduction-and-specialization.patch: -------------------------------------------------------------------------------- 1 | From 9ef86762aaf64ca72844962c0dfaa02370b8e3ff Mon Sep 17 00:00:00 2001 2 | From: Jason Merrill 3 | Date: Tue, 13 Feb 2018 10:57:00 -0500 4 | Subject: [PATCH] PR c++/84080 - ICE with return type deduction and 5 | specialization. 6 | 7 | * pt.c (determine_specialization): Check uses_template_parms. 8 | 9 | From-SVN: r257630 10 | 11 | diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c 12 | index 02d448e99b6..222084df4cb 100644 13 | --- a/gcc/cp/pt.c 14 | +++ b/gcc/cp/pt.c 15 | @@ -2203,6 +2203,11 @@ determine_specialization (tree template_id, 16 | specialize TMPL will produce DECL. */ 17 | continue; 18 | 19 | + if (uses_template_parms (targs)) 20 | + /* We deduced something involving 'auto', which isn't a valid 21 | + template argument. */ 22 | + continue; 23 | + 24 | /* Remove, from the set of candidates, all those functions 25 | whose constraints are not satisfied. */ 26 | if (flag_concepts && !constraints_satisfied_p (fn, targs)) 27 | diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C 28 | new file mode 100644 29 | index 00000000000..7de2d9f9e5c 30 | --- /dev/null 31 | +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C 32 | @@ -0,0 +1,6 @@ 33 | +// PR c++/84080 34 | +// { dg-do compile { target c++14 } } 35 | + 36 | +template T foo(); 37 | + 38 | +template <> auto foo<0>() { return 42; } // { dg-error "does not match" } 39 | -------------------------------------------------------------------------------- /patches/gcc-7.5.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer.patch: -------------------------------------------------------------------------------- 1 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2018-05-31 12:59:35.000000000 +0300 2 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2020-02-21 17:13:54.701604294 +0300 3 | @@ -1143,12 +1143,13 @@ 4 | # endif 5 | CHECK_SIZE_AND_OFFSET(ipc_perm, uid); 6 | CHECK_SIZE_AND_OFFSET(ipc_perm, gid); 7 | CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); 8 | CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); 9 | -#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) 10 | -/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ 11 | +#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) 12 | +/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit 13 | + on many architectures. */ 14 | CHECK_SIZE_AND_OFFSET(ipc_perm, mode); 15 | #endif 16 | 17 | CHECK_TYPE_SIZE(shmid_ds); 18 | CHECK_SIZE_AND_OFFSET(shmid_ds, shm_perm); 19 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h.orig 2017-01-10 18:22:56.000000000 +0300 20 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2020-02-21 17:18:49.015379722 +0300 21 | @@ -202,31 +202,18 @@ 22 | #ifdef __powerpc__ 23 | unsigned mode; 24 | unsigned __seq; 25 | u64 __unused1; 26 | u64 __unused2; 27 | -#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) 28 | - unsigned int mode; 29 | - unsigned short __seq; 30 | - unsigned short __pad1; 31 | - unsigned long __unused1; 32 | - unsigned long __unused2; 33 | #elif defined(__sparc__) 34 | -# if defined(__arch64__) 35 | unsigned mode; 36 | - unsigned short __pad1; 37 | -# else 38 | - unsigned short __pad1; 39 | - unsigned short mode; 40 | unsigned short __pad2; 41 | -# endif 42 | unsigned short __seq; 43 | unsigned long long __unused1; 44 | unsigned long long __unused2; 45 | #else 46 | - unsigned short mode; 47 | - unsigned short __pad1; 48 | + unsigned int mode; 49 | unsigned short __seq; 50 | unsigned short __pad2; 51 | #if defined(__x86_64__) && !defined(_LP64) 52 | u64 __unused1; 53 | u64 __unused2; 54 | -------------------------------------------------------------------------------- /patches/gcc-8.3.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer.patch: -------------------------------------------------------------------------------- 1 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2019-02-25 17:41:10.000000000 +0800 2 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2022-09-04 15:40:57.878052309 +0800 3 | @@ -1147,8 +1147,9 @@ 4 | CHECK_SIZE_AND_OFFSET(ipc_perm, gid); 5 | CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); 6 | CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); 7 | -#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) 8 | -/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ 9 | +#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) 10 | +/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit 11 | + on many architectures. */ 12 | CHECK_SIZE_AND_OFFSET(ipc_perm, mode); 13 | #endif 14 | 15 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h.orig 2019-02-25 17:41:10.000000000 +0800 16 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2022-09-04 15:40:57.878052309 +0800 17 | @@ -210,26 +210,13 @@ 18 | u64 __unused1; 19 | u64 __unused2; 20 | #elif defined(__sparc__) 21 | -#if defined(__arch64__) 22 | unsigned mode; 23 | - unsigned short __pad1; 24 | -#else 25 | - unsigned short __pad1; 26 | - unsigned short mode; 27 | unsigned short __pad2; 28 | -#endif 29 | unsigned short __seq; 30 | unsigned long long __unused1; 31 | unsigned long long __unused2; 32 | -#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) 33 | - unsigned int mode; 34 | - unsigned short __seq; 35 | - unsigned short __pad1; 36 | - unsigned long __unused1; 37 | - unsigned long __unused2; 38 | #else 39 | - unsigned short mode; 40 | - unsigned short __pad1; 41 | + unsigned int mode; 42 | unsigned short __seq; 43 | unsigned short __pad2; 44 | #if defined(__x86_64__) && !defined(_LP64) 45 | -------------------------------------------------------------------------------- /patches/gcc-9.2.0_new-glibc-breaks-arm-bootstrap-due-to-libsanitizer.patch: -------------------------------------------------------------------------------- 1 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 2019-10-25 16:50:08.000000000 +0800 2 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc 2022-09-04 17:24:00.963237221 +0800 3 | @@ -1156,8 +1156,9 @@ 4 | CHECK_SIZE_AND_OFFSET(ipc_perm, gid); 5 | CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); 6 | CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); 7 | -#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) 8 | -/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ 9 | +#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) 10 | +/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit 11 | + on many architectures. */ 12 | CHECK_SIZE_AND_OFFSET(ipc_perm, mode); 13 | #endif 14 | 15 | --- gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h.orig 2019-10-25 16:50:08.000000000 +0800 16 | +++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h 2022-09-04 17:24:00.963237221 +0800 17 | @@ -211,26 +211,13 @@ 18 | u64 __unused1; 19 | u64 __unused2; 20 | #elif defined(__sparc__) 21 | -#if defined(__arch64__) 22 | unsigned mode; 23 | - unsigned short __pad1; 24 | -#else 25 | - unsigned short __pad1; 26 | - unsigned short mode; 27 | unsigned short __pad2; 28 | -#endif 29 | unsigned short __seq; 30 | unsigned long long __unused1; 31 | unsigned long long __unused2; 32 | -#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) 33 | - unsigned int mode; 34 | - unsigned short __seq; 35 | - unsigned short __pad1; 36 | - unsigned long __unused1; 37 | - unsigned long __unused2; 38 | #else 39 | - unsigned short mode; 40 | - unsigned short __pad1; 41 | + unsigned int mode; 42 | unsigned short __seq; 43 | unsigned short __pad2; 44 | #if defined(__x86_64__) && !defined(_LP64) 45 | -------------------------------------------------------------------------------- /patches/glibc-2.36_gcc-6-aarch64-compat.patch: -------------------------------------------------------------------------------- 1 | --- glibc-2.36/sysdeps/ieee754/ldbl-128/s_fabsl.c.orig 2022-07-30 06:03:09.000000000 +0800 2 | +++ glibc-2.36/sysdeps/ieee754/ldbl-128/s_fabsl.c 2022-09-01 02:04:58.686720262 +0800 3 | @@ -23,10 +23,18 @@ 4 | #include 5 | #include 6 | #include 7 | +#include 8 | 9 | _Float128 10 | __fabsl (_Float128 x) 11 | { 12 | +#if __GNUC_PREREQ (7, 0) || !defined(__aarch64__) 13 | return __builtin_fabsf128 (x); 14 | +#else 15 | + uint64_t hx; 16 | + GET_LDOUBLE_MSW64(hx,x); 17 | + SET_LDOUBLE_MSW64(x,hx&0x7fffffffffffffffLL); 18 | + return x; 19 | +#endif 20 | } 21 | libm_alias_ldouble (__fabs, fabs) 22 | -------------------------------------------------------------------------------- /patches/glibc-2.36_linux-compat.patch: -------------------------------------------------------------------------------- 1 | --- glibc-2.36/sysdeps/unix/sysv/linux/sys/mount.h.orig 2022-07-30 06:03:09.000000000 +0800 2 | +++ glibc-2.36/sysdeps/unix/sysv/linux/sys/mount.h 2022-08-31 05:37:26.373593717 +0800 3 | @@ -27,77 +27,113 @@ 4 | #include 5 | #include 6 | 7 | -#define BLOCK_SIZE 1024 8 | +#ifdef __has_include 9 | +# if __has_include ("linux/mount.h") 10 | +# include "linux/mount.h" 11 | +# endif 12 | +#endif 13 | + 14 | + 15 | #define BLOCK_SIZE_BITS 10 16 | +#define BLOCK_SIZE (1< 3 | Date: Tue, 14 Jun 2022 19:42:43 -0600 4 | Subject: [PATCH] Revert "Linux: Implement a useful version of _startup_fatal" 5 | 6 | Fixes: 7 | csu/libc-tls.c:202: undefined reference to `_startup_fatal_not_constant' 8 | 9 | This reverts commit 2d05ba7f8ef979947e910a37ae8115a816eb4d08. 10 | 11 | Signed-off-by: James Hilliard 12 | --- 13 | sysdeps/unix/sysv/linux/i386/startup.h | 23 ++++++++++++--- 14 | sysdeps/unix/sysv/linux/ia64/startup.h | 22 --------------- 15 | sysdeps/unix/sysv/linux/startup.h | 39 -------------------------- 16 | 3 files changed, 19 insertions(+), 65 deletions(-) 17 | delete mode 100644 sysdeps/unix/sysv/linux/ia64/startup.h 18 | delete mode 100644 sysdeps/unix/sysv/linux/startup.h 19 | 20 | diff --git a/sysdeps/unix/sysv/linux/i386/startup.h b/sysdeps/unix/sysv/linux/i386/startup.h 21 | index 213805d7d2..67c9310f3a 100644 22 | --- a/sysdeps/unix/sysv/linux/i386/startup.h 23 | +++ b/sysdeps/unix/sysv/linux/i386/startup.h 24 | @@ -1,5 +1,5 @@ 25 | /* Linux/i386 definitions of functions used by static libc main startup. 26 | - Copyright (C) 2022 Free Software Foundation, Inc. 27 | + Copyright (C) 2017-2022 Free Software Foundation, Inc. 28 | This file is part of the GNU C Library. 29 | 30 | The GNU C Library is free software; you can redistribute it and/or 31 | @@ -16,7 +16,22 @@ 32 | License along with the GNU C Library; if not, see 33 | . */ 34 | 35 | -/* Can't use "call *%gs:SYSINFO_OFFSET" during startup. */ 36 | -#define I386_USE_SYSENTER 0 37 | +#if BUILD_PIE_DEFAULT 38 | +/* Can't use "call *%gs:SYSINFO_OFFSET" during statup in static PIE. */ 39 | +# define I386_USE_SYSENTER 0 40 | 41 | -#include_next 42 | +# include 43 | +# include 44 | + 45 | +__attribute__ ((__noreturn__)) 46 | +static inline void 47 | +_startup_fatal (const char *message __attribute__ ((unused))) 48 | +{ 49 | + /* This is only called very early during startup in static PIE. 50 | + FIXME: How can it be improved? */ 51 | + ABORT_INSTRUCTION; 52 | + __builtin_unreachable (); 53 | +} 54 | +#else 55 | +# include_next 56 | +#endif 57 | diff --git a/sysdeps/unix/sysv/linux/ia64/startup.h b/sysdeps/unix/sysv/linux/ia64/startup.h 58 | deleted file mode 100644 59 | index 77f29f15a2..0000000000 60 | --- a/sysdeps/unix/sysv/linux/ia64/startup.h 61 | +++ /dev/null 62 | @@ -1,22 +0,0 @@ 63 | -/* Linux/ia64 definitions of functions used by static libc main startup. 64 | - Copyright (C) 2022 Free Software Foundation, Inc. 65 | - This file is part of the GNU C Library. 66 | - 67 | - The GNU C Library is free software; you can redistribute it and/or 68 | - modify it under the terms of the GNU Lesser General Public 69 | - License as published by the Free Software Foundation; either 70 | - version 2.1 of the License, or (at your option) any later version. 71 | - 72 | - The GNU C Library is distributed in the hope that it will be useful, 73 | - but WITHOUT ANY WARRANTY; without even the implied warranty of 74 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 75 | - Lesser General Public License for more details. 76 | - 77 | - You should have received a copy of the GNU Lesser General Public 78 | - License along with the GNU C Library; if not, see 79 | - . */ 80 | - 81 | -/* This code is used before the TCB is set up. */ 82 | -#define IA64_USE_NEW_STUB 0 83 | - 84 | -#include_next 85 | diff --git a/sysdeps/unix/sysv/linux/startup.h b/sysdeps/unix/sysv/linux/startup.h 86 | deleted file mode 100644 87 | index 39859b404a..0000000000 88 | --- a/sysdeps/unix/sysv/linux/startup.h 89 | +++ /dev/null 90 | @@ -1,39 +0,0 @@ 91 | -/* Linux definitions of functions used by static libc main startup. 92 | - Copyright (C) 2017-2022 Free Software Foundation, Inc. 93 | - This file is part of the GNU C Library. 94 | - 95 | - The GNU C Library is free software; you can redistribute it and/or 96 | - modify it under the terms of the GNU Lesser General Public 97 | - License as published by the Free Software Foundation; either 98 | - version 2.1 of the License, or (at your option) any later version. 99 | - 100 | - The GNU C Library is distributed in the hope that it will be useful, 101 | - but WITHOUT ANY WARRANTY; without even the implied warranty of 102 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 103 | - Lesser General Public License for more details. 104 | - 105 | - You should have received a copy of the GNU Lesser General Public 106 | - License along with the GNU C Library; if not, see 107 | - . */ 108 | - 109 | -#ifdef SHARED 110 | -# include_next 111 | -#else 112 | -# include 113 | - 114 | -/* Avoid a run-time invocation of strlen. */ 115 | -#define _startup_fatal(message) \ 116 | - do \ 117 | - { \ 118 | - size_t __message_length = __builtin_strlen (message); \ 119 | - if (! __builtin_constant_p (__message_length)) \ 120 | - { \ 121 | - extern void _startup_fatal_not_constant (void); \ 122 | - _startup_fatal_not_constant (); \ 123 | - } \ 124 | - INTERNAL_SYSCALL_CALL (write, STDERR_FILENO, (message), \ 125 | - __message_length); \ 126 | - INTERNAL_SYSCALL_CALL (exit_group, 127); \ 127 | - } \ 128 | - while (0) 129 | -#endif /* !SHARED */ 130 | -- 131 | 2.25.1 132 | 133 | --------------------------------------------------------------------------------