This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Prelinking on ARM


Mark,

Mark Wielaard writes:
 > On Tue, 2015-06-02 at 22:29 +0200, Torsten Polle wrote:
 >> Am 02.06.2015 um 20:28 schrieb Mark Wielaard <mjw@redhat.com>:
 >>> On Mon, 2015-06-01 at 22:43 +0200, Torsten Polle wrote:
 >>>> I've a problem with prelinked shared and non-prelinked debug information
 >>>> for the same on ARM. The relative offset to the .text section differs
 >>>> for the prelinked shared library and the non-prelinked debug
 >>>> information. SystemTap only compensates for the difference in the start
 >>>> addresses. I tried to debug the problem, but I've to admit that the
 >>>> problem is well over my head. Could someone give me a hint on this
 >>>> matter?
 >>> 
 >>> Does the testsuite/systemtap.exelib/exelib.exp test work for you?
 >> 
 >> I've to check. I'm using a cross compile environment, i.e. I only run
 >> passes 1 - 4 on my host (X86) and execute staprun on my target
 >> (ARM). I could provide a small shared library as an example instead.

 > I must admit to not have much experience with the
 > cross-compiling/cross-stapping mechanism. If you could provide a
 > small shared library (plus separate debuginfo file?) and the stap
 > invocation that doesn't work correctly that would be helpful for
 > understanding what goes wrong.

I tried to pull together a small example. But so far I failed.
Therefore I please allow me to summarise my understanding of the
situation.

prelinked                 debug information
+----------------------+    +----------------------+
|         ...          |    |         ...          |
+----------------------+    +----------------------+
| .rel.dyn size = 0x20 |    | .rel.dyn size = 0x10 |
+----------------------+    +----------------------+
|         ...          |    |         ...          |
+----------------------+    +----------------------+
| .text                |    | .text                |
+----------------------+    +----------------------+

The relocations of type R_ARM_RELATIVE in section ".rel.dyn" change 
their type from REL to RELA, thereby increasing the size of the section ".rel.dynâ.

Consequently the offset of the ".text" section differs. The value of
variables (elf, module) bias in tapset.cxx only seem to take into
account that the difference between the start address of the prelinked
library and the start of the debug information is the same as the difference
between the ".text" section in both files. Alas this is not the case as
section ".rel.dyn" has changed.

If the load address of the prelinked library is 0x4000000, the address of the section â.text "might be 0x40000120, whereas the address of the section â.textâ in the debug information is 0x00000110. The bias is always calculated as 0x40000000. All probes in the .text section have a wrong offset by 0x10.

I hope this provides some insight into the problem. I'll continue my
attempts to provide a small example in the meantime.

 > BTW. Which versions of systemtap and elfutils does stap -V give you?

 > $ stap -V
 > Systemtap translator/driver (version 2.7/0.161, rpm 2.7-1.fc22)
 >                     the stap version -^   ^- the elfutils version

The versions I used for my current tests are:
Systemtap translator/driver (version 2.7/0.160, commit release-2.6-199-gd26e62cd8b30)
Systemtap translator/driver (version 2.8/0.160, commit release-2.7-166-gae0db08baa54)

 > Thanks,
 > Mark

Thanks,
Torsten


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]