linux/include
Lorenzo Stoakes (ARM) 5fe4dd5966
kbuild: do not allocate .modinfo in vmlinux
Commit 3e86e4d74c ("kbuild: keep .modinfo section in vmlinux.unstripped")
placed MODULE_INFO() strings in the .modinfo section in vmlinux.unstripped,
however it left the section allocatable, so it gets assigned an address and
on arm64, arm and riscv, the section is tagged as PT_LOAD.

This is useless as the data is ultimately stripped anyway.

Doing this results in a lot of unnecessary work - each pass copies the
whole file, 450 MiB with relocations for an x86 allmodconfig build and 250
MiB for an arm64 allmodconfig build.

This adds ~0.7s on the serial tail of every build for arm64 and ~0.2s for
x86 (the tail is single-threaded work done after parallel work has
finished).

Nothing requires .modinfo to exist at an address, so mark the output
section (INFO) so that it's not allocated and use --dump-section to extract
it as -O only emits allocated sections.

The dump doesn't pick up the arch's OBJCOPYFLAGS any longer as they should
not impact the output of this section.

Image, bzImage, System.map and modules.builtin.modinfo are unchanged and
the stripped vmlinux differs only in its program headers.

The objcopy passes are on the serial tail of every build that links
vmlinux, no-op builds are unchanged.

Whole build, 128-thread Threadripper 9980X, best of N runs:

                                         before   after     delta
                                         -------------------------------
  x86 defconfig, touch mm/vma.c, gcc       11.2s    11.1s    -0.15s (-1%)
  x86 defconfig, touch mm/vma.c, clang     11.3s    11.1s    -0.19s (-2%)
  x86 defconfig, clean, gcc                32.5s    32.3s    -0.16s (-1%)
  x86 defconfig, clean, clang              34.5s    34.2s    -0.26s (-1%)
  x86 allmodconfig, touch mm/vma.c, gcc    40.1s    39.7s    -0.44s (-1%)

Assisted-by: LLM
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
Link: https://patch.msgid.link/20260923-build-speedup-v4-1-73128809a4a4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-26 00:16:33 +01:00
..
acpi ACPI: bus: Drop two fields from struct acpi_device_pnp 2026-09-01 21:45:50 +02:00
asm-generic kbuild: do not allocate .modinfo in vmlinux 2026-09-26 00:16:33 +01:00
clocksource hyperv-next for v7.3-rc1 2026-08-26 16:47:40 -07:00
crypto
cxl
drm Merge drm/drm-fixes into drm-misc-fixes 2026-09-01 09:38:51 +02:00
dt-bindings sound fixes for 7.3-rc1 2026-08-28 10:01:02 -07:00
hyperv
keys tpm: Initial step to reorganize TPM public headers 2026-08-25 18:13:35 +03:00
kunit
kvm KVM/arm64 changes for 7.3 2026-08-24 12:42:07 -04:00
linux tracing fixes for v7.3: 2026-09-06 14:21:24 -07:00
math-emu
media
memory
misc
net ipv6: mcast: use copy-on-write RCU updates in ip6_mc_source() 2026-08-31 17:54:45 -07:00
pcmcia
ras
rdma
rv mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
scsi SCSI updates for 7.3 2026-08-29 11:55:36 -07:00
soc Mostly the usual clk driver updates and new SoC additions plus non-critical 2026-08-26 11:14:30 -07:00
sound ALSA: rawmidi: Another workaround for false-positive mutex lockdep warning 2026-08-25 15:55:37 +02:00
target
trace Including fixes from bluetooth. 2026-09-03 10:18:12 -07:00
uapi integrity-v7.3-rc2 2026-09-04 19:36:11 -07:00
ufs
vdso
video
xen
Kbuild