handle consecutive PC-relative instructions #238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Disclaimer: I'm not very familiar with C++ or
armeabi-v7a
architecture.However we encountered a problem using Dobby.
We hooked a function which originally does just one simple thing: read a int32 value from hard-coded vmaddr and return it. We changed the return value in the hook to meet our demand.
However this hook turned out to fail to work correctly on
armeabi-v7a
architecture.After some investigation, I realized that it's Dobby which cannot handle this situation correctly yet. Therefore I made a patch to deal with this problem.
Example1:
Example2:
The highlighted instruction adds the value of
pc
andvmaddr_offset_relative_to_pc
. When not relocated, this worked fine. The added-up sum value is meant to be a pointer which points to a "hard-coded" memory address which stores a "globally used" variable.However, after being relocated,
pc
has now changed. Nowpc
no longer points to the value it was originally meant to be. Therefore the added-up sum value now effectively becomes a wild pointer which points to some random place, which might lead to process crash or other malfunction.This patch changes the highlighted instruction to make it add the original un-relocated
pc
instead of the current relocatedpc
, so that the added-up sum value is recovered to point to the originally supposed position. Thus, the problem is fixed, only in this situation which I encountered - I think it's obvious that there are other situations, but fixing them is beyond my capabilities.