You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I've been using this project lately and one thing that bothers me a bit is the abstraction of most things that have just address(), for ELF this is the actual virtual address and for PE this is typically the RVA.
Describe the solution you'd like
It would be best to have either one address type or make them explicit via different types/function. For consistency it would be an alternative is to have all addresses on the PE also as virtual address instead of relative virtual address, if the rva is needed it can be done with the Binary interface.
Describe alternatives you've considered
I currently wrote my own wrapper above LIEF::Binary which makes the addresses consistent for each binary type, this resulted in writing multiple more wrappers as objects like Function, Symbol all result in different address types per binary type.
Additional context
I think the abstraction could be improved in general, if the PE would have Segments instead of Sections then it would be at least consistent with ELF, PE would not have sections anymore and ELF sections will always be optional. I don't know about all the other abstractions but I feel like the general LIEF::Binary interface could be better, rva_to_va/va_to_rva is something that I would expect there also, not necessarily specific to PE.
The text was updated successfully, but these errors were encountered:
I understand the need and it perfectly makes sense. Actually the PE sections can live independently from the PE::Binary object which embeds the imagebase through the OptionalHeader.
To enable accessing the imagebase from a PE section, it would require to, somehow, bind the PE section with the PE binary object so that we can transform a RVA into a VA.
This raises the complexity of keeping the different structures consistent with the potential modifications of the user. Actually if the LIEF's objects were read-only it would be quite easy to implement but since users can change ,for instance, the base address, it's a bit more tricky to handle.
If you have a draft of design which handles these aspects, let me know and we could see how to integrate it in LIEF.
Well one of the ideas is to always use virtual address, in theory we could do that during serialization/deserialization, so when we deserialize sections in the PE file we would simply add the image base already and store that value as address instead of keeping it rva, when we save the file we need to remove imagebase, I think what you have in mind is doing that in the object internally which indeed would add complexity. This way it would be hidden from the end user and the address would be generalized to virtual address.
Is your feature request related to a problem? Please describe.
I've been using this project lately and one thing that bothers me a bit is the abstraction of most things that have just address(), for ELF this is the actual virtual address and for PE this is typically the RVA.
Describe the solution you'd like
It would be best to have either one address type or make them explicit via different types/function. For consistency it would be an alternative is to have all addresses on the PE also as virtual address instead of relative virtual address, if the rva is needed it can be done with the Binary interface.
Describe alternatives you've considered
I currently wrote my own wrapper above LIEF::Binary which makes the addresses consistent for each binary type, this resulted in writing multiple more wrappers as objects like Function, Symbol all result in different address types per binary type.
Additional context
I think the abstraction could be improved in general, if the PE would have Segments instead of Sections then it would be at least consistent with ELF, PE would not have sections anymore and ELF sections will always be optional. I don't know about all the other abstractions but I feel like the general LIEF::Binary interface could be better, rva_to_va/va_to_rva is something that I would expect there also, not necessarily specific to PE.
The text was updated successfully, but these errors were encountered: