[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100711060723.GA16125@merkur.ravnborg.org>
Date: Sun, 11 Jul 2010 08:07:23 +0200
From: Sam Ravnborg <sam@...nborg.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Zeev Tarantov <zeev.tarantov@...il.com>,
LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
Frederic Weisbecker <fweisbec@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Rafael J. Wysocki" <rjw@...k.pl>
Subject: Re: [PATCH] tracing: properly align linker defined symbols
On Sat, Jul 10, 2010 at 03:25:02PM -0700, Linus Torvalds wrote:
> On Fri, Jul 9, 2010 at 11:35 PM, Sam Ravnborg <sam@...nborg.org> wrote:
> >
> > We define a number of symbols in the linker scipt like this:
> >
> > __start_syscalls_metadata = .;
> > *(__syscalls_metadata)
> >
> > But we do not know the alignment of "." when we assign
> > the __start_syscalls_metadata symbol.
> > gcc started to uses bigger alignment for structs (32 bytes),
> > so we saw situations where the linker due to alignment
> > constraints increased the value of "." after the symbol assignment.
>
> Ok, why not clean this up a bit more, and use a helper macro for this
> pattern. There's a fair number of users of that kind of pattern, so
> that actually removes a few lines.
>
> Here's an example patch. Untested. Whatever. But just this part
>
> 1 files changed, 21 insertions(+), 31 deletions(-)
>
> says to me that it's a good idea, and there are other cases that could
> use the new SYMBOL_SECTION() helper.
>
> What do people think?
Looks good.
I especially like how we with this standardize on the alignment.
I will make sure a working version hits next merge window.
A few comments.
+#define SYMBOL_SECTION(name, section) \
+ . = ALIGN(32); \
+ VMLINUX_SYMBOL(__start_##section) = .; \
+ *(name) \
+ VMLINUX_SYMBOL(__stop_##section) = .;
The arguments to this macro is confusing.
Something like this:
#define SYMBOL_SECTION(section, symbol_suffix)
To encourage people to use the section name as suffix
the __start / __stop variables we could
introduce an additional define:
#define SYMBOL_SECTION(section) SYMBOL_SECTION_SUFFIX(section, section)
#define SYMBOL_SECTION_SUFFIX(section, symbol_suffix) \
+ . = ALIGN(32); \
+ VMLINUX_SYMBOL(__start_##symbol_suffix) = .; \
+ *(section) \
+ VMLINUX_SYMBOL(__stop_##symbol_suffix) = .;
I will update the patch to reflect this (+ the fix you pointed out).
But it will wait until Steven has decided what patch to forward
to fix the discussed regression.
Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists