Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | rz_bin_reloc_target_builder |
Functions | |
RZ_API ut64 | rz_bin_relocs_patch_find_targets_map_base (RzList *maps, ut64 target_sz) |
Finm a suitable location for putting the artificial reloc targets map. More... | |
RZ_API RzBinRelocTargetBuilder * | rz_bin_reloc_target_builder_new (ut64 target_size, ut64 target_base) |
RZ_API void | rz_bin_reloc_target_builder_free (RzBinRelocTargetBuilder *builder) |
RZ_API ut64 | rz_bin_reloc_target_builder_get_target (RzBinRelocTargetBuilder *builder, ut64 sym) |
obtain the address of the target for a given symbol More... | |
RZ_API void | rz_bin_relocs_patch_maps (RZ_NONNULL RzList *maps, RZ_NULLABLE RzBuffer *buf_patched, ut64 buf_patched_offset, ut64 target_vfile_base, ut64 target_vfile_size, RZ_NONNULL const char *vfile_name_patched, RZ_NONNULL const char *vfile_name_reloc_targets) |
Change file-mapped maps to the patched vfile if covered by the buffer and add the reloc target map. More... | |
RZ_API void rz_bin_reloc_target_builder_free | ( | RzBinRelocTargetBuilder * | builder | ) |
obtain the address of the target for a given symbol
When patchin a reloc that points to some symbol that itself is not part of the file (e.g. an import), this function is used to obtain an address in the reloc target map that the reloc can be patched to. On the first call with a new symbol, the builder will allocate a new address, which will be returned on all following calls with the same sym value.
sym | some (uninterpreted) unique identifier for a symbol. This function will always return the same value for a single symbol. |
Definition at line 69 of file relocs_patch.c.
References found, r, and ut64().
Referenced by patch_relocs().
RZ_API RzBinRelocTargetBuilder* rz_bin_reloc_target_builder_new | ( | ut64 | target_size, |
ut64 | target_base | ||
) |
target_size | size of a single reloc target in the vfile |
target_base | base address where the target vfile will be mapped, generated targets will start at this address. |
Definition at line 35 of file relocs_patch.c.
References free(), NULL, and RZ_NEW.
Referenced by patch_relocs().
Finm a suitable location for putting the artificial reloc targets map.
Definition at line 8 of file relocs_patch.c.
References addr, map(), maps(), max, rz_num_align_delta(), and ut64().
Referenced by reloc_targets_map_base().
RZ_API void rz_bin_relocs_patch_maps | ( | RZ_NONNULL RzList * | maps, |
RZ_NULLABLE RzBuffer * | buf_patched, | ||
ut64 | buf_patched_offset, | ||
ut64 | target_vfile_base, | ||
ut64 | target_vfile_size, | ||
RZ_NONNULL const char * | vfile_name_patched, | ||
RZ_NONNULL const char * | vfile_name_reloc_targets | ||
) |
Change file-mapped maps to the patched vfile if covered by the buffer and add the reloc target map.
buf_patched_offset | the offset of the data in buf_patched inside the real file. This is especially relevant for fatmach0 where the buf starts further into the fat file. |
Definition at line 86 of file relocs_patch.c.
References map(), maps(), rz_buf_sparse_populated_in(), rz_list_prepend(), RZ_NEW0, RZ_PERM_R, rz_return_if_fail, strdup(), and ut64().
Referenced by get_maps().