Re: [PATCH] objtool: fix libopcodes linking with static libraries

From: Peter Zijlstra

Date: Wed Jan 21 2026 - 14:25:35 EST


On Wed, Jan 21, 2026 at 08:08:51PM +0100, Rafael J. Wysocki wrote:
> On Wed, Jan 21, 2026 at 5:25 PM Sasha Levin <sashal@xxxxxxxxxx> wrote:
> >
> > Commit 436326bc525d ("objtool: fix build failure due to missing libopcodes
> > check") tests for libopcodes using an empty main(), which passes even when
> > static libraries lack their dependencies. This causes undefined reference
> > errors (xmalloc, bfd_get_bits, etc.) when linking against static libopcodes
> > without its required libbfd and libiberty.
> >
> > Fix by testing with an actual libopcodes symbol and trying increasingly
> > complete library combinations until one succeeds.
> >
> > Fixes: 436326bc525d ("objtool: fix build failure due to missing libopcodes check")
> > Reported-by: Rafael J. Wysocki <rafael@xxxxxxxxxx>
> > Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> > ---
> >
> > Rafael, I'd appreciate if you could test this patch without the .so symlink
> > workaround. Thanks :)
>
> Works here, so
>
> Tested-by: Rafael J. Wysocki (Intel) <rafael@xxxxxxxxxx>

Excellent, thanks all!