Re: [PATCH] ia64: Depend on non-static printk for cmpxchg debug

From: Matthew Wilcox
Date: Fri Feb 26 2021 - 08:52:04 EST


On Fri, Feb 26, 2021 at 01:47:20PM +0000, Chris Down wrote:
> Chris Down writes:
> > I must confess I have no idea of the history of why it was `extern int`
> > in the first place -- my fear was somehow we use cmpxchg.h from a
> > different context. Do you have any idea? :-)
>
> Ok, found where it's introduced in the pre-git archives: "New file
> asm-ia64/intrinsics.h." from David Mosberger <davidm@xxxxxxxxxxxxxxxx>, Dec
> 9 2002. No indication why it's extern, but it's been there since the dawn of
> ia64.

It's just a quirk of C. 'extern' is only meaningful when applied to
variables. In the context of functions,

extern int printk(char *fmt);
int printk(char *fmt);

are completely equivalent. Unless (as you've seen) there's then a
static definition following the extern declaration.