Re: libelf-0.175 breaks objtool

From: Arnd Bergmann
Date: Mon Apr 06 2020 - 18:32:03 EST


On Tue, Apr 7, 2020 at 12:16 AM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> On Mon, Apr 06, 2020 at 11:07:15PM +0200, Arnd Bergmann wrote:
> > On Wed, Feb 6, 2019 at 7:32 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > > On Tue, 5 Feb 2019 20:16:11 -0600 Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> > >
> > > > On Tue, Feb 05, 2019 at 01:38:21PM -0500, Steven Rostedt wrote:
> > > > > Just a FYI.
> > > > >
> > > > > After a recent upgrade in debian testing, I was not able to build the
> > > > > kernel. I have a custom build of gcc, so I thought it was strange that
> > > > > I was getting something like this (took this from the web, as I don't
> > > > > have the error anymore with the work around, and currently doing a full
> > > > > build):
> > > > >
> > > > > objdump: kernel/.tmp_signal.o: unable to initialize decompress status for section .debug_info
> > > > > objdump: kernel/.tmp_signal.o: unable to initialize decompress status for section .debug_info
> > > > > objdump: kernel/.tmp_signal.o: file format not recognized
> > > > > CC arch/x86/kernel/platform-quirks.o
> > > > > objdump: arch/x86/kernel/.tmp_ebda.o: unable to initialize decompress status for section .debug_info
> > > > > objdump: arch/x86/kernel/.tmp_ebda.o: unable to initialize decompress status for section .debug_info
> > > > > objdump: arch/x86/kernel/.tmp_ebda.o: file format not recognized
> > > > > objdump: mm/.tmp_swap_slots.o: unable to initialize decompress status for section .debug_info
> > > > > objdump: mm/.tmp_swap_slots.o: unable to initialize decompress status for section .debug_info
> > > > > objdump: mm/.tmp_swap_slots.o: file format not recognized
> > > >
> > > > I installed debian testing on a VM, which has libelf 0.175-2, but I
> > >
> > > Hmm, I only have libelf-0.175 (no -2)
> > >
> > > > can't recreate. Can you share your config?
> > > >
> > >
> > > It's just a distro config. Ah, I think it's because I'm compiling my
> > > own home built gcc. There seems to be an incompatibility with the
> > > binutils that I used and with libelf-0.175. If I build with just the
> > > distro gcc, it works.
> > >
> > > Bah, this means I need to recreate my gcc that I use to build my
> > > kernels with :-p As I like to control which gcc I use.
> >
> > I now see the same problem that you reported using the gcc-9
> > toolchain I provide on https://kernel.org/pub/tools/crosstool/.
> >
> > Do you have any other information that might help me fix it?
>
> This sounds like an issue I saw before where the toolchain wants to
> compress debuginfo (DWARF debug_info sections). The "fix" was to add
> '-gz=none' to KCFLAGS.
>
> But if it's a desired feature then we could probably teach objtool to
> deal with it. It ignores DWARF anyway.

This sounds odd, as I have CONFIG_DEBUG_INFO disabled in all
my randconfig builds.

It's also odd that I only see the problem in two specific files:
arch/x86/realmode/rm/trampoline_64.o (in half of the randconfig builds)
and fs/xfs/xfs_trace.o (in only one configuration so far).

With this patch I can avoid the first one, which is unconditionally
built with -g (why?):

--- a/arch/x86/realmode/rm/Makefile
+++ b/arch/x86/realmode/rm/Makefile
@@ -69,7 +69,7 @@ $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
# ---------------------------------------------------------------------------

KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
- -I$(srctree)/arch/x86/boot
+ -I$(srctree)/arch/x86/boot -gz=none
KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
GCOV_PROFILE := n

I'll look at the other one tomorrow.

Arnd