From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by sourceware.org (Postfix) with ESMTPS id 8F28E3857822 for ; Tue, 17 May 2022 06:56:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F28E3857822 X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [10.17.154.74] ([178.197.213.74]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MXXuH-1oO74M2lzD-00Yxrj for ; Tue, 17 May 2022 08:56:21 +0200 User-Agent: Android X-Is-Generated-Message-Id: true MIME-Version: 1.0 Subject: gcc optimization options and lto (detailed info) From: "muzungu@gmx.net" Date: Tue, 17 May 2022 08:56:20 +0200 To: gcc-help@gcc.gnu.org Message-ID: <062812e4-e912-4eaf-876c-91006a6c47a6@gmx.net> X-Provags-ID: V03:K1:5+xVdJ2kFUtr5neYXvbBZZoieI4m/I4rT4ZCu+TwxU007CD3n5y whZS7P9ghpYgiGadtTSn0lOBWwzkFBzR4c0Wr/Fjcp+HjOasggTbo7+i8VzYcnIrxWj6Bq1 n2rSAlkL/Ua1/qPNH3rt8dGNqHfr3UgqWkTNXNxRciNu+mfYUH9CH5nuF8Go5DMj8gL5ib3 vNqoDcHn8TaZRIUFYFMpQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:8Yy7/meDlKY=:196aXo4ZaKapSanxydLV7O DITqiz9dXcVwmEjLYP1h9T3rCFCHPMzywc+uyxL6eCKkw+lFpsopdYTnw9MPeWMiZKnhGapkX nIMhOx/h/zTO+iHwk/v3g7h1STYqYNy9PoBKTUqIRTCDkTN037YsSQ7TfPFJ+A6S/jcVINFyk F7/g7Q3PQUBxx+M6TqQYfc0Ce1FYEQROXkqTtGxcKcroqtwdx+Ht7d8vqjYsw9i1AaX1mcDif Sy3EHZq+HU1W3bBQHd9xl+D810zUx0ez8D10v7pxxrngp071bPAl4dPYfYgvDHswvnkSvz8En DowfjvyudcQKITThPt0DSlrlXZXEzUFHHkrBXw3ulpOjZVSWshVyNltpD6mm0nWnKdlAFy9Me rVVMITUgcD4KvZiw/jsLYNTgUZJp8iUMB1P4dtFAGtwLBzpV3nxbbpLCCl75w2UScfyqaSwGd Rp0Rb+sZFSX1iD8MZikXvvirGJwZIhu4RvkYaCvHFhOzNwDCH6LSnAo4N9yuC+lteLNveTiLQ X83kkEmMehbfwBDl/Ql1JYB+7W5xKM/zJBY/3paAge7EWdxzjQ+XEz5WlU/0jKxVJzKOB1Yc9 3AFCNSt2Rv+yjZ+pVJL48Hmw5LTzE/yQjXnKojUbNDRuTbJXP8mSqOHG4vZEy84RK1G4xOeF9 S1vLJoFHQ/tNG1jl10o/bQdAnTyZxFz9Jw2wnhSKJDxX9LGsBTQyo9QtOCt59ctuCnalbvlKw bCtlLP/+F9We4TRp/lYjA6X0BMtP774NIuvsizG8xj0yWA8nFpAUCTI2I/tvUsF68236ho1Nx M6ilve1HoI+8wlXYwS557uMuYX5bYi1OxXLGC4AHe7FWXBxjxJerVCs62JeLS6pQIeVB5AOIv Klo9lbmkcelLRu4XTXZjGKzj0l4DTfQDZ5Y158lUgU2E8lc/W6NfOEXkVUDxId4ybWdCn+eCU VVx7qB56ODE+smNjgEIXWCy43WYEC0KfGpl+OaayzdYAuEtJI8F4hYsDSjn4C3S3RHzcGlQph 1td5X2xzjfcDUkVw87IKEqsA/3Dp/san158vr+8OKKi57nnEYfDjK7fB2ped5lytdte5GJaE2 fbU/zejpMADrVE= X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, KAM_INFOUSMEBIZ, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2022 06:56:26 -0000 Hi In order to attempt to get LTO implemented in Zephyr OS I need a better= understanding of the GCC optimization options=2E I do not yet have an un= derstanding either where in the Zephyr OS build LTO is problematic and and = how it could be solved=2E I now start from the GCC side first, to underst= and the options I / we have=2E From=C2=A0https://gcc=2Egnu=2Eorg/onlinedo= cs/gcc/Optimize-Options=2Ehtml=C2=A0I understand the following: =C2=A0 * = -O combines a collection of -f * There is a long list of single o= ptimizations which probably could be set individually =C2=A0 What is not = clear to me: * does every -f have a -fno-? * would I be able = able to disable single optimizations activated via -O using -fno- a= fter -O? * When LTO is enabled, are the optimizations only effective a= t link time and not during the compilation into IR (GIMPLE)? * Or are the= optimizations effective in different stages of the build process? Are ther= e information which options is applied when? * From armclang we have an e= xperience, where a const parameter from a parameter block was optimized as = const value embedded into the code rendering the flash parameter block usel= ess=2E We were able to solve that by declaring the const parameter pointer= as volatile by good guessing and try and error methodology, but also leave= s a good level of uncertainty=2E Are there information available what the= different optimizations do (which I know, is a long list) and how such unw= anted optimization can be avoided respective the unwanted effects of the op= timizations =C2=A0 * by writing the code accordingly (e=2Eg=2E delcaring = variables volatile or similar) =C2=A0 * by attributing the code section a= ccordingly (suppressing certain optimizations for that code part) =C2=A0 = * by simply disabling the optimization via compiler/linker cmd-line (-fno-<= xyz>) for the different code files/modules (would that have an effect on mo= dules/files for LTO at all or will it be treated as one big "module" render= ing single file options useless? * Since there is a rather long list of o= ptimization options which would very likely exceed the command line length,= what is the solution to activate a custom set of optimzations? I could not= find a --configfile option or similar to replace the command line=2E Cre= ating a header file full of pragma GCC (which then is not generic but compi= ler specific) and the header being included in each compiler unit (C-File) = seems very ugly to me=2E I would appreciate any help also pointing to doc= umentation which would clarify=2E Best Roman =E2=81=A3Get BlueMail fo= r Android =E2=80=8B