From: Tim Abbott on
On Mon, 14 Jun 2010, Matt Fleming wrote:

> Many architectures collect text sections beginning with '.text.' in
> their .text section, so move this pattern into TEXT_TEXT to stop them
> all having to duplicate the pattern in their arch/ linker scripts.

Hi Matt,

I think this change could result in problems such as the page-aligned text
sections (recently renamed from .text.page_aligned to .text..page_aligned)
that exist in some architectures being included the main text section in a
non-page-aligned fashion (and similar issues for other .text.foo
sections).

I was planning to submit in the next couple weeks a change that adds
support for building the kernel with -ffunction-sections -fdata-sections,
which would have as a piece of it adding to TEXT_TEXT the following
expression:

*(.text.[A-Za-z$_]*) /* handle -ffunction-sections */\

which should match the .text.foo sections generated by -ffunction-sections
but not the kernel's special sections which now all have names of the form
..text..foo. I suspect after that change, the cleanup of deleting .text.*
from the various architecture linker scripts that reference it should be
possible.

-Tim Abbott
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Sam Ravnborg on
On Mon, Jun 14, 2010 at 01:38:28PM +0100, Matt Fleming wrote:
> From: Matt Fleming <matthew.fleming(a)imgtec.com>
>
> Many architectures collect text sections beginning with '.text.' in
> their .text section, so move this pattern into TEXT_TEXT to stop them
> all having to duplicate the pattern in their arch/ linker scripts.
>
> Signed-off-by: Matt Fleming <matthew.fleming(a)imgtec.com>
> ---
> include/asm-generic/vmlinux.lds.h | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 48c5299..08f4680 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -369,6 +369,7 @@
> ALIGN_FUNCTION(); \
> *(.text.hot) \
> *(.text) \
> + *(.text.*) \
> *(.ref.text) \
> DEV_KEEP(init.text) \
> DEV_KEEP(exit.text) \

This will break ia64.
From their vmlinux.lds.h:

TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
*(.gnu.linkonce.t*)
}
.text2 : AT(ADDR(.text2) - LOAD_OFFSET)
{ *(.text2) }
#ifdef CONFIG_SMP
.text..lock : AT(ADDR(.text..lock) - LOAD_OFFSET)
{ *(.text..lock) }
#endif

The patch above we would match the section ".text.*" too soon and
add the .text..lock section at the wrong place.

Browsing the vmlinux.lds files other archs will be impacted too.

If you feel tempted to clean up the linker script one place to start
would be to introduce consistent indention / layout.
If you use arch/sparc/kernel/vmlinux.lds.h as a template then you
have a good start.

The above mentioned ia64 vmlinux.lds.h would be a good place to start.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Matt Fleming on
On Mon, 14 Jun 2010 20:22:12 +0200, Sam Ravnborg <sam(a)ravnborg.org> wrote:
>
> The patch above we would match the section ".text.*" too soon and
> add the .text..lock section at the wrong place.
>
> Browsing the vmlinux.lds files other archs will be impacted too.

Yeah, good point. James Bottomley has already pointed out how this
change completely breaks parisc. I'll drop this series.

Thanks for the review!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Matt Fleming on
On Mon, 14 Jun 2010 10:32:46 -0400 (EDT), Tim Abbott <tabbott(a)ksplice.com> wrote:
>
> I was planning to submit in the next couple weeks a change that adds
> support for building the kernel with -ffunction-sections -fdata-sections,
> which would have as a piece of it adding to TEXT_TEXT the following
> expression:
>
> *(.text.[A-Za-z$_]*) /* handle -ffunction-sections */\
>
> which should match the .text.foo sections generated by -ffunction-sections
> but not the kernel's special sections which now all have names of the form
> .text..foo. I suspect after that change, the cleanup of deleting .text.*
> from the various architecture linker scripts that reference it should be
> possible.

Do these special kernel sections include things like the parisc
..text.do_softirq, .text.sys_exit, etc? James raised a good objection to
the parisc patch of this series. I'm guessing most people saw it already
but I'll paste it here for reference,


This would destroy all of the named parisc text ordering we do above the
removed line because now you'd have swept up all the function sections
before we get to them, won't it?

The ordering is an execution speed up on 32 bit systems because our
relative jump is so short.

James

Will you changes handle this OK?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: James Bottomley on
On Mon, 2010-06-14 at 20:33 +0100, Matt Fleming wrote:
> On Mon, 14 Jun 2010 10:32:46 -0400 (EDT), Tim Abbott <tabbott(a)ksplice.com> wrote:
> >
> > I was planning to submit in the next couple weeks a change that adds
> > support for building the kernel with -ffunction-sections -fdata-sections,
> > which would have as a piece of it adding to TEXT_TEXT the following
> > expression:
> >
> > *(.text.[A-Za-z$_]*) /* handle -ffunction-sections */\

Just as a point of technical interest, that won't handle
-ffunction-sections. At least on parisc, we get a
section .text.<function name> for every function. This means that any
character legal in a function name can appear there, not just letters
and underscores (we get millicode ones with dollar signs as well for
instance). That's why *(.text.*) is safer

> > which should match the .text.foo sections generated by -ffunction-sections
> > but not the kernel's special sections which now all have names of the form
> > .text..foo.

They do? I don't find any symbols like that on parisc.

Historically, the way we've differentiated is that kernel special
symbols tend to have the text designator *after* the name, whereas the
linker puts it before ... of course that has issues for functions
called things like text or init ... but we try not to do that ...

> I suspect after that change, the cleanup of deleting .text.*
> > from the various architecture linker scripts that reference it should be
> > possible.
>
> Do these special kernel sections include things like the parisc
> .text.do_softirq, .text.sys_exit, etc? James raised a good objection to
> the parisc patch of this series. I'm guessing most people saw it already
> but I'll paste it here for reference,
>
>
> This would destroy all of the named parisc text ordering we do above the
> removed line because now you'd have swept up all the function sections
> before we get to them, won't it?
>
> The ordering is an execution speed up on 32 bit systems because our
> relative jump is so short.
>
> James
>
> Will you changes handle this OK?

As long as we don't do the generic gathering of the rest of the text
sections until after the special ones are handled (and this includes the
specific function sections we name), it doesn't really matter to us how
it's done.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/