Re: [PATCH] scripts/recordmcount.pl: Support build with -ffunction-sections.

From: Will Newton
Date: Tue Oct 30 2012 - 13:43:19 EST


On Tue, Oct 30, 2012 at 4:05 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Tue, 2012-10-30 at 15:35 +0000, Will Newton wrote:
>> On Tue, Oct 30, 2012 at 3:05 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>> > On Tue, 2012-10-30 at 14:51 +0000, Will Newton wrote:
>> >> Scan any text section whose name begins with ".text." so
>> >> we will find all the functions in a kernel built with
>> >> -ffunction-sections.
>> >
>> > A couple of things.
>> >
>> > First, I'm very paranoid about a blanket "ok" on sections. We must
>> > guarantee that all sections that starts with ".text" never is freed. And
>> > if it is freed, that it must inform ftrace that it's about to free it
>> > before it does. If we can not guarantee this, then we can't do it.
>>
>> I share that concern, however it looks like it should be safe.
>
> Can we confirm that it is safe. I'm not too confident with the words
> "looks like" ;-)

Ok, well we are only concerned with C compiled code, otherwise there
would be no calls to mcount? The only way I can think of to cause code
to be emitted in a section of this type is to use the section
attribute. A quick grep for __attribute__(__section__ or __section
does not turn up any sections that are named .text.* on any
architecture (freed or not).

Is there any other case I have missed? I also did a grep for .text.
more generally and didn't see anything that looked problematic
(although it is mainly .S files so not relevant).

>>
>> > Second, most archs today do not use recordmcount.pl. They use the new
>> > recordmcount.c file.
>>
>> Ok, thanks for letting me know. Is the plan to switch over to
>> recordmcount.c exclusively at some point?
>
> When all the archs convert.

I'll rework my patch against recordmcount.c once I have it working.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/