Re: libelf-0.175 breaks objtool
From: Arnd Bergmann
Date: Tue Apr 07 2020 - 14:44:34 EST
On Tue, Apr 7, 2020 at 6:33 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> On Tue, Apr 07, 2020 at 05:46:23PM +0200, Arnd Bergmann wrote:
> > On Tue, Apr 7, 2020 at 12:31 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> > > On Tue, Apr 7, 2020 at 12:16 AM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> > >
> > > 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.
> >
> > I found where -g gets added in both cases, and adding -gz=none
> > seems to address all randconfigs with CONFIG_DEBUG_INFO=n:
> >
> > --- a/fs/xfs/Makefile
> > +++ b/fs/xfs/Makefile
> > @@ -7,7 +7,7 @@
> > ccflags-y += -I $(srctree)/$(src) # needed for trace events
> > ccflags-y += -I $(srctree)/$(src)/libxfs
> >
> > -ccflags-$(CONFIG_XFS_DEBUG) += -g
> > +ccflags-$(CONFIG_XFS_DEBUG) += -g $(call cc-option,-gz=none)
>
> Maybe they shouldn't have -g in the first place?
That is very possible. The -g has been there since xfs was originally merged
back in 2002, and I could not figure out why it was there (unlike the
-DSTATIC=""
and -DDEBUG flags that are set in the same line).
On the other hand, my feeling is that setting -g should not cause problems
with objtool, if CONFIG_DEBUG_INFO is ok.
Arnd