trying to fix following warning: 'override: reassigning to symbol SYSFS_DEPRECATED_V2'
[linux-2.6.git] / linux-2.6-10000-gcc-4.5.patch
1 commit 124482935fb7fb9303c8a8ab930149c6a93d9910
2 Author: Andi Kleen <andi@firstfloor.org>
3 Date:   Fri Jun 18 23:09:00 2010 +0200
4
5     x86: Fix vsyscall on gcc 4.5 with -Os
6
7     This fixes the -Os breaks with gcc 4.5 bug.  rdtsc_barrier needs to be
8     force inlined, otherwise user space will jump into kernel space and
9     kill init.
10
11     This also addresses http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44129
12     I believe.
13
14     Signed-off-by: Andi Kleen <ak@linux.intel.com>
15     LKML-Reference: <20100618210859.GA10913@basil.fritz.box>
16     Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
17     Cc: <stable@kernel.org>
18
19 commit 86c38a31aa7f2dd6e74a262710bf8ebf7455acc5
20 Author: Jeff Mahoney <jeffm@suse.com>
21 Date:   Wed Feb 24 13:59:23 2010 -0500
22
23     tracing: Fix ftrace_event_call alignment for use with gcc 4.5
24
25     GCC 4.5 introduces behavior that forces the alignment of structures to
26     use the largest possible value. The default value is 32 bytes, so if
27     some structures are defined with a 4-byte alignment and others aren't
28     declared with an alignment constraint at all - it will align at 32-bytes.
29
30     For things like the ftrace events, this results in a non-standard array.
31     When initializing the ftrace subsystem, we traverse the _ftrace_events
32     section and call the initialization callback for each event. When the
33     structures are misaligned, we could be treating another part of the
34     structure (or the zeroed out space between them) as a function pointer.
35
36     This patch forces the alignment for all the ftrace_event_call structures
37     to 4 bytes.
38
39     Without this patch, the kernel fails to boot very early when built with
40     gcc 4.5.
41
42     It's trivial to check the alignment of the members of the array, so it
43     might be worthwhile to add something to the build system to do that
44     automatically. Unfortunately, that only covers this case. I've asked one
45     of the gcc developers about adding a warning when this condition is seen.
46
47    Signed-off-by: Jeff Mahoney <jeffm@suse.com>
48     LKML-Reference: <4B85770B.6010901@suse.com>
49     Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
50     Cc: stable@kernel.org
51
52 diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
53 index f08f973..e0fbf29 100644
54 --- a/arch/x86/include/asm/system.h
55 +++ b/arch/x86/include/asm/system.h
56 @@ -449,7 +449,7 @@ void stop_this_cpu(void *dummy);
57   *
58   * (Could use an alternative three way for this if there was one.)
59   */
60 -static inline void rdtsc_barrier(void)
61 +static __always_inline void rdtsc_barrier(void)
62  {
63         alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
64         alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
65 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
66 index 71c9050..3e35002 100644
67 --- a/include/linux/syscalls.h
68 +++ b/include/linux/syscalls.h
69 @@ -154,7 +154,8 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused)     \
70  #define __SC_STR_TDECL6(t, a, ...)     #t, __SC_STR_TDECL5(__VA_ARGS__)
71  
72  #define SYSCALL_TRACE_ENTER_EVENT(sname)                               \
73 -       static struct ftrace_event_call event_enter_##sname;            \
74 +       static struct ftrace_event_call                                 \
75 +       __attribute__((__aligned__(4))) event_enter_##sname;            \
76         struct trace_event enter_syscall_print_##sname = {              \
77                 .trace                  = print_syscall_enter,          \
78         };                                                              \
79 @@ -190,7 +191,8 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused)     \
80         }
81  
82  #define SYSCALL_TRACE_EXIT_EVENT(sname)                                        \
83 -       static struct ftrace_event_call event_exit_##sname;             \
84 +       static struct ftrace_event_call                                 \
85 +       __attribute__((__aligned__(4))) event_exit_##sname;             \
86         struct trace_event exit_syscall_print_##sname = {               \
87                 .trace                  = print_syscall_exit,           \
88         };                                                              \
89 diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
90 index bc309b2..f14d954 100644
91 --- a/include/trace/ftrace.h
92 +++ b/include/trace/ftrace.h
93 @@ -65,7 +65,8 @@
94         };
95  #undef DEFINE_EVENT
96  #define DEFINE_EVENT(template, name, proto, args)      \
97 -       static struct ftrace_event_call event_##name
98 +       static struct ftrace_event_call                 \
99 +       __attribute__((__aligned__(4))) event_##name
100  
101  #undef DEFINE_EVENT_PRINT
102  #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
103 diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
104 index 6167a38..1ad2d01 100644
105 --- a/kernel/trace/trace.h
106 +++ b/kernel/trace/trace.h
107 @@ -760,7 +760,8 @@ extern const char *__stop___trace_bprintk_fmt[];
108  
109  #undef FTRACE_ENTRY
110  #define FTRACE_ENTRY(call, struct_name, id, tstruct, print)            \
111 -       extern struct ftrace_event_call event_##call;
112 +       extern struct ftrace_event_call                                 \
113 +       __attribute__((__aligned__(4))) event_##call;
114  #undef FTRACE_ENTRY_DUP
115  #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print)                \
116         FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print))