0
|
1 #! /bin/sh
|
|
2
|
|
3 # Compare stripped copies of two given object files.
|
|
4
|
|
5 # Copyright (C) 2007 Free Software Foundation
|
|
6 # Originally by Alexandre Oliva <aoliva@redhat.com>
|
|
7
|
|
8 # This file is part of GCC.
|
|
9
|
|
10 # GCC is free software; you can redistribute it and/or modify it under
|
|
11 # the terms of the GNU General Public License as published by the Free
|
|
12 # Software Foundation; either version 3, or (at your option) any later
|
|
13 # version.
|
|
14
|
|
15 # GCC is distributed in the hope that it will be useful, but WITHOUT
|
|
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
17 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
18 # License for more details.
|
|
19
|
|
20 # You should have received a copy of the GNU General Public License
|
|
21 # along with GCC; see the file COPYING3. If not see
|
|
22 # <http://www.gnu.org/licenses/>.
|
|
23
|
|
24 rm='rm -f'
|
|
25
|
|
26 case $1 in
|
|
27 -p | --preserve)
|
|
28 rm='echo preserving'
|
|
29 shift
|
|
30 ;;
|
|
31 esac
|
|
32
|
|
33 if test $# != 2; then
|
|
34 echo 'usage: compare-debug file1.o file2.o' >&2
|
|
35 exit 1
|
|
36 fi
|
|
37
|
|
38 if test ! -f "$1"; then
|
|
39 echo "$1" does not exist >&2
|
|
40 exit 1
|
|
41 fi
|
|
42
|
|
43 if test ! -f "$2"; then
|
|
44 echo "$2" does not exist >&2
|
|
45 exit 1
|
|
46 fi
|
|
47
|
|
48 suf1=stripped
|
|
49 while test -f "$1.$suf1"; do
|
|
50 suf1=$suf1.
|
|
51 done
|
|
52
|
|
53 suf2=stripped
|
|
54 while test -f "$2.$suf2"; do
|
|
55 suf2=$suf2.
|
|
56 done
|
|
57
|
|
58 trap 'rm -f "$1.$suf1" "$2.$suf2"' 0 1 2 15
|
|
59
|
|
60 cp "$1" "$1.$suf1"
|
|
61 strip "$1.$suf1"
|
|
62
|
|
63 cp "$2" "$2.$suf2"
|
|
64 strip "$2.$suf2"
|
|
65
|
|
66 if cmp "$1.$suf1" "$2.$suf2"; then
|
|
67 status=0
|
|
68 else
|
|
69 status=1
|
|
70 fi
|
|
71
|
|
72 $rm "$1.$suf1" "$2.$suf2"
|
|
73
|
|
74 trap "exit $status; exit" 0 1 2 15
|
|
75
|
|
76 exit $status
|