Re: [GIT PULL] x86 LTO changes for v3.15

From: Linus Torvalds
Date: Mon Mar 31 2014 - 17:54:31 EST


On Mon, Mar 31, 2014 at 2:05 PM, H. Peter Anvin <hpa@xxxxxxxxxxxxxxx> wrote:
> diff --git a/include/linux/linkage.h b/include/linux/linkage.h
> index a6a42dd..34a513a 100644
> --- a/include/linux/linkage.h
> +++ b/include/linux/linkage.h
> @@ -12,9 +12,9 @@
> #endif
>
> #ifdef __cplusplus
> -#define CPP_ASMLINKAGE extern "C"
> +#define CPP_ASMLINKAGE extern "C" __visible
> #else
> -#define CPP_ASMLINKAGE
> +#define CPP_ASMLINKAGE __visible
> #endif

This seems to result in new warnings, and they appear to be valid.

We have things like

arch/x86/crypto/sha1_ssse3_glue.c:43:1: warning:
âexternally_visibleâ attribute have effect only on public objects
[-Wattributes]
static asmlinkage void (*sha1_transform_asm)(u32 *, const char *,
unsigned int);
^

and it seems to be because "asmlinkage" now means "visible", which is
utter BS. "asmlinkage" is about the calling convention, and visibility
is about something completely different.

So the compiler is actually correct in warning about insane code.
You're basically saying "static" + "visible", which makes no sense.
But "static" + "asmlinkage void (*)" makes sense, because it's about
the "void (*)" being a function with asmlinkage calling convention.

So I think that adding "visible" to asmlinkage is actively wrong and
misguided. And the compiler even told you so, but somebody then chose
to ignore the compiler telling them that they did stupid things.

Don't do crap like this.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/