summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2022-03-08 16:30:46 +0100
committerPeter Zijlstra <peterz@infradead.org>2022-03-15 10:32:43 +0100
commit4adb23686795e9c88e3217b5d7b4524c0da9d04f (patch)
tree3e82aa694a452dd067389d5f551d996cef0715b6 /arch/x86/kernel/process.c
parent53f7109ef957315ab53205ba3a3f4f48874c0428 (diff)
downloadlinux-4adb23686795e9c88e3217b5d7b4524c0da9d04f.tar.bz2
objtool: Ignore extra-symbol code
There's a fun implementation detail on linking STB_WEAK symbols. When the linker combines two translation units, where one contains a weak function and the other an override for it. It simply strips the STB_WEAK symbol from the symbol table, but doesn't actually remove the code. The result is that when objtool is ran in a whole-archive kind of way, it will encounter *heaps* of unused (and unreferenced) code. All rudiments of weak functions. Additionally, when a weak implementation is split into a .cold subfunction that .cold symbol is left in place, even though completely unused. Teach objtool to ignore such rudiments by searching for symbol holes; that is, code ranges that fall outside the given symbol bounds. Specifically, ignore a sequence of unreachable instruction iff they occupy a single hole, additionally ignore any .cold subfunctions referenced. Both ld.bfd and ld.lld behave like this. LTO builds otoh can (and do) properly DCE weak functions. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/20220308154319.232019347@infradead.org
Diffstat (limited to 'arch/x86/kernel/process.c')
0 files changed, 0 insertions, 0 deletions