Subject: Re: linux-next: build warnings from the build of Linus' tree

From: Masami Hiramatsu <[email-masked]>
Date: Tue, 11 Sep 2018 20:49:25 +0900

On Mon, 10 Sep 2018 15:27:20 +0200
Peter Oberparleiter <[email-masked]> wrote:

> On 08.09.2018 05:57, Masami Hiramatsu wrote:
> > On Fri, 7 Sep 2018 14:50:59 +0200
> > Peter Oberparleiter <[email-masked]> wrote:
> > 
> >> On 06.09.2018 18:42, Masami Hiramatsu wrote:
> >>> Peter Oberparleiter <[email-masked]> wrote:
> >>>> I've attached a quick fix that should address both problems. I'd
> >>>> appreciate if this patch could get some testing before I post proper fix
> >>>> patches.
> >>>
> >>> Hmm, I'm still not able to reproduce it on powerpc cross build even with
> >>> CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y ... So, sorry I couldn't test this patch.
> >>
> >> Maybe this is related to the compiler/binutils versions used. I'm using
> >> Fedora 28's gcc-powerpc64 and binutils-powerpc64 packages:
> >>
> >> powerpc64-linux-gnu-gcc (GCC) 7.1.1 20170622 (Red Hat Cross 7.1.1-3)
> >> GNU ld version 2.29.1-4.fc28
> >>
> >> For reference I'm also attaching the config that I used to reproduce the
> >> problem on kernel v4.18.
> >>
> >>>> diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/kernel/vmlinux.lds.h
> >>>> index ae5fdff18406..2ca33277a28b 100644
> >>>> --- a/arch/arm/kernel/vmlinux.lds.h
> >>>> +++ b/arch/arm/kernel/vmlinux.lds.h
> >>>> @@ -48,6 +48,7 @@
> >>>>
> >>>>  #define ARM_DISCARD							\
> >>>>  		*(.ARM.exidx.exit.text)					\
> >>>> +		*(.ARM.exidx.text.exit)					\
> >>>
> >>> BTW, why would we need this?
> >>
> >> That's necessary to fix one of the two ARM linker failures reported via
> >> https://lkml.org/lkml/2018/8/24/345
> >>
> >>>>> `.text.exit' referenced in section `.ARM.exidx.text.exit' of
> >>>>> kernel/trace/trace_clock.o: defined in discarded section `.text.exit'
> >>>>> of kernel/trace/trace_clock.o
> >>
> >> Section ".ARM.exidx.text.exit" refers to ".text.exit" which was
> >> discarded. With the change above, the extraneous section
> >> ".ARM.exidx.text.exit" is also discarded, resolving the linker failure.
> > 
> > OK, so your patch fixes following issue too?
> > 
> > https://patchwork.kernel.org/patch/10584685/
> 
> Yes it does, by discarding the text.exit section unconditionally. I
> don't think we need to keep any exit-related section introduced by GCOV
> profiling. It is my understanding that the code contained in such a
> section is only relevant for user-space profiling, to process profiling
> data when a program ends.
> 
> Also discarding .ARM.exidx.text.exit seems to be more consistent to how
> .ARM.exidx.exit.text is handled.
> 
> > In that case, we should drop above patch.
> 
> Yes, I agree.

Hm, with your patch (on linus tree), I still have this error on arm cross build.

  CC      init/version.o
  AR      init/built-in.a
  AR      built-in.a
  LD      vmlinux.o
  MODPOST vmlinux.o
`.exit.text' referenced in section `.alt.smp.init' of net/dns_resolver/dns_key.o: defined in discarded section `.exit.text' of net/dns_resolver/dns_key.o

I attached my config.

Since this comes from section discarding, with my patch (which prevent discarding) this error didn't happen.

Thank you,

-- 
Masami Hiramatsu <[email-masked]>