[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH 2/2] bloat-o-meter: add -p argument with arch prefix
From: Jones Syue 薛懷宗 <jonessyue () qnap ! com>
Date: 2024-03-19 9:29:59
Message-ID: SI2PR04MB5097852D19B240522B0139E3DC2C2 () SI2PR04MB5097 ! apcprd04 ! prod ! outlook ! com
[Download RAW message or body]
This patch add '-p' argument with the arch prefix, in order to call
target-specific readelf for bloat-o-meter report. It is useful when cross
compiling busybox with specific toolchain, in case host's native readelf
does not work. '-p' help msg is leveraging linux kernel's bloat-o-meter.
For example, the arch prefix is 'arm-linux-gnu-':
./scripts/bloat-o-meter -p arm-linux-gnu- busybox_unstripped_{old,new}
Signed-off-by: Jones Syue <jonessyue@qnap.com>
---
scripts/bloat-o-meter | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 72b0693764bf..21dff3e4bf8d 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -19,6 +19,9 @@ parser.add_argument('-t', action='store_true',
help='Show time spent on parsing/processing')
parser.add_argument('--', dest='opt', default='',
help='Pass additional parameters to readelf, e.g. --="-a"')
+parser.add_argument('-p', dest='prefix', default='',
+ help='Arch prefix for the tool being used. Useful in '
+ 'cross build scenarios. e.g. -p arm-linux-gnu-')
parser.add_argument('file1', help='Old file to compare, '
'e.g. busybox_unstripped_old')
parser.add_argument('file2', help='New file to compare, '
@@ -30,7 +33,10 @@ if args.t:
def getsizes(file):
sym, alias, lut, section = {}, {}, {}, {}
- for l in os.popen("readelf -W -S " + file).readlines():
+ readelf = 'readelf'
+ if args.prefix:
+ readelf = "%sreadelf" % (args.prefix)
+ for l in os.popen("%s -W -S %s" % (readelf, file)).readlines():
x = l.replace("[ ", "[", 1).split()
if len(x)<6: continue
# Should take these into account too!
@@ -38,7 +44,7 @@ def getsizes(file):
if x[1] not in [".rodata"]: continue
sym[x[1]] = {"addr" : int(x[3], 16), "size" : int(x[5], 16)}
section[x[0][1:-1]] = {"name" : x[1]}
- for l in os.popen("readelf -W -s %s %s" % (args.opt, file)).readlines():
+ for l in os.popen("%s -W -s %s %s" % (readelf, args.opt, file)).readlines():
l = l.strip()
if not (len(l) and l[0].isdigit() and len(l.split()) == 8):
continue
--
2.1.4
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic