From d9bdb83d6f14ddfb2980b62655a12cd11771af88 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 15 Apr 2008 01:22:46 -0400 Subject: PR6405: unwinder build compatibility with RHEL5 --- ChangeLog | 5 +++++ buildrun.cxx | 2 +- runtime/ChangeLog | 5 +++++ runtime/autoconf-module-nsections.c | 8 ++++++++ runtime/transport/ChangeLog | 6 ++++++ runtime/transport/symbols.c | 19 +++++++++++++++---- 6 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 runtime/autoconf-module-nsections.c diff --git a/ChangeLog b/ChangeLog index a9c22930..0aee4d96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-04-15 Frank Ch. Eigler + + PR 6405 + * buildrun.cxx (compile_pass): Add STAPCONF_MODULE_NSECTIONS. + 2008-04-14 David Smith * elaborate.h (struct derived_probe_group): Removed diff --git a/buildrun.cxx b/buildrun.cxx index a186326f..76efe7c0 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -93,9 +93,9 @@ compile_pass (systemtap_session& s) o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-tsc-khz.c, -DSTAPCONF_TSC_KHZ,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-ktime-get-real.c, -DSTAPCONF_KTIME_GET_REAL,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-x86-uniregs.c, -DSTAPCONF_X86_UNIREGS,)" << endl; - o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-nameidata.c, -DSTAPCONF_NAMEIDATA_CLEANUP,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-unregister-kprobes.c, -DSTAPCONF_UNREGISTER_KPROBES,)" << endl; + o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-module-nsections.c, -DSTAPCONF_MODULE_NSECTIONS,)" << endl; for (unsigned i=0; i + + PR 6405 + * autoconf-module-nsections.c: New file. + 2008-04-15 Frank Ch. Eigler * unwind/i386.h (STACK_BOTTOM, STACK_TOP): Comment out these diff --git a/runtime/autoconf-module-nsections.c b/runtime/autoconf-module-nsections.c new file mode 100644 index 00000000..c1ce58b7 --- /dev/null +++ b/runtime/autoconf-module-nsections.c @@ -0,0 +1,8 @@ +#include + +struct module_sect_attrs x; + +void foo (void) +{ + (void) x.nsections; +} diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index b3a159e3..f031c088 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,9 @@ +2008-04-15 Frank Ch. Eigler + + PR 6405 + * symbols.c (_stp_load_module_symbols): Support older kernels + without module->sect_attrs->nsections. + 2008-04-09 Martin Hunt * symbols.c (_stp_init_kernel_symbols): Print error diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index b0e7c319..8cce2fd4 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -401,14 +401,25 @@ static int _stp_section_is_interesting(const char *name) static struct _stp_module *_stp_load_module_symbols(struct module *mod) { int i, num, overflow = 0; - struct module_sect_attrs *sa; + struct module_sect_attrs *sa = mod->sect_attrs; + struct attribute_group *sag = & sa->grp; unsigned sect_size = 0, sect_num = 0, sym_size, sym_num; struct _stp_module *sm; char *dataptr, *endptr; + unsigned nsections = 0; + +#ifdef STAPCONF_MODULE_NSECTIONS + nsections = sa->nsections; +#else + /* count section attributes on older kernel */ + struct attribute** gattr; + for (gattr = sag->attrs; *gattr; gattr++) + nsections++; + dbug_sym(2, "\tcount %d\n", nsections); +#endif - sa = mod->sect_attrs; /* calculate how much space to allocate for section strings */ - for (i = 0; i < sa->nsections; i++) { + for (i = 0; i < nsections; i++) { if (_stp_section_is_interesting(sa->attrs[i].name)) { sect_num++; sect_size += strlen(sa->attrs[i].name) + 1; @@ -438,7 +449,7 @@ static struct _stp_module *_stp_load_module_symbols(struct module *mod) dataptr = (char *)((long)sm->sections + sect_num * sizeof(struct _stp_symbol)); endptr = (char *)((long)sm->sections + sect_size); num = 0; - for (i = 0; i < sa->nsections; i++) { + for (i = 0; i < nsections; i++) { size_t len, maxlen; if (_stp_section_is_interesting(sa->attrs[i].name)) { sm->sections[num].addr = sa->attrs[i].address; -- cgit