blob: 3b452dc2a186e8ce93faeb1f43f6ca6c1ef8b923 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/bash
f1=$1
f2=$2
section_size ()
{
local f="$1"
local section="$2"
local s
s=$(readelf -S -W $f \
| grep "\.debug_$section" \
| sed 's/.*\.debug_//' \
| awk '{print $5}')
if [ "$s" = "" ]; then
echo 0
return
fi
# Convert hex to decimal.
s=$(printf "%d" $((16#$s)))
echo $s
}
size ()
{
local f="$1"
local total=0
local section
for section in info abbrev str macro types; do
total=$(($total + $(section_size $f $section)))
done
echo $total
}
s1=$(size $f1)
s2=$(size $f2)
if [ $s1 -ge $s2 ]; then
exit 1
fi
exit 0
|