Re: how to build kernel with -O option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008/10/30 loody <miloody@xxxxxxxxx>:
> 2008/10/29 Henrik Austad <henrik@xxxxxxxxx>:
>> On Wednesday 29 October 2008 14:10:33 loody wrote:
>>> Dear all:
>>> I try to build a kernel with -O and I try to modify below lines in
>>> Makefile:
>>>
>>> ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>>> KBUILD_CFLAGS   += -O
>>> else
>>> KBUILD_CFLAGS   += -O
>>> endif
>>
>> With -O, the compiler tries to reduce code size and execution time, without
>> performing any optimizations that take a great deal of compilation time.
>>
>> As to why this fails, I don't know. When I change my Makefile to reflect
>> yours, and run a build with defconfig, It compiles without errors
>>
Hi:
I use gcc to compile normal linux kernel and it really works as you mentioned.
I check where my problem come from.

the compile complain he cannot find the function call,
"__you_cannot_kmalloc_that_much." as below:
include/linux/slab_def.h:48: undefined reference to
`__you_cannot_kmalloc_that_much'
......
I grep the kernel source code, no matter normal linux or uclinux I
download, there is no definition of function call
"__you_cannot_kmalloc_that_much" in them.
(below are the results I get:
/media/sda6/uclinux/uClinux-dist/linux-2.6.x$ find . -type f -iname
'*.[ch]' | xargs grep -n '__you_cannot_kmalloc_that_much'
./include/linux/slab_def.h:47:                  extern void
__you_cannot_kmalloc_that_much(void);
./include/linux/slab_def.h:48:
__you_cannot_kmalloc_that_much();
./include/linux/slab_def.h:81:                  extern void
__you_cannot_kmalloc_that_much(void);
./include/linux/slab_def.h:82:
__you_cannot_kmalloc_that_much();
/media/sda6/uclinux/uClinux-dist/linux-2.6.x$

[root@localhost linux-2.6.16.2]# find . -type f -iname '*.[ch]' |
xargs grep -n '__you_cannot_kmalloc_that_much'
./include/linux/slab.h:100:                        extern void
__you_cannot_kmalloc_that_much(void);
./include/linux/slab.h:101:
__you_cannot_kmalloc_that_much();
[root@localhost linux-2.6.16.2]#

This makes me more curious about this problem.
In the beginning, I thought maybe uclinux change some prototype to
meet his requirement, since the .h file in uclinux called slab_def.h
instead of slab.h in normal kernel.
But I find both of them don't define the function.

I know the unoptimized kernel is pretty big and useless under
practical situation but I want to trace assembly code of kernel and
the optimization will make me confuse.
Would someone have the problem before or find I lost something to set,
please let me know.
appreciate your kind help,

miloody

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux