mirror-linux/tools
Josh Poimboeuf 9c7dc1dd89 objtool: Warn on functions with ambiguous -ffunction-sections section names
When compiled with -ffunction-sections, a function named startup() will
be placed in .text.startup.  However, .text.startup is also used by the
compiler for functions with __attribute__((constructor)).

That creates an ambiguity for the vmlinux linker script, which needs to
differentiate those two cases.

Similar naming conflicts exist for functions named exit(), split(),
unlikely(), hot() and unknown().

One potential solution would be to use '#ifdef CC_USING_FUNCTION_SECTIONS'
to create two distinct implementations of the TEXT_MAIN macro.  However,
-ffunction-sections can be (and is) enabled or disabled on a per-object
basis (for example via ccflags-y or AUTOFDO_PROFILE).

So the recently unified TEXT_MAIN macro (commit 1ba9f89794
("vmlinux.lds: Unify TEXT_MAIN, DATA_MAIN, and related macros")) is
necessary.  This means there's no way for the linker script to
disambiguate things.

Instead, use objtool to warn on any function names whose resulting
section names might create ambiguity when the kernel is compiled (in
whole or in part) with -ffunction-sections.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: live-patching@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://patch.msgid.link/65fedea974fe14be487c8867a0b8d0e4a294ce1e.1762991150.git.jpoimboe@kernel.org
2025-11-13 08:03:10 +01:00
..
accounting tools/delaytop: improve error handling for missing PSI support 2025-09-13 17:32:56 -07:00
arch tools headers UAPI: Sync KVM's vmx.h header with the kernel sources to handle new exit reasons 2025-11-03 13:29:53 -03:00
bootconfig bootconfig: Fix negative seeks on 32-bit with LFS enabled 2025-08-21 08:16:31 +09:00
bpf bpftool: Remove duplicate string.h header 2025-09-27 04:23:15 -07:00
build perf build: Fix perf build issues with fixdep 2025-10-23 09:53:49 +02:00
certs
cgroup
counter
crypto
debugging
docs docs: add tools/docs/gen-redirects.py 2025-09-09 13:37:16 -06:00
firewire
firmware
gpio tools: gpio: remove the include directory on make clean 2025-09-04 16:29:28 +02:00
hv
iio iio: add power and energy measurement modifiers 2025-09-13 13:47:19 +01:00
include Linux 6.18-rc5 2025-11-13 07:58:43 +01:00
kvm/kvm_stat
laptop
leds
lib libbpf: Fix powerpc's stack register definition in bpf_tracing.h 2025-10-23 11:25:16 -07:00
memory-model
mm tools/mm/slabinfo: fix access to null terminator in string boundary 2025-09-21 14:22:00 -07:00
net tools: ynl: avoid print_field when there is no reply 2025-10-27 18:16:49 -07:00
objtool objtool: Warn on functions with ambiguous -ffunction-sections section names 2025-11-13 08:03:10 +01:00
pcmcia
perf Linux 6.18-rc5 2025-11-13 07:58:43 +01:00
power Kbuild updates for 6.18 2025-10-01 20:58:51 -07:00
rcu
sched
sched_ext tools/sched_ext: scx_qmap: Make debug output quieter by default 2025-09-23 09:03:26 -10:00
scripts tools headers: Sync syscall tables with the kernel source 2025-08-18 13:49:25 -07:00
sound
spi
testing iommufd 6.18 first rc pull 2025-11-07 13:13:09 -08:00
thermal
time
tracing tracing/tools: Fix incorrcet short option in usage text for --threads 2025-11-07 07:59:37 -05:00
usb tools/usb/usbip: fix spelling mistakes in usbipd.c 2025-09-06 15:22:14 +02:00
verification rv: Add opid per-cpu monitor 2025-07-28 16:47:35 -04:00
virtio kmsan: convert kmsan_handle_dma to use physical addresses 2025-09-12 00:18:20 +02:00
wmi
workqueue
writeback
Makefile