Conceptually librz/bin/p/bin_elf.inc should implement the side towards the RzBin plugin interface, while standalong ELF parsing should mostly be in librz/bin/format/elf instead.
Relocs handling and patching is quite a chunk of code and it is currently implemented in librz/bin/p/bin_elf.inc, but a lot of it falls more in the category of ELF parsing so it would fit better in librz/bin/format/elf, in a new file elf_reloc.c.
What is a bit tricky here is that reloc patching somewhat depends on the generated final maps to know where to point relocs to (reloc_targets_map_base()).
From https://github.com/rizinorg/rizin/pull/1079#discussion_r632270049
Conceptually
librz/bin/p/bin_elf.inc
should implement the side towards the RzBin plugin interface, while standalong ELF parsing should mostly be inlibrz/bin/format/elf
instead. Relocs handling and patching is quite a chunk of code and it is currently implemented inlibrz/bin/p/bin_elf.inc
, but a lot of it falls more in the category of ELF parsing so it would fit better inlibrz/bin/format/elf
, in a new fileelf_reloc.c
. What is a bit tricky here is that reloc patching somewhat depends on the generated final maps to know where to point relocs to (reloc_targets_map_base()
).