LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] recordmcount: Support empty section from recent binutils
@ 2021-11-24 14:43 Christophe Leroy
2021-11-26 8:43 ` LEROY Christophe
0 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2021-11-24 14:43 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Christophe Leroy, linux-kernel, linuxppc-dev, Steven Rostedt
Looks like recent binutils (2.36 and over ?) may empty some section,
leading to failure like:
Cannot find symbol for section 11: .text.unlikely.
kernel/kexec_file.o: failed
make[1]: *** [scripts/Makefile.build:287: kernel/kexec_file.o] Error 1
In order to avoid that, ensure that the section has a content before
returning it's name in has_rel_mcount().
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Link: https://github.com/linuxppc/issues/issues/388
Link: https://lore.kernel.org/all/20210215162209.5e2a475b@gandalf.local.home/
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
scripts/recordmcount.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 1e9baa5c4fc6..cc6600b729ae 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -575,6 +575,8 @@ static char const *has_rel_mcount(Elf_Shdr const *const relhdr,
char const *const shstrtab,
char const *const fname)
{
+ if (!shdr0->sh_size)
+ return NULL;
if (w(relhdr->sh_type) != SHT_REL && w(relhdr->sh_type) != SHT_RELA)
return NULL;
return __has_rel_mcount(relhdr, shdr0, shstrtab, fname);
--
2.33.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] recordmcount: Support empty section from recent binutils
2021-11-24 14:43 [PATCH] recordmcount: Support empty section from recent binutils Christophe Leroy
@ 2021-11-26 8:43 ` LEROY Christophe
2021-11-29 17:43 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: LEROY Christophe @ 2021-11-26 8:43 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: linux-kernel, linuxppc-dev, Steven Rostedt
Le 24/11/2021 à 15:43, Christophe Leroy a écrit :
> Looks like recent binutils (2.36 and over ?) may empty some section,
> leading to failure like:
>
> Cannot find symbol for section 11: .text.unlikely.
> kernel/kexec_file.o: failed
> make[1]: *** [scripts/Makefile.build:287: kernel/kexec_file.o] Error 1
>
> In order to avoid that, ensure that the section has a content before
> returning it's name in has_rel_mcount().
This patch doesn't work, on PPC32 I get the following message with this
patch applied:
[ 0.000000] ftrace: No functions to be traced?
Without the patch I get:
[ 0.000000] ftrace: allocating 22381 entries in 66 pages
[ 0.000000] ftrace: allocated 66 pages with 2 groups
Christophe
>
> Suggested-by: Steven Rostedt <rostedt@goodmis.org>
> Link: https://github.com/linuxppc/issues/issues/388
> Link: https://lore.kernel.org/all/20210215162209.5e2a475b@gandalf.local.home/
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> scripts/recordmcount.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
> index 1e9baa5c4fc6..cc6600b729ae 100644
> --- a/scripts/recordmcount.h
> +++ b/scripts/recordmcount.h
> @@ -575,6 +575,8 @@ static char const *has_rel_mcount(Elf_Shdr const *const relhdr,
> char const *const shstrtab,
> char const *const fname)
> {
> + if (!shdr0->sh_size)
> + return NULL;
> if (w(relhdr->sh_type) != SHT_REL && w(relhdr->sh_type) != SHT_RELA)
> return NULL;
> return __has_rel_mcount(relhdr, shdr0, shstrtab, fname);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] recordmcount: Support empty section from recent binutils
2021-11-26 8:43 ` LEROY Christophe
@ 2021-11-29 17:43 ` Steven Rostedt
2021-11-29 17:56 ` Christophe Leroy
0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2021-11-29 17:43 UTC (permalink / raw)
To: LEROY Christophe; +Cc: Peter Zijlstra, linux-kernel, linuxppc-dev
On Fri, 26 Nov 2021 08:43:23 +0000
LEROY Christophe <christophe.leroy@csgroup.eu> wrote:
> Le 24/11/2021 à 15:43, Christophe Leroy a écrit :
> > Looks like recent binutils (2.36 and over ?) may empty some section,
> > leading to failure like:
> >
> > Cannot find symbol for section 11: .text.unlikely.
> > kernel/kexec_file.o: failed
> > make[1]: *** [scripts/Makefile.build:287: kernel/kexec_file.o] Error 1
> >
> > In order to avoid that, ensure that the section has a content before
> > returning it's name in has_rel_mcount().
>
> This patch doesn't work, on PPC32 I get the following message with this
> patch applied:
>
> [ 0.000000] ftrace: No functions to be traced?
>
> Without the patch I get:
>
> [ 0.000000] ftrace: allocating 22381 entries in 66 pages
> [ 0.000000] ftrace: allocated 66 pages with 2 groups
Because of this report, I have not applied this patch (even though I was
about to push it to Linus).
I'm pulling it from my queue until this gets resolved.
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] recordmcount: Support empty section from recent binutils
2021-11-29 17:43 ` Steven Rostedt
@ 2021-11-29 17:56 ` Christophe Leroy
2022-03-28 22:31 ` Joel Stanley
0 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2021-11-29 17:56 UTC (permalink / raw)
To: Steven Rostedt, Segher Boessenkool
Cc: Peter Zijlstra, linux-kernel, linuxppc-dev
Le 29/11/2021 à 18:43, Steven Rostedt a écrit :
> On Fri, 26 Nov 2021 08:43:23 +0000
> LEROY Christophe <christophe.leroy@csgroup.eu> wrote:
>
>> Le 24/11/2021 à 15:43, Christophe Leroy a écrit :
>>> Looks like recent binutils (2.36 and over ?) may empty some section,
>>> leading to failure like:
>>>
>>> Cannot find symbol for section 11: .text.unlikely.
>>> kernel/kexec_file.o: failed
>>> make[1]: *** [scripts/Makefile.build:287: kernel/kexec_file.o] Error 1
>>>
>>> In order to avoid that, ensure that the section has a content before
>>> returning it's name in has_rel_mcount().
>>
>> This patch doesn't work, on PPC32 I get the following message with this
>> patch applied:
>>
>> [ 0.000000] ftrace: No functions to be traced?
>>
>> Without the patch I get:
>>
>> [ 0.000000] ftrace: allocating 22381 entries in 66 pages
>> [ 0.000000] ftrace: allocated 66 pages with 2 groups
>
> Because of this report, I have not applied this patch (even though I was
> about to push it to Linus).
>
> I'm pulling it from my queue until this gets resolved.
>
I have no idea on how to fix that for the moment.
With GCC 10 (binutils 2.36) an objdump -x on kernel/kexec_file.o gives:
0000000000000000 l d .text.unlikely 0000000000000000 .text.unlikely
0000000000000000 w F .text.unlikely 0000000000000038
.arch_kexec_apply_relocations_add
0000000000000038 w F .text.unlikely 0000000000000038
.arch_kexec_apply_relocations
With GCC 11 (binutils 2.37) the same gives:
0000000000000000 w F .text.unlikely 0000000000000038
.arch_kexec_apply_relocations_add
0000000000000038 w F .text.unlikely 0000000000000038
.arch_kexec_apply_relocations
The problem is that recordmcount drops weak symbols, and it doesn't find
any non-weak symbol in .text.unlikely
Explication given at
https://elixir.bootlin.com/linux/v5.16-rc2/source/scripts/recordmcount.h#L506
I have no idea on what to do.
Thanks
Christophe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] recordmcount: Support empty section from recent binutils
2021-11-29 17:56 ` Christophe Leroy
@ 2022-03-28 22:31 ` Joel Stanley
2022-03-30 9:51 ` Christophe Leroy
0 siblings, 1 reply; 6+ messages in thread
From: Joel Stanley @ 2022-03-28 22:31 UTC (permalink / raw)
To: Christophe Leroy
Cc: Steven Rostedt, Segher Boessenkool, Peter Zijlstra, linux-kernel,
linuxppc-dev
On Mon, 29 Nov 2021 at 22:43, Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
>
>
> Le 29/11/2021 à 18:43, Steven Rostedt a écrit :
> > On Fri, 26 Nov 2021 08:43:23 +0000
> > LEROY Christophe <christophe.leroy@csgroup.eu> wrote:
> >
> >> Le 24/11/2021 à 15:43, Christophe Leroy a écrit :
> >>> Looks like recent binutils (2.36 and over ?) may empty some section,
> >>> leading to failure like:
> >>>
> >>> Cannot find symbol for section 11: .text.unlikely.
> >>> kernel/kexec_file.o: failed
> >>> make[1]: *** [scripts/Makefile.build:287: kernel/kexec_file.o] Error 1
> >>>
> >>> In order to avoid that, ensure that the section has a content before
> >>> returning it's name in has_rel_mcount().
> >>
> >> This patch doesn't work, on PPC32 I get the following message with this
> >> patch applied:
> >>
> >> [ 0.000000] ftrace: No functions to be traced?
> >>
> >> Without the patch I get:
> >>
> >> [ 0.000000] ftrace: allocating 22381 entries in 66 pages
> >> [ 0.000000] ftrace: allocated 66 pages with 2 groups
> >
> > Because of this report, I have not applied this patch (even though I was
> > about to push it to Linus).
> >
> > I'm pulling it from my queue until this gets resolved.
> >
>
> I have no idea on how to fix that for the moment.
>
> With GCC 10 (binutils 2.36) an objdump -x on kernel/kexec_file.o gives:
>
> 0000000000000000 l d .text.unlikely 0000000000000000 .text.unlikely
> 0000000000000000 w F .text.unlikely 0000000000000038
> .arch_kexec_apply_relocations_add
> 0000000000000038 w F .text.unlikely 0000000000000038
> .arch_kexec_apply_relocations
>
>
> With GCC 11 (binutils 2.37) the same gives:
>
> 0000000000000000 w F .text.unlikely 0000000000000038
> .arch_kexec_apply_relocations_add
> 0000000000000038 w F .text.unlikely 0000000000000038
> .arch_kexec_apply_relocations
>
>
> The problem is that recordmcount drops weak symbols, and it doesn't find
> any non-weak symbol in .text.unlikely
>
> Explication given at
> https://elixir.bootlin.com/linux/v5.16-rc2/source/scripts/recordmcount.h#L506
>
> I have no idea on what to do.
Did you end up finding a solution for this issue?
Cheers,
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] recordmcount: Support empty section from recent binutils
2022-03-28 22:31 ` Joel Stanley
@ 2022-03-30 9:51 ` Christophe Leroy
0 siblings, 0 replies; 6+ messages in thread
From: Christophe Leroy @ 2022-03-30 9:51 UTC (permalink / raw)
To: Joel Stanley
Cc: Steven Rostedt, Segher Boessenkool, Peter Zijlstra, linux-kernel,
linuxppc-dev
Le 29/03/2022 à 00:31, Joel Stanley a écrit :
> On Mon, 29 Nov 2021 at 22:43, Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>>
>>
>> Le 29/11/2021 à 18:43, Steven Rostedt a écrit :
>>> On Fri, 26 Nov 2021 08:43:23 +0000
>>> LEROY Christophe <christophe.leroy@csgroup.eu> wrote:
>>>
>>>> Le 24/11/2021 à 15:43, Christophe Leroy a écrit :
>>>>> Looks like recent binutils (2.36 and over ?) may empty some section,
>>>>> leading to failure like:
>>>>>
>>>>> Cannot find symbol for section 11: .text.unlikely.
>>>>> kernel/kexec_file.o: failed
>>>>> make[1]: *** [scripts/Makefile.build:287: kernel/kexec_file.o] Error 1
>>>>>
>>>>> In order to avoid that, ensure that the section has a content before
>>>>> returning it's name in has_rel_mcount().
>>>>
>>>> This patch doesn't work, on PPC32 I get the following message with this
>>>> patch applied:
>>>>
>>>> [ 0.000000] ftrace: No functions to be traced?
>>>>
>>>> Without the patch I get:
>>>>
>>>> [ 0.000000] ftrace: allocating 22381 entries in 66 pages
>>>> [ 0.000000] ftrace: allocated 66 pages with 2 groups
>>>
>>> Because of this report, I have not applied this patch (even though I was
>>> about to push it to Linus).
>>>
>>> I'm pulling it from my queue until this gets resolved.
>>>
>>
>> I have no idea on how to fix that for the moment.
>>
>> With GCC 10 (binutils 2.36) an objdump -x on kernel/kexec_file.o gives:
>>
>> 0000000000000000 l d .text.unlikely 0000000000000000 .text.unlikely
>> 0000000000000000 w F .text.unlikely 0000000000000038
>> .arch_kexec_apply_relocations_add
>> 0000000000000038 w F .text.unlikely 0000000000000038
>> .arch_kexec_apply_relocations
>>
>>
>> With GCC 11 (binutils 2.37) the same gives:
>>
>> 0000000000000000 w F .text.unlikely 0000000000000038
>> .arch_kexec_apply_relocations_add
>> 0000000000000038 w F .text.unlikely 0000000000000038
>> .arch_kexec_apply_relocations
>>
>>
>> The problem is that recordmcount drops weak symbols, and it doesn't find
>> any non-weak symbol in .text.unlikely
>>
>> Explication given at
>> https://elixir.bootlin.com/linux/v5.16-rc2/source/scripts/recordmcount.h#L506
>>
>> I have no idea on what to do.
>
> Did you end up finding a solution for this issue?
>
Not really, my solution was to switch to the kernel compiler at
https://mirrors.edge.kernel.org/pub/tools/crosstool/ which embeds
binutils 2.36
But it looks like using objtool instead of recordmcount doesn't exhibit
the problem.
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220318105140.43914-4-sv@linux.ibm.com/
Christophe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-30 9:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 14:43 [PATCH] recordmcount: Support empty section from recent binutils Christophe Leroy
2021-11-26 8:43 ` LEROY Christophe
2021-11-29 17:43 ` Steven Rostedt
2021-11-29 17:56 ` Christophe Leroy
2022-03-28 22:31 ` Joel Stanley
2022-03-30 9:51 ` Christophe Leroy
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).