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));