Compiling GNU/Linux with -O3 optimization

It's claimed that compiling GNU tools and also Linux kernel with -O3 gcc optimization alternative will certainly generate unusual and also fashionable pests. Is it real? Has any person attempted it or is it simply a scam?

0
2019-05-04 05:54:45
Source Share
Answers: 5

While you can escape making use of -O3 and also various other optimizations handles on the majority of applications (and also it can cause rate renovations), I would certainly wait to make use of such tweaks the kernel itself or on the device chain needed for constructing it (compiler, binutils, etc).

Think of it : Is a 5% efficiency gain of the raid and also ext3 subsystems worth system collisions or possible information loss and/or corruption?

Fine-tune all the handles to desire for that Quake port you're playing or the audio/video codecs you make use of for tearing your DVD collection to divx documents. You'll likely see a renovation. Simply do not mess w/ the kernel unless you have time to waste and also information you can birth to shed.

0
2019-05-08 04:39:08
Source

- O3 makes use of some hostile optimizations that are just secure if particular presumptions concerning register usage, just how pile structures are connected with, and also function reentrancy hold true, and also these presumptions are not assured to be real in some code like the kernel specifically when inline setting up is made use of (as it remains in some really reduced degree components of the kernel and also its vehicle driver components).

0
2019-05-08 04:37:42
Source

Note that huge portions of the toolchain (glibc specifically) all out do not compile if you transform optimization degrees. The construct system is arrangement to overlook your -O choices for these areas on the majority of rational distros.

Put simply, particular basic collection and also OS attributes rely on the code in fact doing what it claims, not what would certainly be much faster in a lot of cases. -fgcse-after-reload specifically (made it possible for by -O3) can create weird concerns.

0
2019-05-08 03:34:50
Source

It's made use of in Gentoo, and also I really did not see anything uncommon.

0
2019-05-08 01:22:27
Source

-O3 has numerous negative aspects :

  1. First of all it usually generates slower code than -O2 or -Os. Occasionally it generates longer code as a result of loop unrolling which might remain in reality slower as a result of even worse cache performance of code.
  2. As it was claimed it occasionally generates incorrect code. It might be either as a result of mistake in optimalization or mistake in code (like overlooking rigorous aliasing). As kernel code occasionally is and also occasionally need to be 'clever' I would certainly claim it is feasible that some kernel programmer made some mistake. I experienced numerous weird troubles, like collapsing of userspace energies, when I assembled kernel with gcc 4.5 which then was secure. I still make use of gcc 4.4 for kernel and also numerous picked userspace energies as a result of numerous pests. The very same might look for -O3.
  3. I do not assume it supplies much advantage for the Linux kernel. The kernel does refrain hefty calculations and also in position it does, it is maximized with setting up. -O3 flag will certainly not transform the price of context changing or rate of I/O. I do not assume something like < 0.1% speedup of total performance deserves it.
0
2019-05-08 01:15:28
Source