comparison contrib/compare-debug @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 #! /bin/sh 1 #! /bin/sh
2 2
3 # Compare stripped copies of two given object files. 3 # Compare stripped copies of two given object files.
4 4
5 # Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation 5 # Copyright (C) 2007, 2008, 2009, 2010, 2012 Free Software Foundation
6 # Originally by Alexandre Oliva <aoliva@redhat.com> 6 # Originally by Alexandre Oliva <aoliva@redhat.com>
7 7
8 # This file is part of GCC. 8 # This file is part of GCC.
9 9
10 # GCC is free software; you can redistribute it and/or modify it under 10 # GCC is free software; you can redistribute it and/or modify it under
71 cp "$2" "$2.$suf2" 71 cp "$2" "$2.$suf2"
72 strip "$2.$suf2" 72 strip "$2.$suf2"
73 ;; 73 ;;
74 esac 74 esac
75 75
76 remove_comment ()
77 {
78 file=$1
79 opts=
80 for s in `objdump --section-headers "$file" | awk '{ print $2 }'`; do
81 case "$s" in
82 .comment*)
83 opts="$opts --remove-section $s"
84 ;;
85 esac
86 done
87 [ -n "$opts" ] && objcopy $opts $file
88 }
89
76 if cmp "$1.$suf1" "$2.$suf2"; then 90 if cmp "$1.$suf1" "$2.$suf2"; then
77 status=0 91 status=0
78 else 92 else
79 status=1 93 status=1
94
95 # Remove any .comment sections.
96 if (objcopy -v) 2>&1 | grep ' --remove-section' > /dev/null \
97 && (objdump --help) 2>&1 | grep ' --\[*section-\]*headers' > /dev/null; then
98 remove_comment "$1.$suf1"
99 remove_comment "$2.$suf2"
100 if cmp "$1.$suf1" "$2.$suf2"; then
101 status=0
102 fi
103 fi
80 104
81 # Assembler-generated CFI will add an .eh_frame section for -g not 105 # Assembler-generated CFI will add an .eh_frame section for -g not
82 # present in -g0. Try to cope with it by checking that an .eh_frame 106 # present in -g0. Try to cope with it by checking that an .eh_frame
83 # section is present in either object file, and then stripping it 107 # section is present in either object file, and then stripping it
84 # off before re-comparing. 108 # off before re-comparing.