Commit 07fca0e57fca925032526349f4370f97ed580cc9

Authored by Sam Ravnborg
Committed by Steven Rostedt
1 parent 74534341c1

tracing: Properly align linker defined symbols

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.

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>
LKML-Reference: <20100710063459.GA14596@merkur.ravnborg.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Showing 1 changed file with 10 additions and 0 deletions Side-by-side Diff

include/asm-generic/vmlinux.lds.h
... ... @@ -63,6 +63,12 @@
63 63 /* Align . to a 8 byte boundary equals to maximum function alignment. */
64 64 #define ALIGN_FUNCTION() . = ALIGN(8)
65 65  
  66 +/*
  67 + * Align to a 32 byte boundary equal to the
  68 + * alignment gcc 4.5 uses for a struct
  69 + */
  70 +#define STRUCT_ALIGN() . = ALIGN(32)
  71 +
66 72 /* The actual configuration determine if the init/exit sections
67 73 * are handled as text/data or they can be discarded (which
68 74 * often happens at runtime)
69 75  
... ... @@ -166,7 +172,11 @@
166 172 LIKELY_PROFILE() \
167 173 BRANCH_PROFILE() \
168 174 TRACE_PRINTKS() \
  175 + \
  176 + STRUCT_ALIGN(); \
169 177 FTRACE_EVENTS() \
  178 + \
  179 + STRUCT_ALIGN(); \
170 180 TRACE_SYSCALLS()
171 181  
172 182 /*