-
Notifications
You must be signed in to change notification settings - Fork 108
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
Read, modify, write? #654
Comments
This isn't really supported currently. There is For patching individual entries, we could expose some of the internals of that if it helps, such as |
Does something prevent me in general from writing a converter from the Are there some information missing/not accessible where I would need to do more reading/writing myself? E.g. I noticed that the |
FWIW, there are some half-baked ideas about similar transformations over DWARF in bytecodealliance/wasmtime#5537 Note that patching an executable is a bit harder of a constraint because the size of the encoded DWARF can change depending on what you're doing (even just changing an index can change size because of LEB128 encoding). |
These should already exist. I linked to some before.
The read API should provide all the information. The write API is aimed at producing DWARF, not patching it, so it may not support everything you need for patching.
See |
I know that patching will very likely result in having to extend the section in the binary and shift all following sections accordingly which is hard. In general, would you like gimli to have a patching ability anyway? To be clear, by patching I mean to not just change existing CIE / FDE, but also adding new records of these including byte code instructions etc. |
That part of the problem is outside the scope of gimli. You'll need to implement it in whatever is processing the ELF/Mach-O/COFF.
It depends on how you are proposing to implement the patching ability. Options that might fit in gimli are adding mutation of the existing write data structures, or adding a visitor for the transformation as mentioned in bytecodealliance/wasmtime#5537. It might be best to implement a prototype first to see what meets your needs. |
Can I use gimli to patch some stuff in the eh_frame section of an executable?
I saw there are two different structs for e.g. CIE's for read and write.
So I assume reading, modifying and writing again is not really a use case?
Probably because changing the size of anything would corrupt the whole binary?
Is patching inline, without changing the size, out of scope as well?
The text was updated successfully, but these errors were encountered: