/* cg_print.c - Print routines for displaying call graphs.
- Copyright 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2004, 2007, 2009
+ Free Software Foundation, Inc.
This file is part of GNU Binutils.
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
\f
-#include "libiberty.h"
#include "gprof.h"
+#include "libiberty.h"
#include "search_list.h"
#include "source.h"
#include "symtab.h"
todo = cyc->cg.cyc.next;
cyc->cg.cyc.next = 0;
- for (doing = todo; doing && doing->cg.cyc.next; doing = todo)
+ for (doing = todo; doing != NULL; doing = todo)
{
todo = doing->cg.cyc.next;
{
if (symtab.base[index].ncalls == 0)
{
- /* Filter out gprof generated names. */
- if (strcmp (symtab.base[index].name, "<locore>")
- && strcmp (symtab.base[index].name, "<hicore>"))
- {
- unused_syms[unused++] = &symtab.base[index];
- symtab.base[index].has_been_placed = 1;
- }
+ unused_syms[unused++] = &symtab.base[index];
+ symtab.base[index].has_been_placed = 1;
}
else
{
}
}
+/* Compare two function_map structs based on file name.
+ We want to sort in ascending order. */
+
+static int
+cmp_symbol_map (const void * l, const void * r)
+{
+ return strcmp (((struct function_map *) l)->file_name,
+ ((struct function_map *) r)->file_name);
+}
+
/* Print a suggested .o ordering for files on a link line based
on profiling information. This uses the function placement
code for the bulk of its work. */
void
-cg_print_file_ordering ()
+cg_print_file_ordering (void)
{
unsigned long scratch_arc_count, index;
Arc **scratch_arcs;
printf ("%s\n", symtab.base[index].name);
}
+ qsort (symbol_map, symbol_map_count, sizeof (struct function_map), cmp_symbol_map);
+
/* Now output any .o's that didn't have any text symbols. */
last = NULL;
for (index = 0; index < symbol_map_count; index++)