public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux regressions mailing list <regressions@lists.linux.dev>,
	irogers@google.com
Subject: Re: [Regression in 6.19-rc6] Build breakage after commit 436326bc525d
Date: Wed, 21 Jan 2026 07:06:28 -0500	[thread overview]
Message-ID: <aXDBRPmk1N5m6Jr-@laps> (raw)
In-Reply-To: <5fez6crfpybdn4vzjtb6ii2cv4wni5rscbbhjzk6hapjsqy4ym@5hcyya4uc534>

On Tue, Jan 20, 2026 at 09:29:21PM -0800, Josh Poimboeuf wrote:
>On Tue, Jan 20, 2026 at 08:18:35PM -0500, Sasha Levin wrote:
>> On Tue, Jan 20, 2026 at 10:33:12PM +0100, Rafael J. Wysocki wrote:
>> > On Tue, Jan 20, 2026 at 9:22 PM Sasha Levin <sashal@kernel.org> wrote:
>> > >
>> > > On Tue, Jan 20, 2026 at 09:04:25PM +0100, Rafael J. Wysocki wrote:
>> > > >On Tue, Jan 20, 2026 at 8:58 PM Sasha Levin <sashal@kernel.org> wrote:
>> > > >>
>> > > >> On Tue, Jan 20, 2026 at 07:29:58PM +0100, Rafael J. Wysocki wrote:
>> > > >> >On Tue, Jan 20, 2026 at 6:40 PM Sasha Levin <sashal@kernel.org> wrote:
>> > > >> >>
>> > > >> >> On Tue, Jan 20, 2026 at 11:28:32AM +0100, Peter Zijlstra wrote:
>> > > >> >> >On Mon, Jan 19, 2026 at 09:19:31PM +0100, Rafael J. Wysocki wrote:
>> > > >> >> >> Hi Sasha,
>> > > >> >> >>
>> > > >> >> >> Commit 436326bc525d ("objtool: fix build failure due to missing
>> > > >> >> >> libopcodes check") breaks kernel build for me.
>> > > >> >> >>
>> > > >> >> >> Here's what I get when I try to build the kernel after that commit:
>> > > >> >> >>
>> > > >> >> >>   LD      /scratch/rafael/work/build/xps13/tools/objtool/objtool-in.o
>> > > >> >> >>   LINK    /scratch/rafael/work/build/xps13/tools/objtool/objtool
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../x86_64-suse-linux/bin/ld:
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../lib64/libopcodes.a(aarch64-dis.o):
>> > > >> >> >> in function `print_operands':
>> > > >> >> >> /home/abuild/rpmbuild/BUILD/binutils-2.45/build-dir/opcodes/../../opcodes/aarch64-dis.c:3945:(.text+0x6317):
>> > > >> >> >> undefined reference to `xmalloc'
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../x86_64-suse-linux/bin/ld:
>> > > >> >> >> /home/abuild/rpmbuild/BUILD/binutils-2.45/build-dir/opcodes/../../opcodes/aarch64-dis.c:3992:(.text+0x6723):
>> > > >> >> >> undefined reference to `_sch_istable'
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../x86_64-suse-linux/bin/ld:
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../lib64/libopcodes.a(aarch64-dis.o):
>> > > >> >> >> in function `print_insn_aarch64':
>> > > >> >> >> /home/abuild/rpmbuild/BUILD/binutils-2.45/build-dir/opcodes/../../opcodes/aarch64-dis.c:4559:(.text+0x6b1e):
>> > > >> >> >> undefined reference to `bfd_get_bits'
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../x86_64-suse-linux/bin/ld:
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../lib64/libopcodes.a(aarch64-dis.o):
>> > > >> >> >> in function `parse_aarch64_dis_option':
>> > > >> >> >> /home/abuild/rpmbuild/BUILD/binutils-2.45/build-dir/opcodes/../../opcodes/aarch64-dis.c:103:(.text+0x6dea):
>> > > >> >> >> undefined reference to `_bfd_error_handler'
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../x86_64-suse-linux/bin/ld:
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../lib64/libopcodes.a(aarch64-opc.o):
>> > > >> >> >> in function `init_insn_sequence':
>> > > >> >> >> /home/abuild/rpmbuild/BUILD/binutils-2.45/build-dir/opcodes/../../opcodes/aarch64-opc.c:5561:(.text+0x5c06):
>> > > >> >> >> undefined reference to `xcalloc'
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../x86_64-suse-linux/bin/ld:
>> > > >> >> >> /usr/lib64/gcc/x86_64-suse-linux/15/../../../../lib64/libopcodes.a(disassemble.o):
>> > > >> >> >> in function `remove_whitespace_and_extra_commas':
>> > > >> >> >> /home/abuild/rpmbuild/BUILD/binutils-2.45/build-dir/opcodes/../../opcodes/disassemble.c:801:(.text+0x346):
>> > > >> >> >> undefined reference to `_sch_istable'
>> > > >> >> >> ...
>> > > >> >> >>
>> > > >> >> >> (many more similar messages skipped).
>> > > >> >> >>
>> > > >> >> >> Reverting commit 436326bc525d makes the problem go away.
>> > > >> >>
>> > > >> >> Thanks for the report Rafael!
>> > > >> >>
>> > > >> >> Could you confirm that you're linking against static libraries? I haven't
>> > > >> >> tested that scenario.
>> > > >> >
>> > > >> >How do I check that?
>> > > >>
>> > > >> What do you get running the below?
>> > > >>
>> > > >>    ls /usr/lib/*/libopcodes*
>> > > >
>> > > >"No such file or directory"
>> > > >
>> > > >However,
>> > > >
>> > > >> ls /usr/lib64/libopcodes*
>> > > >/usr/lib64/libopcodes-2.45.0.20251103-150100757.so  /usr/lib64/libopcodes.a
>> > >
>> > > The linker looks for libopcodes.so (not the versioned .so). Without that
>> > > symlink, it falls back to libopcodes.a. So yes, looks like you're using static
>> > > linking.
>> > >
>> > > To confirm, can you try to:
>> > >
>> > >    sudo ln -s libopcodes-2.45.0.20251103-150100757.so /usr/lib64/libopcodes.so
>> > >
>> > > Any then running the build again?
>> >
>> > Yes, this makes the build work (without reverting the commit in question).
>>
>> Great! So something like the patch below should fix the static scenario. I've
>> tested it locally on Debian but it'll be great to give it a go on a different
>> distro.
>>
>> It's also a bit ugly, but I'm not really sure what we can do about it. No
>> dependency info in static libs :/
>>
>>
>> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
>> index 9b4503113ce5f..a40f302329291 100644
>> --- a/tools/objtool/Makefile
>> +++ b/tools/objtool/Makefile
>> @@ -77,8 +77,21 @@ HOST_OVERRIDES := CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)"
>>  # We check using HOSTCC directly rather than the shared feature framework
>>  # because objtool is a host tool that links against host libraries.
>>  #
>> -HAVE_LIBOPCODES := $(shell echo 'int main(void) { return 0; }' | \
>> -                       $(HOSTCC) -xc - -o /dev/null -lopcodes 2>/dev/null && echo y)
>> +# When using shared libraries, -lopcodes is sufficient as dependencies are
>> +# resolved automatically. With static libraries, we must explicitly link
>> +# against libopcodes' dependencies: libbfd, libiberty, and sometimes libz.
>> +# Try each combination and use the first one that succeeds.
>> +#
>> +LIBOPCODES_LIBS := $(shell \
>> +       for libs in "-lopcodes" \
>> +                   "-lopcodes -lbfd" \
>> +                   "-lopcodes -lbfd -liberty" \
>> +                   "-lopcodes -lbfd -liberty -lz"; do \
>
>Instead of hard-coding all the libraries, I think we can just use
>pkg-config to tell us the needed dependencies.
>
>See for example what we're already doing elsewhere in that Makefile:
>
>LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
>LIBELF_LIBS  := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)

It works for elfutils because they adopted pkg-config, but binutils doesn't
work with pkg-config:

$ pkg-config libelf --libs
-lelf 

$ pkg-config libopcodes --libs
Package libopcodes was not found in the pkg-config search path.
Perhaps you should add the directory containing `libopcodes.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libopcodes', required by 'virtual:world', not found

-- 
Thanks,
Sasha

  reply	other threads:[~2026-01-21 12:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19 20:19 [Regression in 6.19-rc6] Build breakage after commit 436326bc525d Rafael J. Wysocki
2026-01-20 10:28 ` Peter Zijlstra
2026-01-20 17:40   ` Sasha Levin
2026-01-20 18:29     ` Rafael J. Wysocki
2026-01-20 19:58       ` Sasha Levin
2026-01-20 20:04         ` Rafael J. Wysocki
2026-01-20 20:22           ` Sasha Levin
2026-01-20 21:33             ` Rafael J. Wysocki
2026-01-21  1:18               ` Sasha Levin
2026-01-21  5:29                 ` Josh Poimboeuf
2026-01-21 12:06                   ` Sasha Levin [this message]
2026-01-21 16:25                     ` [PATCH] objtool: fix libopcodes linking with static libraries Sasha Levin
2026-01-21 19:08                       ` Rafael J. Wysocki
2026-01-21 19:25                         ` Peter Zijlstra
2026-01-21 19:28                       ` [tip: objtool/urgent] objtool: Fix " tip-bot2 for Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aXDBRPmk1N5m6Jr-@laps \
    --to=sashal@kernel.org \
    --cc=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=regressions@lists.linux.dev \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox