From: krinkin.m.u@gmail.com (Mike Krinkin)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to compile Linux kernel with -O0 flag
Date: Sat, 13 Aug 2016 22:15:47 +0300 [thread overview]
Message-ID: <20160813191543.GA21748@gmail.com> (raw)
In-Reply-To: <20160813215605.1749468e@e733>
On Sat, Aug 13, 2016 at 09:56:05PM +0300, Aleksander Alekseev wrote:
> > The kernel will not run with -O0, sorry, just live with the build
> > optimization levels that is currently used and you should be fine.
>
> Oh, I see. Fortunately I'm not afraid of assembler :) Thanks.
>
> 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?
Just fixed Makefile and tried to build it with -O0, it doesn't even
compile, i got errors like this:
./include/linux/compiler-gcc.h:243:38: error: impossible constraint in ?asm?
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
^
./arch/x86/include/asm/cpufeature.h:146:3: note: in expansion of macro ?asm_volatile_goto?
asm_volatile_goto("1: jmp 6f\n"
Probably gcc cannot figure out that an macro argument can be evaluated at
compile time with optimizations disabled.
>
> > But why do you want to use a debugger on the kernel? That's not a
> > normal task unless you are bringing up a new hardware platform.
>
> It's just something I always do when I learn new things. Trying to
> figure out how to debug something in this new environment. No real task
> so far.
>
> --
> Best regards,
> Aleksander Alekseev
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2016-08-13 19:15 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 [this message]
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
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=20160813191543.GA21748@gmail.com \
--to=krinkin.m.u@gmail.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).