lkml.org 
[lkml]   [2000]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Linux-2.4.0-test9-pre2
Date
Followup to:  <Pine.LNX.4.10.10009171722120.7926-100000@penguin.transmeta.com>
By author: Linus Torvalds <torvalds@transmeta.com>
In newsgroup: linux.dev.kernel
>
> Let's assume that gcc decides that it won't inline a function, because
> it's too "big", according to some gcc definition of "big".
>
> With "extern inline", the function will not exist AT ALL, and you'll end
> up getting a link-time error complaining about the lack of that function.
>
> With "static inline", gcc will emit the function as a separate function
> for that compilation block if it didn't get inlined.
>
> Both are valid things. You use "extern inline" when you have a "backing
> store" for the funcion (ie you do have the non-inlined version in a
> library somewhere). You use "static inline" when you don't.
>
> For the kernel, we very seldom have the non-inlined versions in any
> library, so for the kernel "extern inline" is almost always the wrong
> thing.
>
> Note that with most versions of gcc this is all a complete non-issue, as
> most versions of gcc will _always_ inline a function that the user has
> asked to be inlined. So the issue seldom actually comes up.
>

Well, the major issue is if we want an error message (extern inline)
or potentially majorly bloated code because the same code has been
produced in multiple translation units (static inline). Ideally, the
linker should have some kind of merging pass to merge these multiple
instances -- this really could help C++ template instantiation
problems as well -- but for now, the only "safe" way is pretty much to
provide a library with non-inlined versions and hope nothing gets
linked from it.

-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.592 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site