Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/buildrun.cxx b/buildrun.cxx
- index 629a6d5d0..9e1b1d066 100644
- --- a/buildrun.cxx
- +++ b/buildrun.cxx
- @@ -224,7 +224,7 @@ compile_dyninst (systemtap_session& s)
- vector<string> cmd
- {
- - "gcc", "--std=gnu99", s.translated_source, "-o", module,
- + "gcc", "--std=gnu99", s.translated_source, s.symbols_source, "-o", module,
- "-fvisibility=hidden", "-O2", "-I" + s.runtime_path, "-D__DYNINST__",
- "-Wall", WERROR, "-Wno-unused", "-Wno-strict-aliasing",
- "-pthread", "-lrt", "-fPIC", "-shared",
- diff --git a/main.cxx b/main.cxx
- index bae367e25..0bf461c23 100644
- --- a/main.cxx
- +++ b/main.cxx
- @@ -541,6 +541,7 @@ passes_0_4 (systemtap_session &s)
- // directory. Note the _src prefix, explained in
- // buildrun.cxx:compile_pass()
- s.translated_source = string(s.tmpdir) + "/" + s.module_name + "_src.c";
- + s.symbols_source = string(s.tmpdir) + "/stap_symbols.c";
- PROBE1(stap, pass0__end, &s);
- diff --git a/runtime/dyninst/linux_defs.h b/runtime/dyninst/linux_defs.h
- index b4c692d9b..85088720c 100644
- --- a/runtime/dyninst/linux_defs.h
- +++ b/runtime/dyninst/linux_defs.h
- @@ -50,9 +50,6 @@
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
- -#define __must_be_array(arr) 0
- -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
- -
- #ifndef CLOCK_MONOTONIC_RAW
- #define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
- #endif
- diff --git a/session.h b/session.h
- index 9463bd20b..0fc534d2c 100644
- --- a/session.h
- +++ b/session.h
- @@ -337,7 +337,8 @@ public:
- // temporary directory for module builds etc.
- // hazardous - it is "rm -rf"'d at exit
- std::string tmpdir;
- - std::string translated_source; // C source code
- + std::string translated_source; // main C source code
- + std::string symbols_source; // C source code for stap_symbols.c
- match_node* pattern_root;
- void register_library_aliases();
- diff --git a/translate.cxx b/translate.cxx
- index cabcad55a..70a2fbc84 100644
- --- a/translate.cxx
- +++ b/translate.cxx
- @@ -7610,14 +7610,20 @@ prepare_symbol_data (systemtap_session& s)
- void
- emit_symbol_data (systemtap_session& s)
- {
- - string symfile = "stap_symbols.c";
- + ofstream kallsyms_out (s.symbols_source.c_str ());
- - ofstream kallsyms_out ((s.tmpdir + "/" + symfile).c_str());
- -
- - kallsyms_out << "#include <linux/module.h>\n"
- - "#include <linux/kernel.h>\n"
- - "#include <sym.h>\n"
- - "#include \"stap_common.h\"\n";
- + if (s.runtime_usermode_p ())
- + {
- + kallsyms_out << "#include \"stap_common.h\"\n"
- + "#include <sym.h>\n";
- + }
- + else
- + {
- + kallsyms_out << "#include <linux/module.h>\n"
- + "#include <linux/kernel.h>\n"
- + "#include <sym.h>\n"
- + "#include \"stap_common.h\"\n";
- + }
- vector<pair<string,unsigned> > seclist;
- map<unsigned, addrmap_t> addrmap;
- @@ -7937,6 +7943,16 @@ translate_pass (systemtap_session& s)
- s.op->newline() << "#include \"stap_common.h\"";
- + if (s.runtime_usermode_p ())
- + {
- + s.op->hdr->line() << "#include <stdint.h>";
- + s.op->hdr->newline() << "#include <stddef.h>";
- + s.op->hdr->newline() << "struct task_struct;";
- + s.op->hdr->newline() << "#define __must_be_array(arr) 0";
- + s.op->hdr->newline() << "#define ARRAY_SIZE(arr) (sizeof(arr) "
- + "/ sizeof((arr)[0]) + __must_be_array(arr))";
- + }
- +
- s.op->hdr->newline() << "#ifndef MAXNESTING";
- s.op->hdr->newline() << "#define MAXNESTING " << nesting;
- s.op->hdr->newline() << "#endif";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement