From nobody Fri Dec 19 17:34:34 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CA1FC433FE for ; Sat, 22 Oct 2022 10:21:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbiJVKVY (ORCPT ); Sat, 22 Oct 2022 06:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbiJVKUq (ORCPT ); Sat, 22 Oct 2022 06:20:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C35D31D5A3; Sat, 22 Oct 2022 02:37:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F0D64B82E35; Sat, 22 Oct 2022 08:00:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C69AC433D7; Sat, 22 Oct 2022 08:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425617; bh=WsLm7DULaSh3XLEUh8TtPER6hSxauw/5gTEcKzR+ymA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rmFTavuUkooxzmbugtnm0pGLkApoysBWN0zW9v6D9/SgSSCoxY7K0wcNUTcAfdJ4s rq81ZODUEpjmiVKA8jhWbeIU4IPr5QtoVL6xPwnMoHXSryGuZvhUzbOeYNoW9+y29d nhWnemO9NjkA6vj3UzPWVWC4Q8hCGSBCrpSMpsKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yann Sionneau , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.19 529/717] linux/export: use inline assembler to populate symbol CRCs Date: Sat, 22 Oct 2022 09:26:48 +0200 Message-Id: <20221022072521.710779092@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masahiro Yamada [ Upstream commit f3304ecd7f060db1d4197fbdce5a503259f770d3 ] 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. Link: https://lore.kernel.org/lkml/20220817161438.32039-1-ysionneau@kalray.= eu/ Link: https://lore.kernel.org/linux-kbuild/31ce5305-a76b-13d7-ea55-afca82c4= 6cf2@kalray.eu/ Fixes: 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONF= IG_MODULE_REL_CRCS") Reported-by: Yann Sionneau Signed-off-by: Masahiro Yamada Tested-by: Yann Sionneau Signed-off-by: Sasha Levin --- include/linux/export-internal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/export-internal.h b/include/linux/export-interna= l.h index c2b1d4fd5987..fe7e6ba918f1 100644 --- a/include/linux/export-internal.h +++ b/include/linux/export-internal.h @@ -10,8 +10,10 @@ #include #include =20 -/* __used is needed to keep __crc_* for LTO */ #define SYMBOL_CRC(sym, crc, sec) \ - u32 __section("___kcrctab" sec "+" #sym) __used __crc_##sym =3D crc + asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \ + "__crc_" #sym ":" "\n" \ + ".long " #crc "\n" \ + ".previous" "\n") =20 #endif /* __LINUX_EXPORT_INTERNAL_H__ */ --=20 2.35.1