[lkml]   [2012]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: How can I turn off/disable -O2/-Os optimization?
On 04/01/2012 09:31 AM, Zhihua Che wrote:

> Hi, everyone
> I'm debugging linux kernel using kgdb/qemu, but I find that the
> execution order didn't math the program order usually. I guess it was
> because the compiling optimization. So I decided to remove -O options
> in Makefiles.
> First I removed -Ox in variables HOSTCFLAGS/HOSTCXXFLAGS in
> <src_root_dir>/Makefile around line 248 and -Ox in variable
> KBUILD_CFLAGS in <src_root_dir>/arch/x86/boot/Makefile around line 55.
> But it didn't work, the step execution still didn't follow the program
> order. Then I found I missed -Ox in KBUILD_CFLAGS in
> <src_root_dir>/Makefile around line 562, so I removed them, but this
> time, the compiling failed, complaining
> rcupdate.h:917:2: error: size of unnamed array is negative
> And finally, after grep, I find there are a load of -O2 option are
> assigned in a load of Makefiles. So, How could I disable -O
> optimization for debugging?
> Thanks for any tips
> --

You could try the new CONFIG_READABLE_ASM patch:

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2012-04-01 18:53    [W:0.094 / U:22.976 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site