Skip to contentSkip to conversation

tracing: Add __used annotation to event variable

GIT PULL Steven Rostedt 3 participants 3 messages May 25, 2010

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Ingo,

This fixes the warning/error on PowerPC.

Please pull the latest tip/perf/core tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/perf/core

Steven Rostedt (1):
tracing: Add __used annotation to event variable

----

 include/trace/ftrace.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---------------------------
commit 49c177461bfbedeccbab22bf3905db2f9da7f1c3
Author: Steven Rostedt <[email protected]>
Date:   Tue May 25 06:19:35 2010 -0700

tracing: Add __used annotation to event variable

The TRACE_EVENT() macros automate creation of trace events. To automate initialization, the set up variables are loaded in a special section that is read on boot up. GCC is not aware that these static variables are used and will complain about them if we do not inform GCC that they are indeed used.

One of the declarations of the event element was missing a __used annotation. This patch adds it.

include/trace/ftrace.h +1 -1
index 0152b86..34bead7 100644
@@ -68,7 +68,7 @@
 
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, name, proto, args)	\
-	static struct ftrace_event_call			\
+	static struct ftrace_event_call	__used		\
 	__attribute__((__aligned__(4))) event_##name
 
 #undef DEFINE_EVENT_PRINT
#1 lore raw
Quoted 41 lines · Steven Rostedt

Ingo,

This fixes the warning/error on PowerPC.

Please pull the latest tip/perf/core tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/perf/core

Steven Rostedt (1):
tracing: Add __used annotation to event variable

----

 include/trace/ftrace.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---------------------------
commit 49c177461bfbedeccbab22bf3905db2f9da7f1c3
Author: Steven Rostedt <[email protected]>
Date:   Tue May 25 06:19:35 2010 -0700

tracing: Add __used annotation to event variable

The TRACE_EVENT() macros automate creation of trace events. To automate initialization, the set up variables are loaded in a special section that is read on boot up. GCC is not aware that these static variables are used and will complain about them if we do not inform GCC that they are indeed used.

One of the declarations of the event element was missing a __used annotation. This patch adds it.

include/trace/ftrace.h +0 -0
index 0152b86..34bead7 100644

include/trace/ftrace.h line 72

Quoted 6 lines
include/trace/ftrace.h +1 -1
@@ -68,7 +68,7 @@
 
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, name, proto, args)	\
-	static struct ftrace_event_call			\
+	static struct ftrace_event_call	__used		\
 	__attribute__((__aligned__(4))) event_##name

Oh, I was writing the exact same patch...

In fact it appears only DEFINE_EVENT_PRINT() uses this declaration, while before, we had various callbacks that always used it.

Anyway, thanks.

#2 lore raw
In reply to Steven Rostedt
Quoted 11 lines · Steven Rostedt

Ingo,

This fixes the warning/error on PowerPC.

Please pull the latest tip/perf/core tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/perf/core

Quoted 6 lines

Steven Rostedt (1):
tracing: Add __used annotation to event variable

----

 include/trace/ftrace.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Pulled, thanks Steve!

Ingo