Re: [PATCH v3 17/64] objtool: Fix weak symbol detection
From: Josh Poimboeuf
Date: Fri Jun 27 2025 - 11:42:21 EST
On Fri, Jun 27, 2025 at 11:13:10AM +0200, Peter Zijlstra wrote:
> On Thu, Jun 26, 2025 at 04:55:04PM -0700, Josh Poimboeuf wrote:
> > find_symbol_hole_containing() fails to find a symbol hole (aka stripped
> > weak symbol) if its section has no symbols before the hole. This breaks
> > weak symbol detection if -ffunction-sections is enabled.
> >
> > Fix that by allowing the interval tree to contain section symbols, which
> > are always at offset zero for a given section.
> >
> > Fixes a bunch of (-ffunction-sections) warnings like:
> >
> > vmlinux.o: warning: objtool: .text.__x64_sys_io_setup+0x10: unreachable instruction
> >
> > Fixes: 4adb23686795 ("objtool: Ignore extra-symbol code")
> > Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> > ---
> > tools/include/linux/interval_tree_generic.h | 2 +-
> > tools/objtool/elf.c | 8 ++++----
> > 2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/tools/include/linux/interval_tree_generic.h b/tools/include/linux/interval_tree_generic.h
> > index aaa8a0767aa3..c0ec9dbdfbaf 100644
> > --- a/tools/include/linux/interval_tree_generic.h
> > +++ b/tools/include/linux/interval_tree_generic.h
> > @@ -77,7 +77,7 @@ ITSTATIC void ITPREFIX ## _remove(ITSTRUCT *node, \
> > * Cond2: start <= ITLAST(node) \
> > */ \
> > \
> > -static ITSTRUCT * \
> > +ITSTATIC ITSTRUCT * \
> > ITPREFIX ## _subtree_search(ITSTRUCT *node, ITTYPE start, ITTYPE last) \
> > { \
> > while (true) { \
>
> IIRC this file is a direct copy from the kernel; this should probably be
> changed in both?
Ok. We should probably enforce that with the sync-check script.
--
Josh