linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Linker error `.exit.text' referenced in section `.alt.smp.init'
@ 2019-05-28  7:12 Stefan Agner
  2019-05-28  7:32 ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Agner @ 2019-05-28  7:12 UTC (permalink / raw)
  To: Masami Hiramatsu, linux; +Cc: linux-arm-kernel, arnd

Hi,

Cross compiling Linux v5.2-rc2 with CONFIG_DNS_RESOLVER=y using gcc 8.2
I noticed the following build error:

...
  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  AR      init/built-in.a
  LD      vmlinux.o
  MODPOST vmlinux.o
  MODINFO modules.builtin.modinfo
`.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                                              
                              
make: *** [Makefile:1052: vmlinux] Error 1

It seems that Masami noticed this a while back:
https://lore.kernel.org/lkml/20180911231012.fdc45840f3d91860daa2e180@kernel.org/T/#u

Anybody else seen this?

When I remove put_cred in exit_dns_resolver the kernel links fine...

--
Stefan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linker error `.exit.text' referenced in section `.alt.smp.init'
  2019-05-28  7:12 Linker error `.exit.text' referenced in section `.alt.smp.init' Stefan Agner
@ 2019-05-28  7:32 ` Arnd Bergmann
  2019-05-28 11:41   ` Stefan Agner
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2019-05-28  7:32 UTC (permalink / raw)
  To: Stefan Agner; +Cc: Masami Hiramatsu, Linux ARM, Russell King - ARM Linux

On Tue, May 28, 2019 at 9:12 AM Stefan Agner <stefan@agner.ch> wrote:
>
> Hi,
>
> Cross compiling Linux v5.2-rc2 with CONFIG_DNS_RESOLVER=y using gcc 8.2
> I noticed the following build error:
>
> ...
>   GEN     .version
>   CHK     include/generated/compile.h
>   UPD     include/generated/compile.h
>   CC      init/version.o
>   AR      init/built-in.a
>   LD      vmlinux.o
>   MODPOST vmlinux.o
>   MODINFO modules.builtin.modinfo
> `.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
>
> make: *** [Makefile:1052: vmlinux] Error 1
>
> It seems that Masami noticed this a while back:
> https://lore.kernel.org/lkml/20180911231012.fdc45840f3d91860daa2e180@kernel.org/T/#u
>
> Anybody else seen this?
>
> When I remove put_cred in exit_dns_resolver the kernel links fine...

I've seen two or thre of these in total. This only happens on 32-bit ARM
when a function that needs SMP patching gets inlined into an __exit
function. In this case, it's the atomic_dec_and_test().

The last one I fixed was https://lkml.org/lkml/2019/4/15/625
I think I've seen the one in the dns_resolver before but couldn't
reproduce it recently.

I used to have a patch that completely avoided dropping .exit when
SMP patching was active, but I think we can fix them up as they happen,
as I have built thousands of randconfig kernels without hitting this.

The easiestwork around here  would be to drop the __exit annotation
and add a comment. We could also move put_cred out-of-line and
make it non-__exit, or add an extern wrapper for it.

      Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linker error `.exit.text' referenced in section `.alt.smp.init'
  2019-05-28  7:32 ` Arnd Bergmann
@ 2019-05-28 11:41   ` Stefan Agner
  2019-05-28 11:53     ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Agner @ 2019-05-28 11:41 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Masami Hiramatsu, Linux ARM, Russell King - ARM Linux

