[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070524180704.GE4470@stusta.de>
Date: Thu, 24 May 2007 20:07:04 +0200
From: Adrian Bunk <bunk@...sta.de>
To: Roland Dreier <rdreier@...co.com>
Cc: Rob Landley <rob@...dley.net>,
Arjan van de Ven <arjan@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: Re: Status of CONFIG_FORCED_INLINING?
On Thu, May 24, 2007 at 10:55:34AM -0700, Roland Dreier wrote:
> > And if you #include a non-inlined definition in two .c files, the compiler
> > will emit two copies into two separate .o files. What you're hoping is that
> > the linker will notice they're identical and merge them, and last I checked I
> > couldn't even reliably get it to do that with constant strings.
>
> No, I don't care if the linker merges it or not. In fact I hope that
> maybe the compiler is smart enough to optimize the function for the
> sites it's called from in a particular .c file.
>
> But a function defined in a .h file had better be static, so it
> shouldn't matter if there are two copies of it in the final linked
> image (any more than it matters if there are 100 inlined copies of it).
The problem is that inline functions in headers are intended to be
called from different C files.
gcc might not inline it in the C files where it is called more than
once.
But it will always inline it if it's called only once.
One of both will be suboptimal, but from gcc's perspective it was
optimal.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists