40 std::optional<recomp::reloc_t*> reloc;
41 if (!(reloc = has_legit_reloc(sym)).has_value())
44 spdlog::info(
"adding transformations to relocation in symbol: {}",
48 xed_decoded_inst_t inst;
49 xed_state_t istate{XED_MACHINE_MODE_LONG_64, XED_ADDRESS_WIDTH_64b};
50 xed_decoded_inst_zero_set_mode(&inst, &istate);
52 if ((err = xed_decode(&inst, sym->
data().data(), sym->
data().size())) !=
54 spdlog::error(
"failed to decode instruction, reason: {} in symbol: {}",
55 xed_error_enum_t2str(err), sym->
name());
57 assert(err == XED_ERROR_NONE);
61 sym->
data().insert(sym->
data().end(), transforms_bytes.begin(),
62 transforms_bytes.end());
65std::optional<recomp::reloc_t*> reloc_transform_pass_t::has_legit_reloc(
74 return res != sym->
relocs().end() ? &(*res)
75 : std::optional<recomp::reloc_t*>();