41 std::int32_t disp = {};
42 xed_decoded_inst_t inst;
43 xed_state_t istate{XED_MACHINE_MODE_LONG_64, XED_ADDRESS_WIDTH_64b};
44 xed_decoded_inst_zero_set_mode(&inst, &istate);
45 xed_decode(&inst, sym->
data().data(), XED_MAX_INSTRUCTION_BYTES);
48 if ((disp = xed_decoded_inst_get_branch_displacement(&inst))) {
49 disp += xed_decoded_inst_get_length(&inst);
52 xed_decoded_inst_set_branch_displacement(
53 &inst, sym->
data().size() - xed_decoded_inst_get_length(&inst),
54 xed_decoded_inst_get_branch_displacement_width(&inst));
56 xed_encoder_request_init_from_decode(&inst);
57 xed_encoder_request_t* req = &inst;
60 std::uint32_t len = {};
61 xed_encode(req, sym->
data().data(), xed_decoded_inst_get_length(&inst),
66 auto offset = disp < 0 ? sym->
offset() - std::abs(disp)
67 : sym->
offset() + std::abs(disp);
71 sym->
sym()->name.to_string(sym->
img()->get_strings()).data())
73 .append(std::to_string(offset));
symbol_t is an abstraction upon the coff symbol. this allows for easier manipulation of the symbol....
coff::symbol_t * sym() const
returns a pointer to the coff symbol object.
std::uintptr_t offset() const
gets the offset into the section where the symbol is located.
std::size_t hash()
gets the hash of the symbol name.
std::vector< std::uint8_t > & data()
returns a vector by reference of bytes containing the data of the symbol.
std::vector< recomp::reloc_t > & relocs()
returns a vector of relocations.
coff::image_t * img() const
gets the imagine in which the symbol is located inside of.
jcc rewrite pass which rewrites rip relative jcc's so that they are position independent.
void run(decomp::symbol_t *sym)
virtual method which must be implimented by the pass that inherits this class.
static jcc_rewrite_pass_t * get()
static next_inst_pass_t * get()
void run(decomp::symbol_t *sym)
virtual method which must be implimented by the pass that inherits this class.
meta data about a relocation for a symbol
this is the main namespace for obfuscation related things.