From 21beacc9a00ea48763048151c370e205c5f23379 Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 12 Feb 2008 21:25:42 +0000 Subject: PR4393: fix relocatable-kernel global $variable access 2008-02-12 Frank Ch. Eigler PR 4393 * tapsets.cxx (emit_address): Support relocatable kernels. (dwarf_derived_probe ctor): Hack around for missing USHRT_MAX. * elaborate.cxx (semantic_pass): Increment rc if exception caught. 2008-02-12 Frank Ch. Eigler * systemtap.pass1-4/buildok.exp: No longer kfail buildok/seventeen. --- tapsets.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 540b3bc4..9fbad6bb 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1365,6 +1365,17 @@ struct dwflpp modname, secname, address); obstack_printf (pool, "addr; })"); } + else if (n == 1 && module_name == TOK_KERNEL && secname[0] == '\0') + { + // elfutils' way of telling us that this is a relocatable kernel address, which we + // need to treat the same way here as dwarf_query::add_probe_point does: _stext. + address -= sess.sym_stext; + secname = "_stext"; + obstack_printf (pool, "({ static unsigned long addr = 0; "); + obstack_printf (pool, "if (addr==0) addr = _stp_module_relocate (\"%s\",\"%s\",%#" PRIx64 "); ", + modname, secname, address); + obstack_printf (pool, "addr; })"); + } else { throw semantic_error ("cannot relocate user-space dso (?) address"); @@ -3649,6 +3660,11 @@ dwarf_derived_probe::dwarf_derived_probe(const string& funcname, this->tok = q.base_probe->tok; + // XXX: hack for strange g++/gcc's +#ifndef USHRT_MAX +#define USHRT_MAX 32767 +#endif + // Range limit maxactive() value if (q.has_maxactive && (q.maxactive_val < 0 || q.maxactive_val > USHRT_MAX)) throw semantic_error ("maxactive value out of range [0," -- cgit