-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
Add a function to provide the exact name of the relocation, show it in Rizin and Cutter outputs for relocations #4641
Comments
we could introduce |
What do you mean by |
what i meant is that we could just have an option to just print |
In any case, we just need something like Currently relocations are handled in:
|
There is also bin_pe.inc, mach0_relocs.c and possibly more for other executable formats. |
I'll start working on it. |
Lets just transfer |
I came up with this solution: break down the printing to 2 parts: the machine prefix, and the actual relocation type suffix (for example break on We could also alternatively use a hash map. I could implement both methods and check which one is faster |
i think having the name as by documentation for each format is better, since a user can search its meaning. |
No need to complicate things more than necessary with two indexes. The code needs to deal with more than just the ELF files, not every binary format will have the same naming scheme. Space savings from doing a split will be negligible, there will be few dozen relocation types per target platform at most. Even worse having two indexes means that you have replaced the fixed cost of few dozen relocation types with the runtime RAM usage for each relocation and there could be thousands of relocations per executable. Having a split strings also makes searching code more difficult. And the last thing I am somewhat skeptical about str_index in general (with or without split). Having str_index means that there needs to be single central relocation name string table. But the set of relaction types are specific to architecture/ binary format combination. And rizin can have dynamic plugins for adding support of new binary formats, which is incompatible with the idea of single central string table. You can probably just have a simple non owned |
Yeah you're right. Anyway I'll open a PR soon with the changes |
I fixed the ELF relocations, seems to be running well. I wanted to start working on the other formats, but apparently they aren't even checking for relocation types, just setting the Should I PR each format, or PR everything in one chunk? |
you can do it in one pr and on commit for format |
rz_bin_reloc_as_string()
functionir
command outputrz-bin -R
outputIs your feature request related to a problem? Please describe.
Couldn't find a way to change the relocation type naming to the names that
readelf
outputs (same names which are used in glibc, elf.h, etc) (eg. changeADD_64
relocation to appear asR_X86_64_64
)Describe the solution you'd like
An option on
Preferences->Analysis
(or whatever place seems fit for this option) to be able to toggle between the default and the classic relocation names.That way it would be easier to read the relocations since their names are aligned to the common naming convention, and the relocations would be more specific (from what I've seen so far, for example
SET_64
gets assigned to bothR_X86_64_TPOFF64
andR_X86_64_GLOB_DAT
)Describe alternatives you've considered
Additional context
If this sounds like a good idea I'll be more than happy to add it myself.
Here is an example of what the current naming looks like in Cutter:
And this is naming option I would like to add (not in order, just an example to what the naming looks like):
The text was updated successfully, but these errors were encountered: