Skip to content

viking: Check calls to unimplemented functions#2

Open
MonsterDruide1 wants to merge 1 commit intoLynxDev2:file-list-toolsfrom
MonsterDruide1:check-unimpl-funcs
Open

viking: Check calls to unimplemented functions#2
MonsterDruide1 wants to merge 1 commit intoLynxDev2:file-list-toolsfrom
MonsterDruide1:check-unimpl-funcs

Conversation

@MonsterDruide1
Copy link

Well, yea, what it says in the title.

  1. Add new mismatch type InternalError, to be used when something unexpected happens within viking. Should hopefully never be shown to the user, but I would rather display a cryptic mismatch (that can be ignored by marking as "mismatching") rather than silently fail and mark it as matching (existing behaviour, probably still happens for some things)
  2. Parse more things from the ELF, namely .dynsym and .dynstrtab to resolve names of .plt-references
  3. Add functions from .plt to list of functions, to allow them to be "resolved" when comparing. For example, if some code calls cos(...), cos is not listed in the file_list.yml, so should rather be imported from .plt.
  4. Finally, when checking function calls, pay more attention to the failures: If the name within the file list of a called function is empty, but we expect it to be implemented, it's likely the name being missing from the list. If a given name does not occur in the decomp elf, we likely called the wrong function, and the actual target function never got called/emitted. Finally, if the address of the expected function call and the actual call target mismatch, that's the standard "chose the wrong function" scenario.

The logic in 4 was mostly in place before as well, but has now been extended with multiple plt_X_to_X calls, which take over when the "standard functions" return no results: Functions in the PLT have a symbol, but it's pointing to 0 instead of the actual function, so name/address have to be mapped via relocations.

@MonsterDruide1
Copy link
Author

As discussed in DMs, these changes should be applied on upstream instead:
open-ead#38

I'll leave this PR open to serve as reference when porting the changes back into our fork. Close it whenever you like @LynxDev2 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant