]> sourceware.org Git - systemtap.git/commitdiff
PR14555, replace kernel symbol "_stext" by a macro in runtime/k_syms.h
authorAlexander Lochmann <alexander.lochmann@tu-dortmund.de>
Mon, 1 Oct 2012 22:42:15 +0000 (18:42 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Mon, 1 Oct 2012 22:44:45 +0000 (18:44 -0400)
The macro is used by the runtime as well as the compilation
components. It is not guaranteed that this symbol is always called
"_stext" on all archtitectures. On powerpc64 for example its name is
".__start". Stap will not run on other architectures where this symbol
has a different name because the lookup for "_stext" will fail.

Adjusted by <fche> to leave _stext as the relocation pseudo-section
name as used by relocation basis code, and parametrizing only
symbol names.

runtime/k_syms.h [new file with mode: 0644]
staprun/staprun.c
translate.cxx

diff --git a/runtime/k_syms.h b/runtime/k_syms.h
new file mode 100644 (file)
index 0000000..5e3db1d
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef _K_SYMS_H_
+#define _K_SYMS_H_
+
+#ifdef __powerpc64__
+#define KERNEL_RELOC_SYMBOL ".__start"
+#else
+#define KERNEL_RELOC_SYMBOL "_stext"
+#endif
+
+#endif
index 5508393059bf22d6e5ac569a0c52f60569a2f117..2cd90ac08ab31f91f3464929f591b2375dadf30a 100644 (file)
@@ -23,6 +23,7 @@
 #define _BSD_SOURCE
 #include "staprun.h"
 #include "../privilege.h"
+#include "../runtime/k_syms.h"
 #include <string.h>
 #include <sys/uio.h>
 #include <glob.h>
@@ -473,12 +474,6 @@ int send_a_relocation (const char* module, const char* reloc, unsigned long long
 }
 
 
-#ifdef __powerpc64__
-#define KERNEL_RELOC_SYMBOL ".__start"
-#else
-#define KERNEL_RELOC_SYMBOL "_stext"
-#endif
-
 int send_relocation_kernel ()
 {
   FILE* kallsyms;
index dd09d44aeb81daad1a697fb6b061fbc46fc93d93..25e159538529a1806bab8b1aa7f542cc5ddcf383 100644 (file)
@@ -18,6 +18,7 @@
 #include "dwarf_wrappers.h"
 #include "setupdwfl.h"
 #include "task_finder.h"
+#include "runtime/k_syms.h"
 #include "dwflpp.h"
 
 #include <cstdlib>
@@ -5727,7 +5728,7 @@ dump_symbol_tables (Dwfl_Module *m,
              // there may have been no kernel probes set.  We could
              // use tapsets.cxx:lookup_symbol_address(), but then
              // we're already iterating over the same data here...
-             if (! strcmp(name, "_stext"))
+             if (! strcmp(name, KERNEL_RELOC_SYMBOL))
                {
                  int ki;
                  extra_offset = sym_addr;
This page took 0.044126 seconds and 5 git commands to generate.