This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
rfc patch for buildid < shlib base address
- From: "Frank Ch. Eigler" <fche at elastic dot org>
- To: systemtap at sources dot redhat dot com
- Date: Tue, 24 Feb 2009 20:46:22 -0500
- Subject: rfc patch for buildid < shlib base address
Hi -
On my i686 F10 box, elfutils 0.140 probing /lib/libc-2.9.so, the
buildid data logic results in an address that is smaller than the dwfl
relocation base address for the module. readelf indicates the
build-id .note section well before .text. This causes a negative
offset, which in turn causes a pass-4 compile error.
The following patch papers over the issue by making this particular
offset a signed quantity. I'd appreciate mjw/roland sanity checking,
and someone confirming that we actually check buildids of userspace
modules.
- FChE
diff --git a/runtime/sym.h b/runtime/sym.h
index e642cab..169f9d3 100644
--- a/runtime/sym.h
+++ b/runtime/sym.h
@@ -47,7 +47,7 @@ struct _stp_module {
uint32_t unwind_is_ehframe; /* unwind data comes from .eh_frame */
/* build-id information */
unsigned char *build_id_bits;
- unsigned long build_id_offset;
+ long long build_id_offset;
unsigned long notes_sect;
int build_id_len;
};
diff --git a/translate.cxx b/translate.cxx
index 135830d..6946758 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4713,12 +4713,11 @@ dump_unwindsyms (Dwfl_Module *m,
correct either. We may instead need a relocation basis different
from _stext, such as __start_notes. */
if (modname == "kernel")
- c->output << ".build_id_offset = 0x" << hex << build_id_vaddr
- << dec << ",\n";
+ c->output << ".build_id_offset = " << build_id_vaddr << ",\n";
else
- c->output << ".build_id_offset = 0x" << hex
- << build_id_vaddr - base
- << dec << ",\n";
+ c->output << ".build_id_offset = "
+ << (signed long long)(build_id_vaddr - base)
+ << ",\n";
} else
c->output << ".build_id_len = 0,\n";