[PATCH v2] efistub: Only link libstub to final vmlinux

Huacai Chen chenhuacai at kernel.org
Fri Nov 28 02:11:26 PST 2025


On Tue, Nov 25, 2025 at 9:49 AM Josh Poimboeuf <jpoimboe at kernel.org> wrote:
>
> On Sun, Nov 23, 2025 at 11:37:14AM +0800, Tiezhu Yang wrote:
> > On 11/23/25 10:29, Huacai Chen wrote:
> > > Is it possible to improve objtool that can handle indirect __noreturn functions?
>
> Someday that will be possible via a new compiler feature or plugin.  But
> today it can't be done.
>
> > > Is it possible to improve objtool that can handle
> > > OBJECT_FILES_NON_STANDARD event LTO is enabled?
>
> No, that is purely a makefile construct which should in general be
> avoided anyway for a variety of reasons.
>
> > > Is it possible to improve objtool that only ignore __efistub prefix
> > > for LoongArch?
> > [...]
> > static int validate_branch()
> > {
> > ...
> >                       if (arch_is_efistub(func))
> >                               return 0;
> >
> >                       if (file->ignore_unreachables)
> >                               return 0;
> >
> >                       WARN("%s() falls through to next function %s()",
> >                            func->name, insn_func(insn)->name);
> >                       func->warned = 1;
> >
> >                       return 1;
> > ...
> > }
>
> That only silences the warning, it doesn't prevent objtool from doing
> the actual stack validation or ORC generation.  Neither of which makes
> sense for libstub.
>
> And objtool has many other features beyond just stack validation and
> ORC.  None of those make sense for libstub either.
>
> To fully exclude all libstub code from objtool, these arch_is_efistub()
> checks would need to be sprinkled all over the place.
If the call sites are less than 5, I think it is acceptable.

Huacai

>
> That would be a lot more fragile than just excluding libstub from
> vmlinux.o in the first place.
>
> --
> Josh



More information about the linux-riscv mailing list