Skip to content

Commit 8b5db66

Browse files
lorddoskiasakpm00
authored andcommitted
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/[email protected] Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent b62eb27 commit 8b5db66

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/bloat-o-meter

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ group = parser.add_mutually_exclusive_group()
1717
group.add_argument('-c', help='categorize output based on symbol type', action='store_true')
1818
group.add_argument('-d', help='Show delta of Data Section', action='store_true')
1919
group.add_argument('-t', help='Show delta of text Section', action='store_true')
20+
parser.add_argument('-p', dest='prefix', help='Arch prefix for the tool being used. Useful in cross build scenarios')
2021
parser.add_argument('file1', help='First file to compare')
2122
parser.add_argument('file2', help='Second file to compare')
2223

@@ -26,7 +27,11 @@ re_NUMBER = re.compile(r'\.[0-9]+')
2627

2728
def getsizes(file, format):
2829
sym = {}
29-
with os.popen("nm --size-sort " + file) as f:
30+
nm = "nm"
31+
if args.prefix:
32+
nm = "{}nm".format(args.prefix)
33+
34+
with os.popen("{} --size-sort {}".format(nm, file)) as f:
3035
for line in f:
3136
if line.startswith("\n") or ":" in line:
3237
continue

0 commit comments

Comments
 (0)