Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Macros | |
#define | CASE(T) case ((T) / 8): reloc->type = RZ_BIN_RELOC_##T; break |
#define | CASE(T) case ((T) / 8): rel_type = RZ_BIN_RELOC_##T; break |
#define | DO_BIND() |
Functions | |
static int | reloc_comparator (struct reloc_t *a, struct reloc_t *b) |
static void | parse_relocation_info (struct MACH0_(obj_t) *bin, RzSkipList *relocs, ut32 offset, ut32 num) |
static bool | is_valid_ordinal_table_size (ut64 size) |
static int | parse_import_ptr (struct MACH0_(obj_t) *bin, struct reloc_t *reloc, int idx) |
RZ_BORROW RzSkipList *MACH0_() | get_relocs (struct MACH0_(obj_t) *bin) |
static RzPVector * | get_patchable_relocs (struct MACH0_(obj_t) *obj) |
RZ_API bool MACH0_() | needs_reloc_patching (struct MACH0_(obj_t) *obj) |
static ut64 | reloc_target_size (struct MACH0_(obj_t) *obj) |
RZ_API ut64 MACH0_() | reloc_targets_vfile_size (struct MACH0_(obj_t) *obj) |
size of the artificial reloc target vfile More... | |
RZ_API ut64 MACH0_() | reloc_targets_map_base (RzBinFile *bf, struct MACH0_(obj_t) *obj) |
base vaddr where to map the artificial reloc target vfile More... | |
static bool | _patch_reloc (struct MACH0_(obj_t) *bin, struct reloc_t *reloc, ut64 symbol_at) |
RZ_API void MACH0_() | patch_relocs (RzBinFile *bf, struct MACH0_(obj_t) *obj) |
Patching of external relocs in a sparse overlay buffer. More... | |
#define DO_BIND | ( | ) |
|
static |
Definition at line 567 of file mach0_relocs.c.
References reloc_t::addr, CPU_TYPE_ARM, CPU_TYPE_ARM64, CPU_TYPE_ARM64_32, CPU_TYPE_X86_64, get_cputype_from_hdr(), MACH0_, reloc_t::offset, pc, reloc_t::pc_relative, rz_buf_write_at(), RZ_LOG_ERROR, RZ_MIN, rz_write_ble(), reloc_t::size, reloc_t::type, ut64(), val, X86_64_RELOC_BRANCH, and X86_64_RELOC_UNSIGNED.
Referenced by patch_relocs().
Definition at line 504 of file mach0_relocs.c.
References reloc_t::external, get_relocs(), MACH0_, NULL, relocs(), rz_pvector_new(), rz_pvector_push(), and rz_skiplist_foreach.
Referenced by needs_reloc_patching(), patch_relocs(), and reloc_targets_vfile_size().
RZ_BORROW RzSkipList* MACH0_() get_relocs | ( | struct MACH0_(obj_t) * | bin | ) |
Definition at line 120 of file mach0_relocs.c.
References reloc_t::addend, dyld_chained_ptr_arm64e_bind::addend, addr, reloc_t::addr, BIND_IMMEDIATE_MASK, BIND_OPCODE_ADD_ADDR_ULEB, BIND_OPCODE_DO_BIND, BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED, BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB, BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB, BIND_OPCODE_DONE, BIND_OPCODE_MASK, BIND_OPCODE_SET_ADDEND_SLEB, BIND_OPCODE_SET_DYLIB_ORDINAL_IMM, BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB, BIND_OPCODE_SET_DYLIB_SPECIAL_IMM, BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB, BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM, BIND_OPCODE_SET_TYPE_IMM, BIND_OPCODE_THREADED, BIND_SUBOPCODE_THREADED_APPLY, BIND_SUBOPCODE_THREADED_SET_BIND_ORDINAL_TABLE_SIZE_ULEB, calloc(), CASE, count, delta, DO_BIND, done, test_evm::end, found, free(), imm, is_valid_ordinal_table_size(), len, NULL, reloc_t::offset, opcodes, reloc_t::ord, dyld_chained_ptr_arm64e_bind::ordinal, dyld_chained_ptr_arm64e_auth_bind::ordinal, p, parse_import_ptr(), parse_relocation_info(), PFMT64x, reloc_comparator(), relocs(), RZ_ARRAY_SIZE, rz_buf_read_at(), RZ_FREE, RZ_LOG_ERROR, RZ_NEW0, rz_pvector_at(), rz_pvector_free(), rz_pvector_len(), rz_pvector_new_with_len(), rz_read_le64(), rz_return_val_if_fail, rz_skiplist_free(), rz_skiplist_insert(), rz_skiplist_new(), rz_sleb128(), skip(), st64, st8, autogen_x86imm::tmp, type, UT16_MAX, UT32_MAX, and ut64().
Referenced by get_patchable_relocs(), parse_classes(), and relocs().
Definition at line 532 of file mach0_relocs.c.
References get_patchable_relocs(), rz_pvector_len(), and rz_return_val_if_fail.
Referenced by patch_relocs().
Definition at line 72 of file mach0_relocs.c.
References reloc_t::addend, reloc_t::addr, CASE, i, setup::idx, reloc_t::offset, REFERENCE_FLAG_UNDEFINED_LAZY, REFERENCE_TYPE, S_LAZY_SYMBOL_POINTERS, S_NON_LAZY_SYMBOL_POINTERS, and SECTION_TYPE.
Referenced by get_relocs().
|
static |
Definition at line 17 of file mach0_relocs.c.
References reloc_t::addr, calloc(), reloc_t::external, free(), get_name(), i, info(), MACH0_, reloc_t::name, num, reloc_t::offset, reloc_t::ord, paddr_to_vaddr(), reloc_t::pc_relative, relocation_info::r_address, relocation_info::r_extern, relocation_info::r_length, relocation_info::r_pcrel, relocation_info::r_symbolnum, relocation_info::r_type, relocs(), rz_buf_read_at(), RZ_NEW0, rz_skiplist_insert(), rz_str_ncpy(), reloc_t::size, st32, reloc_t::type, and ut64().
Referenced by get_relocs().
Patching of external relocs in a sparse overlay buffer.
see also mach0_rebase.c for additional modification of the data that might happen.
Definition at line 614 of file mach0_relocs.c.
References _patch_reloc(), get_patchable_relocs(), MACH0_, needs_reloc_patching(), reloc_t::ord, reloc_target_size(), reloc_targets_map_base(), reloc_targets_vfile_size(), rz_bin_reloc_target_builder_free(), rz_bin_reloc_target_builder_get_target(), rz_bin_reloc_target_builder_new(), rz_buf_new_sparse_overlay(), rz_buf_sparse_set_write_mode(), RZ_BUF_SPARSE_WRITE_MODE_SPARSE, RZ_BUF_SPARSE_WRITE_MODE_THROUGH, rz_pvector_foreach, rz_return_if_fail, reloc_t::target, and ut64().
Referenced by get_maps(), get_virtual_files(), rz_bflt_init(), rz_bflt_new_buf(), rz_bin_options_init(), rz_bin_reload(), and rz_core_bin_options_init().
Definition at line 538 of file mach0_relocs.c.
References bits(), get_bits_from_hdr(), and MACH0_.
Referenced by patch_relocs(), reloc_targets_map_base(), and reloc_targets_vfile_size().
base vaddr where to map the artificial reloc target vfile
Definition at line 556 of file mach0_relocs.c.
References get_maps_unpatched(), MACH0_, maps(), reloc_target_size(), rz_bin_relocs_patch_find_targets_map_base(), and rz_list_free().
Referenced by get_maps(), and patch_relocs().
size of the artificial reloc target vfile
Definition at line 547 of file mach0_relocs.c.
References get_patchable_relocs(), reloc_target_size(), and rz_pvector_len().
Referenced by get_maps(), get_virtual_files(), and patch_relocs().