diff options
Diffstat (limited to 'src/arch/post.c')
-rw-r--r-- | src/arch/post.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/arch/post.c b/src/arch/post.c index 1463709..f8864aa 100644 --- a/src/arch/post.c +++ b/src/arch/post.c @@ -29,6 +29,7 @@ #include "processor.h" #include "target.h" +#include "../analysis/routine.h" @@ -79,16 +80,27 @@ void post_process_target_resolution(GArchInstruction *instr, GArchProcessor *pro if (!g_target_operand_resolve(&new, bfmt, true, NULL)) { + init_mrange(&trange, &target, 0); + vmpa2_to_string(&target, MDS_UNDEFINED, loc, NULL); switch (type) { case STP_ROUTINE: snprintf(name, sizeof(name), "sub_%s", loc + 2); + + routine = g_binary_routine_new(); + symbol = G_BIN_SYMBOL(routine); + + g_binary_symbol_set_range(symbol, &trange); + g_binary_routine_set_name(routine, strdup(name)); break; case STP_CODE_LABEL: snprintf(name, sizeof(name), "loc_%s", loc + 2); + + symbol = g_binary_symbol_new(&trange, type); + g_binary_symbol_set_alt_label(symbol, name); break; default: @@ -97,14 +109,6 @@ void post_process_target_resolution(GArchInstruction *instr, GArchProcessor *pro } - routine = g_binary_routine_new(); - g_binary_routine_set_name(routine, strdup(name)); - - init_mrange(&trange, &target, 0); - g_binary_routine_set_range(routine, &trange); - - symbol = g_binary_symbol_new(type); - g_binary_symbol_attach_routine(symbol, routine); g_binary_format_add_symbol(bfmt, symbol); g_target_operand_resolve(&new, bfmt, true, NULL); |