Subject: Re: linux-next: build warning after merge of the tip tree

From: Andrew Morton <[email-masked]>
Date: Sun, 23 Feb 2014 22:12:17 -0800

On Mon, 24 Feb 2014 16:56:21 +1100 Stephen Rothwell <[email-masked]> wrote:

> Hi all,
> 
> On Mon, 24 Feb 2014 15:17:32 +1100 Stephen Rothwell <[email-masked]> wrote:
> >
> > I guess that there may be more places where "asmlinkage" is used with
> > "static" - I assume that they are all incorrect?
> > 
> > $ git grep -l 'static.*asmlinkage'
> > arch/x86/crypto/sha1_ssse3_glue.c
> > arch/x86/crypto/sha256_ssse3_glue.c
> > arch/x86/crypto/sha512_ssse3_glue.c
> 
> In fact, my x86_64 allmodconfig build produces these:
> 
> 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);
>  ^
> arch/x86/crypto/sha256_ssse3_glue.c:56:1: warning: 'externally_visible' attribute have effect only on public objects [-Wattributes]
>  static asmlinkage void (*sha256_transform_asm)(const char *, u32 *, u64);
>  ^
> arch/x86/crypto/sha512_ssse3_glue.c:55:1: warning: 'externally_visible' attribute have effect only on public objects [-Wattributes]
>  static asmlinkage void (*sha512_transform_asm)(const char *, u64 *, u64);
>  ^
> mm/process_vm_access.c:422:1: warning: 'externally_visible' attribute have effect only on public objects [-Wattributes]
>  {
>  ^
> 
> That last is added by commit 700d00f85598 ("mm/process_vm_access.c: mark
> function as static") from the akpm-current tree.
> 
> So is "static asmlinkage" not allowed?

Doh, I missed that.  I don't know if it's "allowed" or not, but it's
clearly the wrong thing to do - the whole point of asmlinkage is to
export the thing to other compilation units.

So I suppose this:

mm/process_vm_access.c:416:1: warning: no previous prototype for `compat_process_vm_rw' [-Wmissing-prototypes]

should be squashed by giving it a prototype.  Something like

--- a/include/linux/compat.h~a
+++ a/include/linux/compat.h
@@ -644,6 +644,13 @@ asmlinkage ssize_t compat_sys_mq_timedre
 asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
 asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args);
 
+asmlinkage ssize_t compat_process_vm_rw(compat_pid_t pid,
+		     const struct compat_iovec __user *lvec,
+		     unsigned long liovcnt,
+		     const struct compat_iovec __user *rvec,
+		     unsigned long riovcnt,
+		     unsigned long flags, int vm_write);
+
 extern ssize_t compat_rw_copy_check_uvector(int type,
 		const struct compat_iovec __user *uvector,
 		unsigned long nr_segs,
_