lkml.org 
[lkml]   [2010]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH] tracing: properly align linker defined symbols
    From
    On Fri, Jul 9, 2010 at 11:35 PM, Sam Ravnborg <sam@ravnborg.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?

    Linus
    >
    > This resulted in boot fails.
    >
    > Fix this by forcing a 32 byte alignment of "." before the
    > assignment.
    >
    > This patch introduces the forced alignment for
    > ftrace_events and syscalls_metadata.
    > It may be required in more places.
    >
    > Reported-by: Zeev Tarantov <zeev.tarantov@gmail.com>
    > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
    > Cc: Steven Rostedt <rostedt@goodmis.org>
    > Cc: Frederic Weisbecker <fweisbec@gmail.com>
    > ---
    >  include/asm-generic/vmlinux.lds.h |   10 ++++++++++
    >  1 files changed, 10 insertions(+), 0 deletions(-)
    >
    > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
    > index 48c5299..4b5902a 100644
    > --- a/include/asm-generic/vmlinux.lds.h
    > +++ b/include/asm-generic/vmlinux.lds.h
    > @@ -63,6 +63,12 @@
    >  /* Align . to a 8 byte boundary equals to maximum function alignment. */
    >  #define ALIGN_FUNCTION()  . = ALIGN(8)
    >
    > +/*
    > + * Align to a 32 byte boundary equal to the
    > + * alignment gcc 4.5 uses for a struct
    > + */
    > +#define STRUCT_ALIGN() . = ALIGN(32)
    > +
    >  /* The actual configuration determine if the init/exit sections
    >  * are handled as text/data or they can be discarded (which
    >  * often happens at runtime)
    > @@ -166,7 +172,11 @@
    >        LIKELY_PROFILE()                                                \
    >        BRANCH_PROFILE()                                                \
    >        TRACE_PRINTKS()                                                 \
    > +                                                                       \
    > +       STRUCT_ALIGN();                                                 \
    >        FTRACE_EVENTS()                                                 \
    > +                                                                       \
    > +       STRUCT_ALIGN();                                                 \
    >        TRACE_SYSCALLS()
    >
    >  /*
    > --
    > 1.6.0.6
    >
    >
    [unhandled content-type:application/octet-stream]
    \
     
     \ /
      Last update: 2010-07-11 00:27    [W:0.032 / U:30.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site