public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Daniel Golle <daniel@makrotopia.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	John Crispin <john@phrozen.org>,
	Alexey Gladkov <legion@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [BUG] kbuild: modules.builtin is empty on architectures without CONFIG_ARCH_VMLINUX_NEEDS_RELOCS
Date: Wed, 15 Oct 2025 10:29:06 -0700	[thread overview]
Message-ID: <20251015172906.GA1630960@ax162> (raw)
In-Reply-To: <aO-kDdBybaHSn62G@makrotopia.org>

Hi Daniel,

Thanks for the report!

On Wed, Oct 15, 2025 at 02:39:25PM +0100, Daniel Golle wrote:
> While build todays net-next tree on a Lantiq-based board I use for
> testing I run into a weird problem which gave me some headaches. It
> turns there is a regression introduced in commit 39cfd5b12160 ("kbuild:
> extract modules.builtin.modinfo from vmlinux.unstripped") which causes
> both modules.builtin and modules.builtin.modinfo to be empty files on
> certain architectures.
> 
> AFFECTED SCOPE:
> ===============
> This bug affects all architectures where:
>   1. CONFIG_ARCH_VMLINUX_NEEDS_RELOCS is NOT set, AND
>   2. The architecture uses the standard ELF_DETAILS macro in its linker
>      script (which places .modinfo at address 0 as a non-allocatable
>      section)
> 
> This includes at least MIPS (32-bit and 64-bit) and likely several other
> architectures. The issue does NOT affect architectures with
> CONFIG_ARCH_VMLINUX_NEEDS_RELOCS=y (e.g., x86 with certain
> configurations, parisc, s390).
> 
> OBSERVED BEHAVIOR:
> ==================
> After a successful kernel build with the affected configuration:
>   - modules.builtin: 0 bytes (empty)
>   - modules.builtin.modinfo: 0 bytes (empty)
>   - vmlinux.o: contains .modinfo section (verified with readelf)
>   - vmlinux.unstripped: .modinfo section is MISSING (verified with
>     readelf)
...
> REPRODUCTION:
> =============
> 1. Configure a kernel for MIPS (or any other architecture without
>    CONFIG_ARCH_VMLINUX_NEEDS_RELOCS)
> 2. Ensure CONFIG_MODULES=y is set
> 3. Build the kernel: make
> 4. Observe: ls -lh modules.builtin modules.builtin.modinfo
>    Both files will be 0 bytes

I cannot reproduce this with a simple defconfig build for either mips or
arm64 using GCC 15.2.0 / binutils 2.45 from kernel.org [1]:

  $ git show -s --pretty=kernel
  5a6f65d15025 ("Merge tag 'bitmap-for-v6.18-rc2' of https://github.com/norov/linux")

  $ make -skj"$(nproc)" ARCH=mips CROSS_COMPILE=mips-linux- clean defconfig all
  ...

  $ scripts/config -s MODULES -s ARCH_VMLINUX_NEEDS_RELOCS
  y
  undef

  $ ls -hl modules.builtin{,.modinfo}
  -rw-r--r-- 1 nathan nathan 8.7K Oct 15 10:19 modules.builtin
  -rwxr-xr-x 1 nathan nathan 146K Oct 15 10:19 modules.builtin.modinfo

  $ make -skj"$(nproc)" ARCH=arm64 CROSS_COMPILE=aarch64-linux- clean virtconfig all

  $ scripts/config -s MODULES -s ARCH_VMLINUX_NEEDS_RELOCS
  y
  undef

  $ ls -hl modules.builtin{,.modinfo}
  -rw-r--r-- 1 nathan nathan  18K Oct 15 10:23 modules.builtin
  -rw-r--r-- 1 nathan nathan 284K Oct 15 10:23 modules.builtin.modinfo

What version of GCC and binutils are you using? Your configuration may
be helpful for reproducing as well.

[1]: https://kernel.org/pub/tools/crosstool/

Cheers,
Nathan

      parent reply	other threads:[~2025-10-15 17:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 13:39 [BUG] kbuild: modules.builtin is empty on architectures without CONFIG_ARCH_VMLINUX_NEEDS_RELOCS Daniel Golle
2025-10-15 17:05 ` Alexey Gladkov
2025-10-15 17:29 ` Nathan Chancellor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251015172906.GA1630960@ax162 \
    --to=nathan@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=john@phrozen.org \
    --cc=legion@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nsc@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox