[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAS-VYZ3G3-TmmTQSNuanGsufkoWTv32HNKdDkE+7-6mcg@mail.gmail.com>
Date: Sun, 12 Jun 2022 03:47:27 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Nicolas Pitre <npitre@...libre.com>,
Luis Chamberlain <mcgrof@...nel.org>,
linux-modules <linux-modules@...r.kernel.org>,
Ard Biesheuvel <ardb@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Michal Marek <michal.lkml@...kovi.net>,
Nick Desaulniers <ndesaulniers@...gle.com>,
linux-arch <linux-arch@...r.kernel.org>,
linux-ia64@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/7] kbuild: generate struct kernel_symbol by modpost
On Sat, Jun 11, 2022 at 3:34 AM Masahiro Yamada <masahiroy@...nel.org> 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
Powered by blists - more mailing lists