[PATCH] x86_64: Basic reorder infrastructure
[pandora-kernel.git] / scripts / profile2linkerlist.pl
diff --git a/scripts/profile2linkerlist.pl b/scripts/profile2linkerlist.pl
new file mode 100644 (file)
index 0000000..cb4260e
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+#
+# Takes a (sorted) output of readprofile and turns it into a list suitable for
+# linker scripts
+#
+# usage:
+#       readprofile | sort -rn | perl profile2linkerlist.pl > functionlist
+#
+
+while (<>) {
+  my $line = $_;
+
+  $_ =~ /\W*[0-9]+\W*([a-zA-Z\_0-9]+)\W*[0-9]+/;
+
+  if ( ($line =~ /unknown/) || ($line =~ /total/)) {
+
+  } else {
+    print "*(.text.$1)\n";
+  }
+}