From: Randy Dunlap <rdunlap@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Randy Dunlap <rdunlap@infradead.org>,
Stephen Boyd <swboyd@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH -next] buildid: fix build when CONFIG_MODULES is not set
Date: Thu, 13 May 2021 10:15:10 -0700 [thread overview]
Message-ID: <20210513171510.20328-1-rdunlap@infradead.org> (raw)
Omit the static_assert() when CONFIG_MODULES is not set/enabled.
Fixes these build errors:
../kernel/kallsyms.c: In function ‘__sprint_symbol’:
../include/linux/kernel.h:53:43: error: dereferencing pointer to incomplete type ‘struct module’
#define typeof_member(T, m) typeof(((T*)0)->m)
^
../include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(typeof_member(struct module, build_id)) == 20"
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
^
../kernel/kallsyms.c:454:4: note: in expansion of macro ‘static_assert’
static_assert(sizeof(typeof_member(struct module, build_id)) == 20);
^~~~~~~~~~~~~
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
kernel/kallsyms.c | 2 ++
1 file changed, 2 insertions(+)
--- linux-next-20210513.orig/kernel/kallsyms.c
+++ linux-next-20210513/kernel/kallsyms.c
@@ -451,7 +451,9 @@ static int __sprint_symbol(char *buffer,
#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
if (add_buildid && buildid) {
/* build ID should match length of sprintf */
+#if IS_ENABLED(CONFIG_MODULES)
static_assert(sizeof(typeof_member(struct module, build_id)) == 20);
+#endif
len += sprintf(buffer + len, " %20phN", buildid);
}
#endif
next reply other threads:[~2021-05-13 17:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 17:15 Randy Dunlap [this message]
2021-05-14 6:54 ` [PATCH -next] buildid: fix build when CONFIG_MODULES is not set Stephen Boyd
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=20210513171510.20328-1-rdunlap@infradead.org \
--to=rdunlap@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=swboyd@chromium.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).