linux/export: use inline assembler to populate symbol CRCs
PATCH 1/1 linux/export: use inline assembler to populate symbol CRCs
Since commit 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS"), the module versioning on the (non-upstreamed-yet) kvx Linux port is broken due to unexpected padding for __crc_* symbols. The kvx GCC adds padding so u32 gets 8-byte alignment instead of 4.
I do not know if this happens for upstream architectures in general, but any compiler has the freedom to insert padding for faster access.
Use the inline assembler to directly specify the wanted data layout. This is how we previously did before the breakage.
Fixes 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS")
Reported-by Yann Sionneau <[email protected]>
Signed-off-by Masahiro Yamada <[email protected]>
Tested-by Yann Sionneau <[email protected]>
---
include/linux/export-internal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/export-internal.h +4 -1
@@ -12,6 +12,9 @@/* __used is needed to keep __crc_* for LTO */ #define SYMBOL_CRC (sym, crc, sec) \ - u32 __section("___kcrctab" sec "+" #sym) __used __crc_##sym = crc + asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \ + "__crc_" #sym ":" "\n" \ + ".long " #crc "\n" \ + ".previous" "\n")#endif /* __LINUX_EXPORT_INTERNAL_H__ */
Signature · 1 line
2.34.1