Re: [patch 00/2] improve .text size on gcc 4.0 and newer compilers

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

 



On Mon, Jan 02, 2006 at 07:51:32PM +0100, Arjan van de Ven wrote:
> On Mon, 2006-01-02 at 19:44 +0100, Krzysztof Halasa wrote:
> > Ingo Molnar <[email protected]> writes:
> > 
> > > what is the 'deeper problem'? I believe it is a combination of two 
> > > (well-known) things:
> > >
> > >   1) people add 'inline' too easily
> > >   2) we default to 'always inline'
> > 
> > For example, I add "inline" for static functions which are only called
> > from one place.
> 
> you know what? gcc inlines those automatic even without you typing
> "inline". (esp if you have unit-at-a-time enabled)

Rubbish it will.

static void fn1(void *f)
{
}

void fn2(void *f)
{
        fn1(f);
}

on ARM produces:

        .text
        .align  2
        .type   fn1, %function
fn1:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        @ lr needed for prologue
        mov     pc, lr
        .size   fn1, .-fn1
        .align  2
        .global fn2
        .type   fn2, %function
fn2:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        @ lr needed for prologue
        b       fn1
        .size   fn2, .-fn2
        .ident  "GCC: (GNU) 3.3 20030728 (Red Hat Linux 3.3-16)"

You can't get a simpler function than fn1 to automatically inline.

GCC will only automatically inline using -O3.  We don't use -O3 with
the kernel - only -O2 and -Os.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux