summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/gas/testscripts/doobjcmp
blob: 8dbbdd7e9d0dd762ac5d5156f795c70733d80ea1 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
# $OpenBSD: doobjcmp,v 1.2 1998/02/15 18:50:12 niklas Exp $
# compare two object files, in depth.

x=$1
y=$2
BOTH="$1 $2"


# if they cmp, we're fine.
if (cmp $BOTH > /dev/null)
then
	exit 0
fi

# otherwise, we must look closer.
if (doboth $BOTH size)
then
	echo Sizes ok.
else
	echo Sizes differ:
	size $BOTH
#	exit 1
fi

if (doboth $BOTH objdump +header)
then
	echo Headers ok.
else
	echo Header differences.
#	exit 1
fi

if (doboth $BOTH objdump +text > /dev/null)
then
	echo Text ok.
else
	echo Text differences.
#	doboth $BOTH objdump +text
#	exit 1
fi

if (doboth $BOTH objdump +data > /dev/null)
then
	echo Data ok.
else
	echo Data differences.
#	doboth $BOTH objdump +data
#	exit 1
fi

if (doboth $BOTH objdump +symbols > /dev/null)
then
	echo Symbols ok.
else
	echo -n Symbol differences...

	if (doboth $BOTH dounsortsymbols)
	then
		echo but symbols are simply ordered differently.
#		echo Now what to do about relocs'?'
#		exit 1
	else
		echo and symbols differ in content.
		exit 1
	fi
fi

# of course, if there were symbol diffs, then the reloc symbol indexes
# will be off.

if (doboth $BOTH objdump -r > /dev/null)
then
	echo Reloc ok.
else
	echo -n Reloc differences...

	if (doboth $BOTH dounsortreloc)
	then
		echo but relocs are simply ordered differently.
	else
		echo and relocs differ in content.
		exit 1
	fi
fi

exit

# eof