summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2022-07-01 14:35:13 +0300
committerakpm <akpm@linux-foundation.org>2022-07-17 17:31:40 -0700
commit8b5db6679807fd0ab1154375ea6e5aa6b11c4350 (patch)
tree1a1a5836e7fa58b90355de5d2c83688a6d69b84d /scripts
parentb62eb2731e17e83c32e1a6089b4463da1a75e66e (diff)
scripts/bloat-o-meter: add -p argument
When doing cross platform development on a machine sometimes it might be useful to invoke bloat-o-meter for files which haven't been build with the native toolchain. In cases when the host nm doesn't support the target one then a toolchain-specific nm could be used. Add this ability by adding the -p allowing invocations as: ./scripts/bloat-o-meter -p riscv64-unknown-linux-gnu- file1.o file2.o Link: https://lkml.kernel.org/r/20220701113513.1938008-2-nborisov@suse.com Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bloat-o-meter7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 2a360118710e..f9553f60a14a 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -17,6 +17,7 @@ group = parser.add_mutually_exclusive_group()
group.add_argument('-c', help='categorize output based on symbol type', action='store_true')
group.add_argument('-d', help='Show delta of Data Section', action='store_true')
group.add_argument('-t', help='Show delta of text Section', action='store_true')
+parser.add_argument('-p', dest='prefix', help='Arch prefix for the tool being used. Useful in cross build scenarios')
parser.add_argument('file1', help='First file to compare')
parser.add_argument('file2', help='Second file to compare')
@@ -26,7 +27,11 @@ re_NUMBER = re.compile(r'\.[0-9]+')
def getsizes(file, format):
sym = {}
- with os.popen("nm --size-sort " + file) as f:
+ nm = "nm"
+ if args.prefix:
+ nm = "{}nm".format(args.prefix)
+
+ with os.popen("{} --size-sort {}".format(nm, file)) as f:
for line in f:
if line.startswith("\n") or ":" in line:
continue