On Tue, 2008-09-09 at 19:04 +0300, Adrian Bunk wrote:
I am currently running the kernel compiled with -O0. The final problem
I ran into was some NULL pointer dereference and compiling ONLY files in
the mm directory with -O2 fixed the issue.
To build with -O0 I had to change a few things (for my ARM
architecture):
1. Ensure the __attribute__((always_inline)) was turned off in the
"inline" #define (compiler.h)
2. Fix some inline assembly in kprobes (ARM only) that, due to no
optimization, needed more registers than the compiler had available.
(Similar to this issue:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13850)
3. Implement a fix as described here:
(http://lists.arm.linux.org.uk/lurker/message/20050201.210458.5cc93c10.en.html)
4. Change -O2 to -O0 in the root Makefile
5. Add extra cflags in the mm Makefile so it builds with -O2 only in
that directory.
All of this could, potentially be changed by a configuration parameter
and added into the kernel release. Does someone have a primer on why
this kind of behavior is not desired or "possible"?
Doing this has given me SO much visibility into stack variables data
values while single-stepping the code. I feel that the time invested to
make this work is well worth the return. In the book "Writing Solid
Code" (http://www.amazon.com/Writing-Solid-Code-Microsofts-Programming/dp/1556155514) one technique discussed is: stepping through your code. In order to be able to do this effectively you need optimizations turned off.
--