From: matthieu castet <castet.matthieu@free.fr>
To: Linux Kernel list <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@suse.de>, "Keith A. Prickett" <keithp@marvell.com>
Subject: re : Building Kernel with -O0
Date: Fri, 12 Sep 2008 22:09:51 +0200 [thread overview]
Message-ID: <48CACC8F.4050806@free.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]
Hi,
last time I check kernel build for x86 and arm with -O0, there was
several issues.
First there some code that rely in function inline and code elimination,
and cause usage of disable symbol at -O0
#ifdef CONFIG_FOO
int foo()
{
}
static inline int toto()
{
}
#else
static inline int toto()
{
return 0
}
#endif
if (toto())
foo();
This doesn't work even when using __always_inline (try to build attached
undec.c at -O0).
Second, I saw problem with swab macro [1].
When using -O0, __OPTIMIZE__ is not defined, and constant initialisation
of some code fails (I don't remeber exactly the case but removing the
defined(__OPTIMIZE__) fix the issue).
Next for x86 there a driver with asm optimisation that fail to build
because gcc fail to allocate register.
And finaly as Andi say there some code doing check if undefined symbol.
For example slab index_of [2]
In the end I build the kernel at -O instead of -O0.
Matthieu
PS : I am not sure __always_inline always work at -O0...
[1]
#if defined(__GNUC__) && defined(__OPTIMIZE__)
# define __swab16(x) \
(__builtin_constant_p((__u16)(x)) ? \
___constant_swab16((x)) : \
__fswab16((x)))
# define __swab32(x) \
(__builtin_constant_p((__u32)(x)) ? \
___constant_swab32((x)) : \
__fswab32((x)))
# define __swab64(x) \
(__builtin_constant_p((__u64)(x)) ? \
___constant_swab64((x)) : \
__fswab64((x)))
#else
# define __swab16(x) __fswab16(x)
# define __swab32(x) __fswab32(x)
# define __swab64(x) __fswab64(x)
#endif /* OPTIMIZE */
[2]
static __always_inline int index_of(const size_t size)
{
extern void __bad_size(void);
if (__builtin_constant_p(size)) {
int i = 0;
#define CACHE(x) \
if (size <=x) \
return i; \
else \
i++;
#include <linux/kmalloc_sizes.h>
#undef CACHE
__bad_size();
} else
__bad_size();
return 0;
}
[-- Attachment #2: undec.c --]
[-- Type: text/x-csrc, Size: 107 bytes --]
static inline __attribute__((always_inline)) int foo()
{
return 0;
}
int main()
{
if (foo())
bar();
}
reply other threads:[~2008-09-12 20:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=48CACC8F.4050806@free.fr \
--to=castet.matthieu@free.fr \
--cc=ak@suse.de \
--cc=keithp@marvell.com \
--cc=linux-kernel@vger.kernel.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