-
Notifications
You must be signed in to change notification settings - Fork 945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change procedure linkage table indirect calls to direct calls #1073
Conversation
When a function in an external dynamically-loaded library is called, the call is made indirectly through the procedure linkage table (PLT). The call into the PLT is made with an ordinary call instruction, but in the PLT there is a jump (not call) to the final destination. In this situation retdec is not properly handling the parameter passing. This change turns these indirect calls into direct calls and deletes the PLT code. This makes the result simpler and allows the parameters to be properly passed.
@PeterMatula, could you please review this PR? Thanks. |
I will, before the end of this week. |
Thanks @richardlford, I think in general it looks good. Few regression tests are failing, but I reviewed the problems and it looks like it is nothing related to output quality regression. Most fails are due to some crash I will have to further investigate, and probably one or two are some minor details that were testing the layout before your changes. |
@PeterMatula, sorry, I should have run the tests first. I am now setting up to run the regression tests myself, althrough I do not have Ada Pro so will not be able to run those. |
@PeterMatula, I have investigated the crashes. In my code, after making the PLT calls direct I was deleting the PLT function. But that was causing problems related to virtual calls. When I don't delete the PLT function only 3 tests are failing and those are ones where my changes cause improvement, so the test will need to be adjusted. I expect to have a new commit early next week. |
@PeterMatula, I would like your advice on some issues related to this change and have some questions.
I noticed that for the 32 bit arm binary, that the calls to the dynamically linked functions are in the
which appears to be target dependent. Do you agree? If so, is there a target independent way to do the same thing?
Thanks for your help. Dealing with multiple architectures definitely complicate things. By the way, do you have a standard way of producing binaries on all these platforms. Do you use cross-compilation, or do you have native systems for all these architectures? |
@PeterMatula, I did decide to accomplish my goal in the param_return pass rather than with these changes. Since I don't use any of these changes I'm closing this pull request. I've created a new pull request, #1085. I've also created a pull request in the retdec-regressions-tests repo, avast/retdec-regression-tests#117 (comment), to account for the effect of these changes. |
When a function in an external dynamically-loaded library is
called, the call is made indirectly through the
procedure linkage table (PLT). The call into the PLT is
made with an ordinary call instruction, but in the PLT
there is a jump (not call) to the final destination.
In this situation retdec is not properly handling
the parameter passing. This change turns these indirect
calls into direct calls and deletes the PLT code.
This makes the result simpler and allows the parameters
to be properly passed.