]> Git Repo - linux.git/commitdiff
kbuild: avoid static_assert for genksyms
authorArnd Bergmann <[email protected]>
Fri, 11 Dec 2020 21:36:38 +0000 (13:36 -0800)
committerLinus Torvalds <[email protected]>
Fri, 11 Dec 2020 22:02:14 +0000 (14:02 -0800)
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.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnd Bergmann <[email protected]>
Suggested-by: Ard Biesheuvel <[email protected]>
Cc: Masahiro Yamada <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Rikard Falkeborn <[email protected]>
Cc: Marco Elver <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/build_bug.h

index e3a0be2c90ad9846167f65740be7c6f97763e3c3..7bb66e15b481b27cd51e0c522f80d6206233f9bb 100644 (file)
@@ -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
+
 #endif /* _LINUX_BUILD_BUG_H */
This page took 0.059809 seconds and 4 git commands to generate.