cb77f0d623ff3 (Kamil Rytarowski 2017-05-07 23:25:26 +0200 1) #!/usr/bin/env perl
b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100 2) # SPDX-License-Identifier: GPL-2.0
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 3)
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 4) #
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 5) # Takes a (sorted) output of readprofile and turns it into a list suitable for
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 6) # linker scripts
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 7) #
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 8) # usage:
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 9) # readprofile | sort -rn | perl profile2linkerlist.pl > functionlist
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 10) #
9c49fd307a6cb (Stephen Hemminger 2010-02-22 15:17:20 -0800 11) use strict;
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 12)
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 13) while (<>) {
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 14) my $line = $_;
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 15)
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 16) $_ =~ /\W*[0-9]+\W*([a-zA-Z\_0-9]+)\W*[0-9]+/;
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 17)
9c49fd307a6cb (Stephen Hemminger 2010-02-22 15:17:20 -0800 18) print "*(.text.$1)\n"
9c49fd307a6cb (Stephen Hemminger 2010-02-22 15:17:20 -0800 19) unless ($line =~ /unknown/) || ($line =~ /total/);
4bdc3b7f1b730 (Arjan van de Ven 2006-03-25 16:30:49 +0100 20) }