kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: ydroneaud@opteya.com (Yann Droneaud)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to compile Linux kernel with -O0 flag
Date: Sun, 14 Aug 2016 16:20:31 +0200	[thread overview]
Message-ID: <1471184431.2764.20.camel@opteya.com> (raw)
In-Reply-To: <20160814113126.GA21318@kroah.com>

Hi,

Le dimanche 14 ao?t 2016 ? 13:31 +0200, Greg KH a ?crit?:
> On Sun, Aug 14, 2016 at 07:11:01PM +0800, Hao Lee wrote:
> > 
> > > 
> > > Just out of curiosity - is there a technical reason why -O0
> > > couldn't be used in Linux kernel? I don't know, spinlocks would
> > > not work in this case because it's how GCC was written or
> > > something. Or just nobody compiles and tests kernel like this so
> > > it most likely would not work?
> > > 
[...]
> > Hi, I also like figuring out what's happening in the OS underlying.
> > So I have some ideas about reducing optimization. Although you
> > couldn't turn off optimization completely, you can use both -O2 and
> > other options to reducing optimization as far as possible.
> > You can use -O2 -Q -v to find out which options are enabled when
> > using -O2. Then you can try -O2 -fno-defer-pop -fno-thread-jumps
> > etc. to disable some options. I once used this approach to debug
> > kernel-2.4 in bochs simulator. Unfortunately, this approach could
> > not counteract the effects of -O2 completely, but it's worth a try.
> 
> No, please don't do that.??If you do, you will end up with a
> completly unsuported and unknown system and no one will be able to
> help you out with any sort of problem solving.
> 

And what about -Og which is a dedicated optimization level since GCC
4.8

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-Og-723
https://gcc.gnu.org/gcc-4.8/changes.html

Regards.

--?
Yann Droneaud
OPTEYA

      parent reply	other threads:[~2016-08-14 14:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-13 18:15 How to compile Linux kernel with -O0 flag Aleksander Alekseev
2016-08-13 18:35 ` Greg KH
2016-08-13 18:56   ` Aleksander Alekseev
2016-08-13 19:12     ` Greg KH
2016-08-13 19:15     ` Mike Krinkin
2016-08-14 11:11     ` Hao Lee
2016-08-14 11:31       ` Greg KH
2016-08-14 12:05         ` Hao Lee
2016-08-14 14:20         ` Yann Droneaud [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471184431.2764.20.camel@opteya.com \
    --to=ydroneaud@opteya.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).