-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Unify the relocations loading #16705
Conversation
@ret2libc Again i move stuff up... sorry
Is this function well optimized? |
I guess that depends on what you mean by "well optimized" :) It is a foreach, it iterates over each element of the hash table and run a callback function. You can use that to convert the hashtable to an array. It will be O(n) and that is what matters for now I think. If we need even more optimization, we can take care of that later if/when needed. |
An other alternative could be
|
In the idea bin->relocs would hold all the data and rel_cache reference the array |
@ret2libc For me this refactorization is done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it's better to keep using Elf_(r_bin_elf_get_relocs)
to access relocations. Inside that function, you can fill bin->relocs
and bin->rel_cache
the first time and then return bin->relocs
once it was set.
I removed a check for bin->g_section because all the subfunctions do already the check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
* Mov init rel_cache inside the bin init * Introduce array cache * Use bin->relocs after loading all relocs * Handle bin->relocs == NULL * Remove last free * Use cache to get relocations
Your checklist for this pull request
Detailed description
The relocations are loaded 3 times... I try to fix that.
Test plan
...
Closing issues
#12732
...