summaryrefslogtreecommitdiff
path: root/list-obj-sizes.awk
blob: b9093a275d8efd3b7e577d4a13f9285747d0d71b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /usr/bin/gawk -f

# Run this filter on the output of
#
#   objdump -h libnettle.a

BEGIN {
    print "file            text-size  data-size  rodata-size";
    text_total = 0;
    data_total = 0;
    rodata_total = 0;
}

/elf32/ { name = $1; text_size = data_size = rodata_size = 0;  }
/\.text/ { text_size = $3 }
/\.data/ { data_size = $3; }
/\.rodata/ { rodata_size = $3; }
/\.comment/ {
    printf "%15s %s   %s   %s\n", name, text_size, data_size, rodata_size;
}

END {
  printf "%15s %s   %s   %s\n", "TOTAL", text_total, data_total, rodata_total;
}