daily update
[external/binutils.git] / gas / testsuite / lib / doobjcmp
1 #!/bin/sh
2 # compare two object files, in depth.
3
4 x=$1
5 y=$2
6 BOTH="$1 $2"
7
8
9 # if they cmp, we're fine.
10 if (cmp $BOTH > /dev/null)
11 then
12         exit 0
13 fi
14
15 # otherwise, we must look closer.
16 if (doboth $BOTH size)
17 then
18         echo Sizes ok.
19 else
20         echo Sizes differ:
21         size $BOTH
22 #       exit 1
23 fi
24
25 if (doboth $BOTH objdump +header)
26 then
27         echo Headers ok.
28 else
29         echo Header differences.
30 #       exit 1
31 fi
32
33 if (doboth $BOTH objdump +text > /dev/null)
34 then
35         echo Text ok.
36 else
37         echo Text differences.
38 #       doboth $BOTH objdump +text
39 #       exit 1
40 fi
41
42 if (doboth $BOTH objdump +data > /dev/null)
43 then
44         echo Data ok.
45 else
46         echo Data differences.
47 #       doboth $BOTH objdump +data
48 #       exit 1
49 fi
50
51 if (doboth $BOTH objdump +symbols > /dev/null)
52 then
53         echo Symbols ok.
54 else
55         echo -n Symbol differences...
56
57         if (doboth $BOTH dounsortsymbols)
58         then
59                 echo but symbols are simply ordered differently.
60 #               echo Now what to do about relocs'?'
61 #               exit 1
62         else
63                 echo and symbols differ in content.
64                 exit 1
65         fi
66 fi
67
68 # of course, if there were symbol diffs, then the reloc symbol indexes
69 # will be off.
70
71 if (doboth $BOTH objdump -r > /dev/null)
72 then
73         echo Reloc ok.
74 else
75         echo -n Reloc differences...
76
77         if (doboth $BOTH dounsortreloc)
78         then
79                 echo but relocs are simply ordered differently.
80         else
81                 echo and relocs differ in content.
82                 exit 1
83         fi
84 fi
85
86 exit
87
88 # eof