Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've looked over some of the gcc optimization settings, such as -O2, -O3, etc., and tried to understand exactly what they do. What are some of the best settings to use? Are there any rules of thumb for what settings to use when compiling certain programs or kernels?
i dont know how i can possibly explain it any more simply than the gcc man pages.. but anyways..
-O0 = no optimisation
-O1 = perform optimisations that will not increace compile time significantly
-O2 = perform optimisations that will not increace binary size significantly
-O3 = apply all optimisations
-Os = optimise binary size, (almost as optimised as -O2)
rule of thumb....
if compile time is an issue, use -O1
if binary file size is an issue, but compile time is not, use -O2
if time, nor binary file size is an issue, use -O3
if file size IS an issue, use -Os
if you get seg faults, or have bad hardware, recompile with a lover optimisation.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.