View Single Post
Old 10-05-2017, 01:31 AM   #2
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
Address vs. file offset

In patch comments and the patch32lsb code I have used the term address as if it was the same thing as file offset, but that is not always true. For dynamic libraries such as libnickel.so.1.0.0 and librmsdk.so.1.0.0 they are the same, but for executables such as nickel and sickel they are different.

objdump works mainly with addresses, but the patch32lsb tool only deals with file offsets, so for some nickel and sickel patches it may be necessary to convert addresses to file offsets. If you use the -F switch with objdump it will show the file offsets along with the addresses. For example the objdump command:
Code:
$ objdump -dCF sickel | grep SickelService::Ping | grep ":$"
Output for firmware 4.5.9587:
Code:
0000b2bc <SickelService::Ping()> (File Offset: 0x32bc):
Output for firmware 4.6.9960:
Code:
000133d0 <SickelService::Ping()> (File Offset: 0x33d0):
So for sickel patches: in firmware 4.5.9587 add 0x8000 to the file offset to get the address, and in firmware 4.6.9660 add 0x10000 to the file offset to get the address.

Last edited by GeoffR; 10-05-2017 at 08:21 AM. Reason: spelling
GeoffR is offline   Reply With Quote