Re: [PATCH] x86: Fix build warnings about export.h

From: Eric Biggers
Date: Thu Jun 12 2025 - 15:08:06 EST


On Thu, Jun 12, 2025 at 05:32:28PM +0800, Zhenghan Cheng wrote:
> After commit a934a57a42f64a4 ("scripts/misc-check:
> check missing #include <linux/export.h> when W=1")
> and commit 7d95680d64ac8e836c ("scripts/misc-check:
> check unnecessary #include <linux/export.h> when W=1"),
> we get some build warnings with W=1,such as:
>
> arch/x86/coco/sev/core.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/x86/crypto/aria_aesni_avx2_glue.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/x86/kernel/unwind_orc.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/x86/kvm/hyperv.c: warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
> arch/x86/events/intel/core.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
> arch/x86/events/zhaoxin/core.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
> arch/x86/kernel/crash.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
> arch/x86/kernel/devicetree.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
>
> so fix these build warnings for x86.
>
> Signed-off-by: "Zhenghan Cheng" <chengzhenghan@xxxxxxxxxxxxx>
> Suggested-by: "Huacai Chen" <chenhuacai@xxxxxxxxxxx>

FYI, I'm planning to handle arch/x86/lib/crc*.c and arch/x86/lib/crypto/.

(Specifically, I'm migrating them to lib/crc/ and lib/crypto/ respectively, and
one of the effects of that is the EXPORT_SYMBOL in arch-specific crc and crypto
library files go away. The lib/crc/ change is already in linux-next, and
https://lore.kernel.org/r/20250612183852.114878-1-ebiggers@xxxxxxxxxx adds
<linux/export.h> to all files with EXPORT_SYMBOL in lib/crc/.)

- Eric