Skip to content
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

No-link object file validation #42

Open
riidefi opened this issue Jul 22, 2021 · 2 comments
Open

No-link object file validation #42

riidefi opened this issue Jul 22, 2021 · 2 comments
Labels
devops Changes to the build system and CI p-medium

Comments

@riidefi
Copy link
Owner

riidefi commented Jul 22, 2021

Currently, we need to link an entire .dol/.rel executable to verify a function matches. Introducing a .o validator will enable faster iteration for both humans and computers ;)

@riidefi riidefi added devops Changes to the build system and CI enhancement p-medium labels Jul 22, 2021
@ghost ghost added p-medium and removed p-medium labels Jul 22, 2021
@ghost
Copy link

ghost commented Jul 24, 2021

Sounds easy enough :)
Will take a look at this with the help of wii-symbols/match-symbols.py, which can match relocatable/object code to binary blobs: https://github.com/terorie/wii-symbols/blob/master/scripts/match_symbols.py (the person who wrote this must have a massive brain and amazing code style :P)

Logic will be as follows:

Inputs: obj_syms: Set<Symbol>, bin_syms: Set<Symbol>
Output: bool
Algorithm:

known_syms = intersect(obj_syms, bin_syms)
for (obj_sym, bin_sym) in known_syms:
    if not obj_sym.match(bin_sym):
        return false
return true

@riptl
Copy link
Collaborator

riptl commented Jul 31, 2021

We decided to use an explicit approach instead. Rather than trying to derive which symbols get stripped through symbols.txt, we'll embed information into the object file.
We do this like with the BINARY_BLOB macro by writing debug information into a custom section that gets stripped from the DOL/REL.

Like this:

DEAD_STRIPPED(my_function);
void my_function() { ... }

@riptl riptl removed the enhancement label Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops Changes to the build system and CI p-medium
Projects
None yet
Development

No branches or pull requests

2 participants