summaryrefslogtreecommitdiff
path: root/src/format/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/format.c')
-rw-r--r--src/format/format.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/format/format.c b/src/format/format.c
index 2808b67..2093469 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -192,11 +192,28 @@ void g_binary_format_add_symbol(GBinFormat *format, GBinSymbol *symbol)
format->symbols[format->symbols_count - 1] = symbol;
-
qsort(format->symbols, format->symbols_count,
sizeof(GBinSymbol *), (__compar_fn_t)g_binary_symbol_cmp);
+ switch (g_binary_symbol_get_target_type(symbol))
+ {
+ case STP_ROUTINE:
+ case STP_ENTRY_POINT:
+
+ format->routines = (GBinRoutine **)realloc(format->routines,
+ ++format->routines_count * sizeof(GBinRoutine *));
+
+ format->routines[format->routines_count - 1] = g_binary_symbol_get_routine(symbol);
+
+ qsort(format->routines, format->routines_count,
+ sizeof(GBinRoutine *), (__compar_fn_t)g_binary_routine_compare);
+ break;
+
+ default:
+ break;
+
+ }
}