linux/tools/objtool
Puranjay Mohan 6656cf1e97 objtool/klp: Fix vmlinux .klp.symid link error for .exitcall.exit symbols
Building a kernel via klp-build fails to link:

  `__exitcall_aes_mod_exit' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.exitcall.exit' of vmlinux.o
  `__exitcall_dax_exit' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.exitcall.exit' of vmlinux.o
  `__exitcall_hid_exit' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.exitcall.exit' of vmlinux.o
  `__exitcall_usb_serial_module_exit' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.exitcall.exit' of vmlinux.o

module_exit() on a built-in emits a static __exitcall_$fn pointer into
.exitcall.exit, which vmlinux.lds.h discards unconditionally via
EXIT_CALL.  When two built-in translation units define a module_exit()
function of the same name, the resulting local symbols collide,
symid_needed() sees a duplicate and emits a .klp.symid entry for each,
referencing symbols the linker then throws away.

Same-named module_exit() functions are not rare:

  dax_exit                drivers/dax/device.c, drivers/dax/fsdev.c
  hid_exit                drivers/hid/hid-core.c, drivers/hid/usbhid/hid-core.c
  aes_mod_exit            arch/arm64/crypto/aes-ce-ccm-glue.c, lib/crypto/aes.c
  usb_serial_module_exit  module_usb_serial_driver() expands to this fixed
                          name in each of its ~49 users

The last one makes the collision structural rather than accidental: any
kernel with two built-in USB serial drivers has it.  This is not arch
specific either; it only requires the objects to be built in rather than
modular, which is why a monolithic config trips it while a typical
distro config does not.

Add .exitcall.exit to the discarded section list so its symbols don't get
symids.

This is the same failure mode as "objtool/klp: Fix vmlinux .klp.symid
link error for .no_trim_symbol symbols", for another unconditionally
discarded allocated section.

Fixes: 029223d301 ("objtool/klp: Add .klp.symid for sympos disambiguation")
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Link: https://patch.msgid.link/m24igzlbxf.fsf@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
2026-08-12 13:33:32 -07:00
..
arch objtool/klp: Ignore replacement offset of empty x86 alternatives 2026-08-11 15:04:57 -07:00
Documentation Revert "objtool: Warn on functions with ambiguous -ffunction-sections section names" 2025-11-21 10:04:10 +01:00
include/objtool objtool/klp: Fix cross-module klp relocation section naming 2026-08-11 16:10:51 -07:00
.gitignore objtool: Add Function to get the name of a CPU feature 2025-11-24 20:39:47 +01:00
Build objtool/klp: Fix symbol resolution for duplicate data symbols 2026-08-03 07:12:39 +02:00
builtin-check.c objtool/klp: Add .klp.symid for sympos disambiguation 2026-08-03 07:12:39 +02:00
builtin-klp.c objtool/klp: Add "objtool klp checksum" subcommand 2026-05-04 21:16:05 -07:00
check.c objtool/klp: Add .klp.symid for sympos disambiguation 2026-08-03 07:12:39 +02:00
disas.c objtool: Add insn_sym() helper 2026-05-04 21:16:06 -07:00
elf.c objtool/klp: Fix false module dependencies caused by dead relocs 2026-08-03 07:12:38 +02:00
klp-checksum.c objtool/klp: Fix position-dependent checksums for non-relocated jumps/calls 2026-05-04 21:16:06 -07:00
klp-diff.c objtool/klp: Fix line numbers in Module.symvers parse errors 2026-08-11 16:10:58 -07:00
klp-post-link.c objtool/klp: Fix cross-module klp relocation section naming 2026-08-11 16:10:51 -07:00
klp-symid.c objtool/klp: Fix vmlinux .klp.symid link error for .exitcall.exit symbols 2026-08-12 13:33:32 -07:00
klp-sympos.c objtool/klp: Explicitly disallow patching or referencing init code/data 2026-08-11 16:10:38 -07:00
Makefile objtool: Include libsubcmd headers directly from source tree 2026-05-04 21:16:04 -07:00
noreturns.h x86/smpboot: Mark native_play_dead() as __noreturn 2025-10-30 08:29:41 -07:00
objtool.c objtool/klp: Add correlation debugging output 2026-05-04 21:16:06 -07:00
orc_dump.c objtool: Add annotype() helper 2025-10-14 14:46:49 -07:00
orc_gen.c objtool: Add annotype() helper 2025-10-14 14:46:49 -07:00
signal.c objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
special.c objtool: Provide access to feature and flags of group alternatives 2025-11-21 15:30:14 +01:00
sync-check.sh objtool/klp: Introduce klp diff subcommand for diffing object files 2025-10-14 14:50:18 -07:00
trace.c objtool: Add insn_sym() helper 2026-05-04 21:16:06 -07:00
weak.c objtool/klp: Introduce klp diff subcommand for diffing object files 2025-10-14 14:50:18 -07:00