From: Jorge Natz <jorgenatzdev@gmail.com>
To: mmarek@suse.com, linux-kernel@vger.kernel.org, arjan@linux.intel.com
Cc: trivial@kernel.org
Subject: [PATCH] scripts: Translate profile2linkerlist.
Date: Sun, 07 Aug 2016 12:33:26 -0600 [thread overview]
Message-ID: <57A77EF6.5030200@gmail.com> (raw)
profile2linkerlist.pl is a script that takes the sorted output of the
readprofile command and turns it into a list of C functions in a
format for linker lists. Make the script more portable across POSIX
systems. This script does not use any shell-specific features, only
POSIX ones. A POSIX shell is present on all UNIX systems, while Perl
is not as commonplace.
Signed-off-by: Jorge Natz <jorgenatzdev@gmail.com>
---
diff -uprN a/scripts/profile2linkerlist.pl b/scripts/profile2linkerlist.pl
--- a/scripts/profile2linkerlist.pl 2016-06-10 17:27:15.333317028 -0600
+++ b/scripts/profile2linkerlist.pl 1969-12-31 17:00:00.000000000 -0700
@@ -1,19 +0,0 @@
-#!/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
-#
-use strict;
-
-while (<>) {
- my $line = $_;
-
- $_ =~ /\W*[0-9]+\W*([a-zA-Z\_0-9]+)\W*[0-9]+/;
-
- print "*(.text.$1)\n"
- unless ($line =~ /unknown/) || ($line =~ /total/);
-}
diff -uprN a/scripts/profile2linkerlist.sh b/scripts/profile2linkerlist.sh
--- a/scripts/profile2linkerlist.sh 1969-12-31 17:00:00.000000000 -0700
+++ b/scripts/profile2linkerlist.sh 2016-03-24 17:26:58.044958415 -0600
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Takes a (sorted) output of readprofile and turns it into a list suitable for
+# linker scripts.
+#
+# usage:
+# readprofile | sort -rn | ./profile2linkerlist.sh > functionlist
+
+# Exit on error
+set -e
+
+while read LINE; do
+ LINE=$( echo $LINE | sed -e s"/[0-9.][0-9.]*//" -e s"/[0-9.][0-9.]*$//" | xargs)
+ case $LINE in *unknown*|*total* ) continue
+ ;;
+ esac
+ echo '*(.text.'$LINE')'
+done
next reply other threads:[~2016-08-07 18:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-07 18:33 Jorge Natz [this message]
2016-08-07 20:16 ` [PATCH] scripts: Translate profile2linkerlist Michal Marek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57A77EF6.5030200@gmail.com \
--to=jorgenatzdev@gmail.com \
--cc=arjan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.com \
--cc=trivial@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.