archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <>
To: Andrew Morton <>,,
	Masahiro Yamada <>,
	Michal Marek <>
Cc: Arnd Bergmann <>,, Ard Biesheuvel <>,
	Kees Cook <>,
	Masahiro Yamada <>,
	Rikard Falkeborn <>,
Subject: [PATCH] kbuild: avoid static_assert for genksyms
Date: Fri,  4 Dec 2020 00:09:44 +0100	[thread overview]
Message-ID: <> (raw)

From: Arnd Bergmann <>

genksyms does not know or care about the _Static_assert() built-in,
and sometimes falls back to ignoring the later symbols, which causes
undefined behavior such as

WARNING: modpost: EXPORT symbol "ethtool_set_ethtool_phy_ops" [vmlinux] version generation failed, symbol will not be versioned.
ld: net/ethtool/common.o: relocation R_AARCH64_ABS32 against `__crc_ethtool_set_ethtool_phy_ops' can not be used when making a shared object
net/ethtool/common.o:(_ftrace_annotated_branch+0x0): dangerous relocation: unsupported relocation

Redefine static_assert for genksyms to avoid that.

Suggested-by: Ard Biesheuvel <>
Signed-off-by: Arnd Bergmann <>
 include/linux/build_bug.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h
index e3a0be2c90ad..7bb66e15b481 100644
--- a/include/linux/build_bug.h
+++ b/include/linux/build_bug.h
@@ -77,4 +77,9 @@
 #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
 #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
+#ifdef __GENKSYMS__
+/* genksyms gets confused by _Static_assert */
+#define _Static_assert(expr, ...)
 #endif	/* _LINUX_BUILD_BUG_H */

             reply	other threads:[~2020-12-03 23:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 23:09 Arnd Bergmann [this message]
2020-12-06  2:48 ` [PATCH] kbuild: avoid static_assert for genksyms Masahiro Yamada
2020-12-07  8:53   ` Ard Biesheuvel
2020-12-10 16:12 ` Marco Elver

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \

* 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).