linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Russell King - ARM Linux <linux@armlinux.org.uk>
Subject: Re: Linker error `.exit.text' referenced in section `.alt.smp.init'
Date: Tue, 28 May 2019 13:41:47 +0200	[thread overview]
Message-ID: <a0f867e5f3f553ebdb8dc35157450495@agner.ch> (raw)
In-Reply-To: <CAK8P3a1rBt8JLjaDqL-0FnFhUR=f5nsqF8tJhYzOjHyTf18+dg@mail.gmail.com>

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

  reply	other threads:[~2019-05-28 11:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-05-28 11:53     ` Russell King - ARM Linux admin

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=a0f867e5f3f553ebdb8dc35157450495@agner.ch \
    --to=stefan@agner.ch \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=mhiramat@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;
as well as URLs for NNTP newsgroup(s).