On 28.05.2019 09:32, Arnd Bergmann wrote:
> On Tue, May 28, 2019 at 9:12 AM Stefan Agner <stefan@agner.ch> wrote:
>>
>> Hi,
>>
>> Cross compiling Linux v5.2-rc2 with CONFIG_DNS_RESOLVER=y using gcc 8.2
>> I noticed the following build error:
>>
>> ...
>>   GEN     .version
>>   CHK     include/generated/compile.h
>>   UPD     include/generated/compile.h
>>   CC      init/version.o
>>   AR      init/built-in.a
>>   LD      vmlinux.o
>>   MODPOST vmlinux.o
>>   MODINFO modules.builtin.modinfo
>> `.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
>>
>> make: *** [Makefile:1052: vmlinux] Error 1
>>
>> It seems that Masami noticed this a while back:
>> https://lore.kernel.org/lkml/20180911231012.fdc45840f3d91860daa2e180@kernel.org/T/#u
>>
>> Anybody else seen this?
>>
>> When I remove put_cred in exit_dns_resolver the kernel links fine...
> 
> I've seen two or thre of these in total. This only happens on 32-bit ARM
> when a function that needs SMP patching gets inlined into an __exit
> function. In this case, it's the atomic_dec_and_test().
> 
> The last one I fixed was https://lkml.org/lkml/2019/4/15/625
> I think I've seen the one in the dns_resolver before but couldn't
> reproduce it recently.
> 
> I used to have a patch that completely avoided dropping .exit when
> SMP patching was active, but I think we can fix them up as they happen,
> as I have built thousands of randconfig kernels without hitting this.

Yeah dropping .exit seems rather harsh.

> 
> The easiestwork around here  would be to drop the __exit annotation
> and add a comment. We could also move put_cred out-of-line and
> make it non-__exit, or add an extern wrapper for it.

Hm, both seem not very appealing to me. I think I'd rather prefer an
extern wrapper.

Is this an actual problem? As far as I understand that fixup happens
very early and only once during boot, so by the time the kernel drops
those .exit.text fixup has been done long time ago...

Is this maybe a case for __ref (defined in include/linux/init.h)?

Or could we have the section marked init/exit such that this does not
trigger the error?

--
Stefan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linker error `.exit.text' referenced in section `.alt.smp.init'
  2019-05-28 11:41   ` Stefan Agner
@ 2019-05-28 11:53     ` Russell King - ARM Linux admin
  0 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux admin @ 2019-05-28 11:53 UTC (permalink / raw)
  To: Stefan Agner; +Cc: Linux ARM, Masami Hiramatsu, Arnd Bergmann

On Tue, May 28, 2019 at 01:41:47PM +0200, Stefan Agner wrote:
> On 28.05.2019 09:32, Arnd Bergmann wrote:
> > On Tue, May 28, 2019 at 9:12 AM Stefan Agner <stefan@agner.ch> wrote:
> >>
> >> Hi,
> >>
> >> Cross compiling Linux v5.2-rc2 with CONFIG_DNS_RESOLVER=y using gcc 8.2
> >> I noticed the following build error:
> >>
> >> ...
> >>   GEN     .version
> >>   CHK     include/generated/compile.h
> >>   UPD     include/generated/compile.h
> >>   CC      init/version.o
> >>   AR      init/built-in.a
> >>   LD      vmlinux.o
> >>   MODPOST vmlinux.o
> >>   MODINFO modules.builtin.modinfo
> >> `.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
> >>
> >> make: *** [Makefile:1052: vmlinux] Error 1
> >>
> >> It seems that Masami noticed this a while back:
> >> https://lore.kernel.org/lkml/20180911231012.fdc45840f3d91860daa2e180@kernel.org/T/#u
> >>
> >> Anybody else seen this?
> >>
> >> When I remove put_cred in exit_dns_resolver the kernel links fine...
> > 
> > I've seen two or thre of these in total. This only happens on 32-bit ARM
> > when a function that needs SMP patching gets inlined into an __exit
> > function. In this case, it's the atomic_dec_and_test().
> > 
> > The last one I fixed was https://lkml.org/lkml/2019/4/15/625
> > I think I've seen the one in the dns_resolver before but couldn't
> > reproduce it recently.
> > 
> > I used to have a patch that completely avoided dropping .exit when
> > SMP patching was active, but I think we can fix them up as they happen,
> > as I have built thousands of randconfig kernels without hitting this.
> 
> Yeah dropping .exit seems rather harsh.
> 
> > 
> > The easiestwork around here  would be to drop the __exit annotation
> > and add a comment. We could also move put_cred out-of-line and
> > make it non-__exit, or add an extern wrapper for it.
> 
> Hm, both seem not very appealing to me. I think I'd rather prefer an
> extern wrapper.
> 
> Is this an actual problem? As far as I understand that fixup happens
> very early and only once during boot, so by the time the kernel drops
> those .exit.text fixup has been done long time ago...
> 
> Is this maybe a case for __ref (defined in include/linux/init.h)?
> 
> Or could we have the section marked init/exit such that this does not
> trigger the error?

Moving the SMP alternatives section doesn't change anything: the problem
is that the SMP alternatives are part of the image the linker creates,
but an entry in there refers to a section that we've told the linker
to discard.  The linker has no way to provide a value for that entry,
and so errors out.

I wonder if there's a way to tell the linker that it's a weak reference,
and modify the SMP fixup code to skip it.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-28 11:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28  7:12 Linker error `.exit.text' referenced in section `.alt.smp.init' Stefan Agner
2019-05-28  7:32 ` Arnd Bergmann
2019-05-28 11:41   ` Stefan Agner
2019-05-28 11:53     ` Russell King - ARM Linux admin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).