gcc optimization options and lto (detailed info)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

In order to attempt to get LTO implemented in Zephyr OS I need a better understanding of the GCC optimization options.


I do not yet have an understanding either where in the Zephyr OS build LTO is problematic and and how it could be solved.


I now start from the GCC side first, to understand the options I / we have.


From https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html I understand the following:

 

* -O<x> combines a collection of -f<xyz>


* There is a long list of single optimizations which probably could be set individually

 

What is not clear to me:


* does every -f<xyz> have a -fno-<xyz>?


* would I be able able to disable single optimizations activated via -O<x> using -fno-<xyz> after -O<x>?


* When LTO is enabled, are the optimizations only effective at link time and not during the compilation into IR (GIMPLE)?


* Or are the optimizations effective in different stages of the build process? Are there information which options is applied when?


* From armclang we have an experience, where a const parameter from a parameter block was optimized as const value embedded into the code rendering the flash parameter block useless.

We were able to solve that by declaring the const parameter pointer as volatile by good guessing and try and error methodology, but also leaves a good level of uncertainty.


Are there information available what the different optimizations do (which I know, is a long list) and how such unwanted optimization can be avoided respective the unwanted effects of the optimizations


  * by writing the code accordingly (e.g. delcaring variables volatile or similar)


  * by attributing the code section accordingly (suppressing certain optimizations for that code part)


  * by simply disabling the optimization via compiler/linker cmd-line (-fno-<xyz>) for the different code files/modules (would that have an effect on modules/files for LTO at all or will it be treated as one big "module" rendering single file options useless?


* Since there is a rather long list of optimization 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.


Creating a header file full of pragma GCC (which then is not generic but compiler specific) and the header being included in each compiler unit (C-File) seems very ugly to me.


I would appreciate any help also pointing to documentation which would clarify.


Best Roman




⁣Get BlueMail for Android ​




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux