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.
--- /dev/null
+#ifndef _K_SYMS_H_
+#define _K_SYMS_H_
+
+#ifdef __powerpc64__
+#define KERNEL_RELOC_SYMBOL ".__start"
+#else
+#define KERNEL_RELOC_SYMBOL "_stext"
+#endif
+
+#endif
#define _BSD_SOURCE
#include "staprun.h"
#include "../privilege.h"
+#include "../runtime/k_syms.h"
#include <string.h>
#include <sys/uio.h>
#include <glob.h>
}
-#ifdef __powerpc64__
-#define KERNEL_RELOC_SYMBOL ".__start"
-#else
-#define KERNEL_RELOC_SYMBOL "_stext"
-#endif
-
int send_relocation_kernel ()
{
FILE* kallsyms;
#include "dwarf_wrappers.h"
#include "setupdwfl.h"
#include "task_finder.h"
+#include "runtime/k_syms.h"
#include "dwflpp.h"
#include <cstdlib>
// 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;