All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Stefan Agner <stefan@agner.ch>
Cc: stable@vger.kernel.org,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Martin Sebor <msebor@gcc.gnu.org>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH BACKPORT 4.19 1/2] Compiler Attributes: add support for __copy (gcc >= 9)
Date: Tue, 4 Jun 2019 16:41:06 +0200	[thread overview]
Message-ID: <20190604144106.GA29518@kroah.com> (raw)
In-Reply-To: <20190604132441.15383-1-stefan@agner.ch>

On Tue, Jun 04, 2019 at 03:24:40PM +0200, Stefan Agner wrote:
> From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> 
> [ Upstream commit c0d9782f5b6d7157635ae2fd782a4b27d55a6013 ]
> 
> >From the GCC manual:
> 
>   copy
>   copy(function)
> 
>     The copy attribute applies the set of attributes with which function
>     has been declared to the declaration of the function to which
>     the attribute is applied. The attribute is designed for libraries
>     that define aliases or function resolvers that are expected
>     to specify the same set of attributes as their targets. The copy
>     attribute can be used with functions, variables, or types. However,
>     the kind of symbol to which the attribute is applied (either
>     function or variable) must match the kind of symbol to which
>     the argument refers. The copy attribute copies only syntactic and
>     semantic attributes but not attributes that affect a symbol’s
>     linkage or visibility such as alias, visibility, or weak.
>     The deprecated attribute is also not copied.
> 
>   https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
> 
> The upcoming GCC 9 release extends the -Wmissing-attributes warnings
> (enabled by -Wall) to C and aliases: it warns when particular function
> attributes are missing in the aliases but not in their target, e.g.:
> 
>     void __cold f(void) {}
>     void __alias("f") g(void);
> 
> diagnoses:
> 
>     warning: 'g' specifies less restrictive attribute than
>     its target 'f': 'cold' [-Wmissing-attributes]
> 
> Using __copy(f) we can copy the __cold attribute from f to g:
> 
>     void __cold f(void) {}
>     void __copy(f) __alias("f") g(void);
> 
> This attribute is most useful to deal with situations where an alias
> is declared but we don't know the exact attributes the target has.
> 
> For instance, in the kernel, the widely used module_init/exit macros
> define the init/cleanup_module aliases, but those cannot be marked
> always as __init/__exit since some modules do not have their
> functions marked as such.
> 
> Cc: <stable@vger.kernel.org> # 4.14+
> Suggested-by: Martin Sebor <msebor@gcc.gnu.org>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  include/linux/compiler-gcc.h   | 4 ++++
>  include/linux/compiler_types.h | 4 ++++
>  2 files changed, 8 insertions(+)

Thanks for this, and the 4.14 updated series, I've applied them all now.

greg k-h

      parent reply	other threads:[~2019-06-04 14:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 13:24 [PATCH BACKPORT 4.19 1/2] Compiler Attributes: add support for __copy (gcc >= 9) Stefan Agner
2019-06-04 13:24 ` [PATCH BACKPORT 4.19 2/2] include/linux/module.h: copy __init/__exit attrs to init/cleanup_module Stefan Agner
2019-06-04 14:41 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190604144106.GA29518@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=msebor@gcc.gnu.org \
    --cc=ndesaulniers@google.com \
    --cc=stable@vger.kernel.org \
    --cc=stefan@agner.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.