Re: [discuss] [2.6 patch] include/asm-x86_64 "extern inline" -> "static inline"

Terrence Miller
2005-09-06T17:56:47Z

Jakub Jelinek wrote:
> On Mon, Sep 05, 2005 at 08:00:05PM +0200, Adrian Bunk wrote:
>
>>It isn't the same, but "static inline" is the correct variant.
>>
>>"extern inline __attribute__((always_inline))" (which is what
>>"extern inline" is expanded to) doesn't make sense.
>
>
> It does make sense and is different from
> static inline __attribute__((always_inline)).
> Try:
> static inline __attribute__((always_inline)) void foo (void) {}
> void (*fn)(void) = foo;
> vs.
> extern inline __attribute__((always_inline)) void foo (void) {}
> void (*fn)(void) = foo;
> In the former case, GCC will emit the out of line static copy of foo
> if you take its address, in the latter case either you provide foo
> function by other means, or you get linker error.
>
> Jakub

Another standards complient way of dealing with extern inline is
for every module that requires an address generates its own
global copy and the link_once (or COMDAT) facility is used to eliminate
all but one.

--

Terrence

****************************************************
| Terrence C. Miller | Sun Microsystems |
| terrence.miller@Sun.COM | M.S. MPK16-303 |
| 650-786-9192 | 16 Network Circle |
| | Menlo Park, CA 94025 |
****************************************************