This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Built kernel without -O2 option
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Hui Zhu <teawater at gmail dot com>
- Cc: linux-kernel at vger dot kernel dot org, gdb at sourceware dot org, hellogcc at freelists dot org
- Date: Mon, 29 Nov 2010 20:05:46 +0100
- Subject: Re: [PATCH] Built kernel without -O2 option
- References: <AANLkTimewZ4QhxzL2vOYYV85pegy8Fu6Rb4XUAPqGUXS@mail.gmail.com>
On Mon, 29 Nov 2010 04:56:15 +0100, Hui Zhu wrote:
> So I make a patch that add a option in "Kernel hacking" called "Close
> GCC optimization". It will make kernel be built without -O2.
This seems to me as a workaround. The real fix would be to use
__attribute__((always_inline))
for functions requiring to be inlined and just compile everything with -O0 -g.
info '(gcc)Function Attributes'
`always_inline'
Generally, functions are not inlined unless optimization is specified.
For functions declared inline, this attribute inlines the function
even if no optimization level was specified.
But `always_inline' has been discussed on linux-kernel million times.
I have not googled out a resolution why it is not applicable to this problem,
do you know why?
Thanks,
Jan