public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Linux kernel support -O0 optimization flag?
@ 2013-04-15  7:58 Ley Foon Tan
  2013-04-15 11:16 ` richard -rw- weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Ley Foon Tan @ 2013-04-15  7:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kenneth Chong Yin Tan



Change KBUILD_CFLAGS to -O0 in Makefile and got the compilation error as
below.
Is the Linux kernel support -O0 optimization flag?
Note, I have tried 2 architecture compilers and got the same error.



In function 'zap_pmd_range',

    inlined from 'zap_pud_range' at mm/memory.c:1288:8,

    inlined from 'unmap_page_range' at mm/memory.c:1313:8:

mm/memory.c:1243:23: error: call to '__build_bug_failed' declared with
attribute error: BUILD_BUG failed

make[1]: *** [mm/memory.o] Error 1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linux kernel support -O0 optimization flag?
  2013-04-15  7:58 Linux kernel support -O0 optimization flag? Ley Foon Tan
@ 2013-04-15 11:16 ` richard -rw- weinberger
  2013-04-16  6:10   ` Ley Foon Tan
  2013-04-24  8:29   ` Pavel Machek
  0 siblings, 2 replies; 4+ messages in thread
From: richard -rw- weinberger @ 2013-04-15 11:16 UTC (permalink / raw)
  To: Ley Foon Tan; +Cc: LKML, Kenneth Chong Yin Tan

On Mon, Apr 15, 2013 at 9:58 AM, Ley Foon Tan <lftan@altera.com> wrote:
>
>
> Change KBUILD_CFLAGS to -O0 in Makefile and got the compilation error as
> below.
> Is the Linux kernel support -O0 optimization flag?

No. If I'm not mistaken we need this to make sure that the compiler
inlines some functions.

In your case the compiler failed to compute the BUILD_BUG() macro correctly.
It depends also on optimization.

--
Thanks,
//richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linux kernel support -O0 optimization flag?
  2013-04-15 11:16 ` richard -rw- weinberger
@ 2013-04-16  6:10   ` Ley Foon Tan
  2013-04-24  8:29   ` Pavel Machek
  1 sibling, 0 replies; 4+ messages in thread
From: Ley Foon Tan @ 2013-04-16  6:10 UTC (permalink / raw)
  To: richard -rw- weinberger; +Cc: LKML, Kenneth Chong Yin Tan

On Mon, 2013-04-15 at 13:16 +0200, richard -rw- weinberger wrote:

> No. If I'm not mistaken we need this to make sure that the compiler
> inlines some functions.
> 
> In your case the compiler failed to compute the BUILD_BUG() macro correctly.
> It depends also on optimization.
> 
Thank you.
So, the supported optimization flags are -O1, -O2, -O3 and -Os?

Regards
LFTAN


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linux kernel support -O0 optimization flag?
  2013-04-15 11:16 ` richard -rw- weinberger
  2013-04-16  6:10   ` Ley Foon Tan
@ 2013-04-24  8:29   ` Pavel Machek
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2013-04-24  8:29 UTC (permalink / raw)
  To: richard -rw- weinberger; +Cc: Ley Foon Tan, LKML, Kenneth Chong Yin Tan

On Mon 2013-04-15 13:16:36, richard -rw- weinberger wrote:
> On Mon, Apr 15, 2013 at 9:58 AM, Ley Foon Tan <lftan@altera.com> wrote:
> >
> >
> > Change KBUILD_CFLAGS to -O0 in Makefile and got the compilation error as
> > below.
> > Is the Linux kernel support -O0 optimization flag?
> 
> No. If I'm not mistaken we need this to make sure that the compiler
> inlines some functions.
> 
> In your case the compiler failed to compute the BUILD_BUG() macro correctly.
> It depends also on optimization.

Actually... You probably could replace BUILD_BUG() with nop. Bugs are
not expected to happen, right? you'll probably hit something else...

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-24  8:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-15  7:58 Linux kernel support -O0 optimization flag? Ley Foon Tan
2013-04-15 11:16 ` richard -rw- weinberger
2013-04-16  6:10   ` Ley Foon Tan
2013-04-24  8:29   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox