From a295050e60affe0bb55fc2d46637314c0822f35d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 16 Nov 2009 21:34:00 +0100 Subject: PR10010 Support $globals in shared libraries. * dwflpp.cxx (dwflpp::emit_address): Enable task finder and emit a _stp_module_relocate for the ".dynamic" section when seeing a user-space dso address. * runtime/sym.c (_stp_mod_sec_lookup): Remove .dynamic section addr cheat. (_stp_tf_mmap_cb): Add cheat here. --- dwflpp.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'dwflpp.cxx') diff --git a/dwflpp.cxx b/dwflpp.cxx index 92fe04c1..35637568 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -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 -- cgit