Skip to content
Snippets Groups Projects
Commit 7aef469f authored by Niels Möller's avatar Niels Möller
Browse files

New function for decoding hex values, with a

new function hex2int. Also implemented calculation of total
storage, removed the dependence on the .comment section, and use
the $FILTER environment variable as a regexp for restricting the
object files that are considered.

Rev: src/nettle/ChangeLog:1.214
Rev: src/nettle/list-obj-sizes.awk:1.2
parent a3e9859d
No related branches found
No related tags found
No related merge requests found
2003-11-12 Niels Mller <niels@s3.kth.se>
* list-obj-sizes.awk: New function for decoding hex values, with a
new function hex2int. Also implemented calculation of total
storage, removed the dependence on the .comment section, and use
the $FILTER environment variable as a regexp for restricting the
object files that are considered.
2003-09-21 Niels Mller <nisse@cuckoo.hack.org> 2003-09-21 Niels Mller <nisse@cuckoo.hack.org>
* testsuite/rsa-encrypt-test.c (test_main): Don't use gmp_printf, * testsuite/rsa-encrypt-test.c (test_main): Don't use gmp_printf,
......
#! /usr/bin/gawk -f #! /usr/bin/awk -f
# Run this filter on the output of # Run this filter on the output of
# #
# objdump -h libnettle.a # objdump -h libnettle.a
function hex2int (hex) {
n = 0;
hex = tolower(hex);
for (i = 1; i<=length(hex); i++)
{
n = n * 16 + index("0123456789abcdef", substr(hex,i,1)) - 1;
}
return n;
}
BEGIN { BEGIN {
print "file text-size data-size rodata-size"; print "file text-size data-size rodata-size";
text_total = 0; text_total = 0;
data_total = 0; data_total = 0;
rodata_total = 0; rodata_total = 0;
name = "";
filter = ENVIRON["FILTER"];
if (!filter)
filter = ".*";
else
printf "Filter: %s\n", filter;
} }
/elf32/ { name = $1; text_size = data_size = rodata_size = 0; } /elf32/ {
/\.text/ { text_size = $3 } if (name)
/\.data/ { data_size = $3; } {
/\.rodata/ { rodata_size = $3; } printf "%25s %6x %6x %6x\n", name, text_size, data_size, rodata_size;
/\.comment/ { text_total += text_size;
printf "%15s %s %s %s\n", name, text_size, data_size, rodata_size; data_total += data_size;
rodata_total += rodata_size;
}
if ($1 ~ filter)
{
name = $1; text_size = data_size = rodata_size = 0;
}
else
name = ""
} }
/\.text/ { text_size = hex2int($3) }
/\.data/ { data_size = hex2int($3); }
/\.rodata/ { rodata_size = hex2int($3); }
END { END {
printf "%15s %s %s %s\n", "TOTAL", text_total, data_total, rodata_total; printf "%25s %6x %6x %6x\n", "TOTAL", text_total, data_total, rodata_total;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment