From mboxrd@z Thu Jan 1 00:00:00 1970 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 4AA09C433EF for ; Sat, 11 Jun 2022 18:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230435AbiFKSsc (ORCPT ); Sat, 11 Jun 2022 14:48:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbiFKSs3 (ORCPT ); Sat, 11 Jun 2022 14:48:29 -0400 Received: from conssluserg-04.nifty.com (conssluserg-04.nifty.com [210.131.2.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48B8F46672; Sat, 11 Jun 2022 11:48:25 -0700 (PDT) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 25BIm5kL003581; Sun, 12 Jun 2022 03:48:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 25BIm5kL003581 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1654973286; bh=OJU24WbqmimMYRsIh1ewIsGhAVbQLx3txvyBGLHeO1k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=yPWnpNrh1S682UMdCy2xRKV0nrfelc88TI16XUiek8cvMXVCNlTxhriiqQO+5ADC1 dg6rQzE95S0VmLCo3BAi+37VggRNO3qFuQOYznZiQ1C6WUOuoWrM3B5XcHWwxyQSBi 56lNT0/EEJwIClXLSEMv0e1JOTdzqZUoPKOJVDYO6325v8W4ETHVohlGhccGOYVXST nsOYnfuN9hFINEuEoxEDpOMb2MGq9/0/1cezB/hYqTP7l62zbTytCoYFNcanmOOo1w 3G5bjTr1dxR6EO0ewir9ONz54qAFMyAmoZtie4zDQ0hmU7iWdP41qsvLni41w90wtu NCC8bubAl31ww== X-Nifty-SrcIP: [209.85.221.54] Received: by mail-wr1-f54.google.com with SMTP id c21so2437729wrb.1; Sat, 11 Jun 2022 11:48:05 -0700 (PDT) X-Gm-Message-State: AOAM530EDqZ9bqx6bFmc7UXJccoCaY6KJto6bpuQZ/mBcXPUa9aN+ZT3 v10+F3qbAf9DChkSfxFI2t2z34IX4vTDoUQpQ/k= X-Google-Smtp-Source: ABdhPJxbHanpX6AbHetOK3rMz1pMBQZREhQ/9hwWAadZPeVmpGmRxmrP9S3VU2JRwZBzpQMKmxbHB5lWZJPn+RgOjgM= X-Received: by 2002:a05:6000:156d:b0:210:3135:ce1c with SMTP id 13-20020a056000156d00b002103135ce1cmr50144120wrz.409.1654973284279; Sat, 11 Jun 2022 11:48:04 -0700 (PDT) MIME-Version: 1.0 References: <20220610183236.1272216-1-masahiroy@kernel.org> <20220610183236.1272216-4-masahiroy@kernel.org> In-Reply-To: <20220610183236.1272216-4-masahiroy@kernel.org> From: Masahiro Yamada Date: Sun, 12 Jun 2022 03:47:27 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/7] kbuild: generate struct kernel_symbol by modpost To: Linux Kbuild mailing list Cc: Al Viro , Nicolas Pitre , Luis Chamberlain , linux-modules , Ard Biesheuvel , Arnd Bergmann , Michal Marek , Nick Desaulniers , linux-arch , linux-ia64@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: On Sat, Jun 11, 2022 at 3:34 AM Masahiro Yamada wrote: > > Commit 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing > CONFIG_MODULE_REL_CRCS") made the module versioning implementation > arch-agnostic; now all the version CRCs are generated by modpost as C > code whether the EXPORT_SYMBOL() is placed in *.c or *.S. > > Doing similar for the entire data structure of EXPORT_SYMBOL() makes > further cleanups possible. > > This commit splits EXPORT_SYMBOL() compilation into two stages. > > When a source file is compiled, EXPORT_SYMBOL() is converted into a > dummy symbol in the .discard.export_symbol section. > > For example, > > EXPORT_SYMBOL(foo); > EXPORT_SYMBOL_NS_GPL(bar, BAR_NAMESPACE); > > will be expanded into the following assembly code: > > .section .discard.export_symbol > __export_symbol.foo: > .asciz "" > .previous > > .section .discard.export_symbol > __export_symbol_gpl.bar: > .asciz "BAR_NAMESPACE" > .previous > > They are just markers to tell modpost the name, license, and namespace > of the symbols. They will be dropped from the final vmlinux and modules > because the section name starts with ".discard.". > > Then, modpost extracts all the information of EXPORT_SYMBOL() from the > .discard.export_symbol section, then generates C code: > > KSYMTAB_ENTRY(foo, "", ""); > KSYMTAB_ENTRY(bar, "_gpl", "BAR_NAMESPACE"); > > KSYMTAB_ENTRY() is expanded to struct kernel_symbol that will be linked > to the vmlinux or a module. > > With this change, EXPORT_SYMBOL() works in the same way for *.c and *.S > files, providing the following benefits. > > [1] Deprecate EXPORT_DATA_SYMBOL() Sorry, please let me take back this. I completely missed how linkage for ia64 works. I used inline assembly in C, so it would break ia64. Please ignore this patch. -- Best Regards Masahiro Yamada