Skip to contentSkip to conversation

perf: fix extern struct definitions

PATCH In review Stephane Eranian 2 participants 3 messages Sep 20, 2010 – Oct 5, 2010 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: fix extern struct definitions

Both python_scripting_ops and perl_scripting_ops have two global definitions. One in trace-event-scripting.c and one in their respective scripting-engine modules.

The issue is that depending on the linker order one definition or the other is chosen. One is uninitialized (bss), while the other is initialized. If the uninitialized version is chosen, then perf does not function properly.

This patch fixes this by adding the extern prefix to the definitions in trace-event-scripting.c.

tools/perf/util/trace-event-scripting.c +2 -2
index 7ea983a..f7af2fc 100644
@@ -97,7 +97,7 @@ void setup_python_scripting(void)
 	register_python_scripting(&python_scripting_unsupported_ops);
 }
 #else
-struct scripting_ops python_scripting_ops;
+extern struct scripting_ops python_scripting_ops;
 
 void setup_python_scripting(void)
 {
@@ -158,7 +158,7 @@ void setup_perl_scripting(void)
 	register_perl_scripting(&perl_scripting_unsupported_ops);
 }
 #else
-struct scripting_ops perl_scripting_ops;
+extern struct scripting_ops perl_scripting_ops;
 
 void setup_perl_scripting(void)
 {
#1 lore raw

Em Tue, Sep 21, 2010 at 12:45:01AM +0200, Stephane Eranian escreveu:

Quoted 4 lines

Both python_scripting_ops and perl_scripting_ops have two global definitions. One in trace-event-scripting.c and one in their respective scripting-engine modules.

Quoted 8 lines

The issue is that depending on the linker order one definition or the other is chosen. One is uninitialized (bss), while the other is initialized. If the uninitialized version is chosen, then perf does not function properly.

This patch fixes this by adding the extern prefix to the definitions in trace-event-scripting.c.

Thanks, applying to perf/urgent,

- Arnaldo

#2 lore raw

[tip:perf/core] perf trace scripting: Fix extern struct definitions

In reply to Stephane Eranian
Commit-ID:  0f940cb7d970f4fd569bb5f9f49774422f2ccbee
Gitweb:     http://git.kernel.org/tip/0f940cb7d970f4fd569bb5f9f49774422f2ccbee
Author:     Stephane Eranian <[email protected]>
AuthorDate: Tue, 21 Sep 2010 00:45:01 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 4 Oct 2010 12:24:51 -0300

perf trace scripting: Fix extern struct definitions

Both python_scripting_ops and perl_scripting_ops have two global definitions. One in trace-event-scripting.c and one in their respective scripting-engine modules.

The issue is that depending on the linker order one definition or the other is chosen. One is uninitialized (bss), while the other is initialized. If the uninitialized version is chosen, then perf does not function properly.

This patch fixes this by adding the extern prefix to the definitions in trace-event-scripting.c.

Cc: David S. Miller <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Robert Richter <[email protected]>
LKML-Reference: <[email protected]>

---
 tools/perf/util/trace-event-scripting.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/trace-event-scripting.c +2 -2
index 7ea983a..f7af2fc 100644
@@ -97,7 +97,7 @@ void setup_python_scripting(void)
 	register_python_scripting(&python_scripting_unsupported_ops);
 }
 #else
-struct scripting_ops python_scripting_ops;
+extern struct scripting_ops python_scripting_ops;
 
 void setup_python_scripting(void)
 {
@@ -158,7 +158,7 @@ void setup_perl_scripting(void)
 	register_perl_scripting(&perl_scripting_unsupported_ops);
 }
 #else
-struct scripting_ops perl_scripting_ops;
+extern struct scripting_ops perl_scripting_ops;
 
 void setup_perl_scripting(void)
 {