Re: Latest Debian package online (including sources)

Bas van Schaik <[email protected]> Tue, 04 Jul 2006 02:43:30 +0200
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
Peter T. Breuer wrote:
> "Also sprach Bas van Schaik:"
>   
>>> Yes. Remove -Os. You can't hope to compile for small size and expect
>>> code to be inlined! Correct kernel compilation needs -O1 or -O2.
>>>   
>>>       
>> Weird, I didn't change anything here, but I'll look at it when I'm
>> somehow near the Debian unstable system. Can you tell me the difference
>> between "-O1" and "-O2", I'll need to choose which one to use.
>>     
>
> I wouldn't worry about it. -O2 is standard. -O1 would be required if
> level 2 optimization somehow went wrong for a module.
>   
OK, will remember that.

> In your kernel source directory Makefile, the optimization level
> should be defined by such things as
>
>   HOSTCFLAGS      = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
>
> However, I see that there is a
>
>   ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
>   CFLAGS          += -Os
>   else
>   CFLAGS          += -O2
>   endif
>   
Why is this option included in that Makefile anyway?

> so make sure that "CONFIG_CC_OPTIMIZE_FOR_SIZE" is not set (huh, how?
> what? where?). Oh .. it's a .config parameter.
>
>    CONFIG_IKCONFIG_PROC=y
>    # CONFIG_CPUSETS is not set
>    CONFIG_INITRAMFS_SOURCE=""
>    # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
>    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    # CONFIG_EMBEDDED is not set
>    CONFIG_KALLSYMS=y
>
>
> and that is configured directly via make config ...
>
>
>   x[ ] Optimize for size (Look out for broken compilers!)  
>
>  CONFIG_CC_OPTIMIZE_FOR_SIZE:                                            x  
>   x                                                                         x  
>   x Enabling this option will pass "-Os" instead of "-O2" to gcc            x  
>   x resulting in a smaller kernel.                                          x  
>   x                                                                         x  
>   x WARNING: some versions of gcc may generate incorrect code with this     x  
>   x option.  If problems are observed, a gcc upgrade may be needed.         x  
>   x                                                                         x  
>   x If unsure, say N.                             
>
>  Symbol: CC_OPTIMIZE_FOR_SIZE [=n]                                       x  
>   x Prompt: Optimize for size (Look out for broken compilers!)              x  
>   x   Defined at init/Kconfig:259                                           x  
>   x   Depends on: ARM || H8300 || EXPERIMENTAL                              x  
>   x   Location:                                                             x  
>   x     -> General setup   
>
> so apparently you only get given that option if "EXPERIMENTAL" is
> configured. Well, don't set it anyway. It isn't a good idea. How come 
> a debian source has it configured?
>   
Don't have a clue, I didn't change those files at all, maybe it's part
of the unstable distribution, I'll try to find out. However, it might be
the best solution to completely remove the "ifdef
CONFIG_CC_OPTIMIZE_FOR_SIZE" statement from the upstream tarball. What
if a user decides to enable the CONFIG_CC_OPTIMIZE_FOR_SIZE directive?
It wouldn't work anyway, so why don't remove it?

-- Bas