RE: O2 flag in compilation

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

 



On Tue, 23 Oct 2001, Christine Ames wrote:

> Snipped from "man gcc":
<snip>

I can't imagine anyone attempting kernel programming (including me)
without knowing about the optimisation flags.  My question was why this
level is *needed* for modules, and not, say, -O3.


On Tue, 23 Oct 2001, Erik Mouw wrote:

> The most important is the compiler uses -finline in this particular
> case, so it does indeed pay attention to the 'inline' keyword. Without
> that, it won't and that's exactly the reason why modules compiled
> without -O2 fail to link or load.

Now this answers the question, thanks.  However, it makes me wonder if
optimisations like -O3 wouldn't also work?

Also, if I made a monolithic kernel would the lack of the -finline flag
matter?  Resolving symbols might fail for modprobe if I were building
modules, but the static linker should be fine shouldn't it?  (this is a
purely academic question as I always use modules)

> > -O3
> > Optimize yet more. This turns on everything -O2 does, along with also
> > turning on -finline-func*- tions.
>
> And it also enables -funroll-all-loops which isn't too smart. In most
> of the cases -O3 actually generates *slower* code than -O2 because
> unrolling all loops makes the code larger so it won't fit in the
> I-cache anymore. To give you an idea how expensive a cache miss is: on
> StrongARM CPU a single cache miss costs you about 60 cycles.

This shows that -O3 will be slower, but will it still work?


TIA,
Paul Gearon

Software Engineer                Telephone:   +61 7 3876 2188
Plugged In Software              Fax:         +61 7 3876 4899
http://www.PIsoftware.com        PGP Key available via finger

Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum
immane mittam.
(Translation from latin: "I have a catapult. Give me all the money,
or I will fling an enormous rock at your head.")



-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux