[PATCH] perf: fix undefined symbols in python binding

From: Ben Noordhuis
Date: Sun Feb 03 2013 - 19:27:59 EST


Add dummy test_attr__enabled and test_attr__open symbols to
util/python.c to fix the following dynamic linker error:

$ python python/twatch.py
Traceback (most recent call last):
File "python/twatch.py", line 16, in <module>
import perf
ImportError: /path/to/perf.so: undefined symbol: test_attr__enabled

Signed-off-by: Ben Noordhuis <info@xxxxxxxxxxxxx>
---
tools/perf/util/python.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index a2657fd..163abbb 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -8,6 +8,15 @@
#include "cpumap.h"
#include "thread_map.h"

+/* Dummy to satisfy linker. */
+bool test_attr__enabled;
+
+/* Dummy to satisfy linker. */
+void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
+ int fd, int group_fd, unsigned long flags)
+{
+}
+
/* Define PyVarObject_HEAD_INIT for python 2.5 */
#ifndef PyVarObject_HEAD_INIT
# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/