linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH] sparse/parse.c: ignore hotpatch attribute
Date: Thu, 30 Apr 2015 13:47:45 +0200	[thread overview]
Message-ID: <20150430114745.GB4199@osiris> (raw)
In-Reply-To: <CANeU7QkyX+cPEpBm_rW1JUX64NAZ6YM0KR17r1rfPeDpYC1uGA@mail.gmail.com>

On Wed, Apr 29, 2015 at 04:22:13PM -0700, Christopher Li wrote:
> That patch looks fine.
> 
> Can you add some test case for the hot patch as well?
> It need to cover the case you run into.
> 
> Preferably cover each of the variation of hot patch.
> 
> It will be useful when we parse these attributes properly.
> 
> Chris

Something like below? I have to admit that I have not much of a clue
of what I'm doing ;)

From 03da0b28318100cc9a1389c81920654b29405d73 Mon Sep 17 00:00:00 2001
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Date: Thu, 30 Apr 2015 12:53:28 +0200
Subject: [PATCH] sparse/parse.c: ignore hotpatch attribute

gcc knows about a new "hotpatch" attribute which sparse can safely ignore,
since it modifies only which code will be generated just like the
"no_instrument_function" attribute.

The gcc hotpatch feature patch:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=11762b8363737591bfb9c66093bc2edf289b917f

Currently the Linux kernel makes use of this attribute:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=61f552141c9c0e88b3fdc7046265781ffd8fa68a

Without this patch sparse will emit warnings like
"error: attribute 'hotpatch': unknown attribute"

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 ident-list.h               | 1 +
 parse.c                    | 2 ++
 validation/attr-hotpatch.c | 7 +++++++
 3 files changed, 10 insertions(+)
 create mode 100644 validation/attr-hotpatch.c

diff --git a/ident-list.h b/ident-list.h
index b65b667da720..1849ea613b47 100644
--- a/ident-list.h
+++ b/ident-list.h
@@ -81,6 +81,7 @@ IDENT(constructor); IDENT(__constructor__);
 IDENT(destructor); IDENT(__destructor__);
 IDENT(cold); IDENT(__cold__);
 IDENT(hot); IDENT(__hot__);
+IDENT(hotpatch); IDENT(__hotpatch__);
 IDENT(cdecl); IDENT(__cdecl__);
 IDENT(stdcall); IDENT(__stdcall__);
 IDENT(fastcall); IDENT(__fastcall__);
diff --git a/parse.c b/parse.c
index b43d6835528b..8afae73d5325 100644
--- a/parse.c
+++ b/parse.c
@@ -540,6 +540,8 @@ const char *ignored_attributes[] = {
 	"__gnu_inline__",
 	"hot",
 	"__hot__",
+	"hotpatch",
+	"__hotpatch__",
         "leaf",
         "__leaf__",
 	"l1_text",
diff --git a/validation/attr-hotpatch.c b/validation/attr-hotpatch.c
new file mode 100644
index 000000000000..205169389956
--- /dev/null
+++ b/validation/attr-hotpatch.c
@@ -0,0 +1,7 @@
+static void __attribute__((hotpatch(0,3))) bar(void)
+{
+}
+
+/*
+ * check-name: attribute hotpatch
+ */
-- 
2.1.4


  reply	other threads:[~2015-04-30 11:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 10:48 [PATCH] sparse/parse.c: ignore hotpatch attribute Heiko Carstens
2015-04-29 23:22 ` Christopher Li
2015-04-30 11:47   ` Heiko Carstens [this message]
2015-04-30 15:45 ` Linus Torvalds
2015-04-30 15:50   ` Nicholas Mc Guire
2015-04-30 17:38   ` josh
2015-04-30 17:51     ` Linus Torvalds
2015-04-30 19:41       ` josh

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=20150430114745.GB4199@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).