This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Prelinking on ARM with Debug Link
- From: Mark Wielaard <mjw at redhat dot com>
- To: Torsten Polle <Torsten dot Polle at gmx dot de>
- Cc: systemtap at sourceware dot org
- Date: Thu, 18 Feb 2016 17:21:49 +0100
- Subject: Re: Prelinking on ARM with Debug Link
- Authentication-results: sourceware.org; auth=none
- References: <4BCA4243-B16B-436F-9D53-41C551492A51 at gmx dot de> <6E47DD0A-0515-45C6-86A1-4669A8182663 at gmx dot de> <1455121041 dot 7606 dot 104 dot camel at redhat dot com> <3855EE25-54F2-47FB-88A8-FF1EC3963C06 at gmx dot de> <1455136517 dot 7606 dot 107 dot camel at redhat dot com> <trinity-fb9190d9-ee29-4674-8066-0251f630d69b-1455187752264 at 3capp-gmx-bs27> <1455617312 dot 9915 dot 50 dot camel at redhat dot com> <1FF3B18B-EEA4-4A00-8E4F-3B7977E0111C at gmx dot de>
On Tue, 2016-02-16 at 21:46 +0100, Torsten Polle wrote:
> The target architecture is 32bit ARM. The host architecture is 64bit
> X86. Thatâs the reason why field .sec_load_offset is initialised with
> a 64bit wide hexadecimal number. But as the field .sec_load_offset is
> defined only as âunsigned longâ, the compiler complains. As a work
> around I tried to output decimal number instead for the initialisation
> of .sec_load_offset. I can compile alright. But the resulting
> backtrace calculations shown in my previous example produce strange
> results.
OK, I don't have such a setup, but maybe all that is needed, if we
assume negative values are ok, is to not write sec_load_offset out in
hex, but simply in dec. Could you try the attached patch?
Thanks,
Mark
diff --git a/translate.cxx b/translate.cxx
index f792343..1874163 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -6845,8 +6845,10 @@ dump_unwindsym_cxt (Dwfl_Module *m,
Dwarf_Addr dwbias = 0;
dwfl_module_getdwarf (m, &dwbias);
- c->output << ".sec_load_offset = 0x"
- << hex << debug_frame_off - dwbias << dec << "\n";
+ /* Note we use dec, not hex, in case host width > target width
+ and offset is negative. */
+ c->output << ".sec_load_offset = "
+ << debug_frame_off - dwbias << "\n";
c->output << "#else\n";
c->output << ".debug_hdr = NULL,\n";
@@ -6865,8 +6867,10 @@ dump_unwindsym_cxt (Dwfl_Module *m,
c->output << "#if defined(STP_NEED_LINE_DATA)\n";
Dwarf_Addr dwbias = 0;
dwfl_module_getdwarf (m, &dwbias);
- c->output << ".sec_load_offset = 0x"
- << hex << debug_frame_off - dwbias << dec << "\n";
+ /* Note we use dec, not hex, in case host width > target width
+ and offset is negative. */
+ c->output << ".sec_load_offset = "
+ << debug_frame_off - dwbias << "\n";
c->output << "#else\n";
}
c->output << ".sec_load_offset = 0\n";