profile2linkerlist.pl 378 B

123456789101112131415161718192021
  1. #!/usr/bin/perl
  2. #
  3. # Takes a (sorted) output of readprofile and turns it into a list suitable for
  4. # linker scripts
  5. #
  6. # usage:
  7. # readprofile | sort -rn | perl profile2linkerlist.pl > functionlist
  8. #
  9. while (<>) {
  10. my $line = $_;
  11. $_ =~ /\W*[0-9]+\W*([a-zA-Z\_0-9]+)\W*[0-9]+/;
  12. if ( ($line =~ /unknown/) || ($line =~ /total/)) {
  13. } else {
  14. print "*(.text.$1)\n";
  15. }
  16. }