diff options
-rw-r--r-- | dwflpp.cxx | 11 | ||||
-rw-r--r-- | runtime/sym.c | 7 |
2 files changed, 10 insertions, 8 deletions
@@ -1502,12 +1502,11 @@ dwflpp::emit_address (struct obstack *pool, Dwarf_Addr address) } else { - throw semantic_error ("cannot relocate user-space dso (?) address"); -#if 0 - // This would happen for a Dwfl_Module that's a user-level DSO. - obstack_printf (pool, " /* %s+%#" PRIx64 " */", - modname, address); -#endif + enable_task_finder (sess); + obstack_printf (pool, "({ static unsigned long addr = 0; "); + obstack_printf (pool, "if (addr==0) addr = _stp_module_relocate (\"%s\",\"%s\",%#" PRIx64 "); ", + modname, ".dynamic", reloc_address); + obstack_printf (pool, "addr; })"); } } else diff --git a/runtime/sym.c b/runtime/sym.c index 0baa1a5e..61282183 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -45,6 +45,11 @@ static int _stp_tf_mmap_cb(struct stap_task_finder_target *tgt, path); #endif module = _stp_modules[i]; + // cheat... + if ((strcmp(".dynamic", + module->sections[0].name) == 0) + && module->sections[0].addr == 0) + module->sections[0].addr = addr; break; } } @@ -138,8 +143,6 @@ static struct _stp_module *_stp_mod_sec_lookup(unsigned long addr, *sec = &m->sections[0]; // XXX check actual section and relocate dbug_sym(1, "found section %s in module %s at 0x%lx\n", m->sections[0].name, m->name, vm_start); - if (strcmp(".dynamic", m->sections[0].name) == 0) - m->sections[0].addr = vm_start; // cheat... return m; } } |