summaryrefslogtreecommitdiff
path: root/contrib/compare-debug
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2012-05-25 11:47:05 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2012-05-25 04:47:05 -0700
commitc7046906c3ae131726bd03f7841d4617425685d2 (patch)
tree4d4ee045f86eec61fd9efb0e98dc1a19147340df /contrib/compare-debug
parent619a69500d8ef2302cf6b8789ea2aa5553f54f34 (diff)
downloadgcc-c7046906c3ae131726bd03f7841d4617425685d2.tar.gz
Remove any .comment sections if the first cmp failed
PR bootstrap/53472 * contrib/compare-debug (remove_comment): New function. Remove any .comment sections if the first cmp failed. From-SVN: r187879
Diffstat (limited to 'contrib/compare-debug')
-rwxr-xr-xcontrib/compare-debug24
1 files changed, 24 insertions, 0 deletions
diff --git a/contrib/compare-debug b/contrib/compare-debug
index 010d17f9c69..fb8986dedfd 100755
--- a/contrib/compare-debug
+++ b/contrib/compare-debug
@@ -73,11 +73,35 @@ Darwin)
;;
esac
+remove_comment ()
+{
+ file=$1
+ opts=
+ for s in `objdump --section-headers "$file" | awk '{ print $2 }'`; do
+ case "$s" in
+ .comment*)
+ opts="$opts --remove-section $s"
+ ;;
+ esac
+ done
+ [ -n "$opts" ] && objcopy $opts $file
+}
+
if cmp "$1.$suf1" "$2.$suf2"; then
status=0
else
status=1
+ # Remove any .comment sections.
+ if (objcopy -v) 2>&1 | grep ' --remove-section' > /dev/null \
+ && (objdump --help) 2>&1 | grep ' --\[*section-\]*headers' > /dev/null; then
+ remove_comment "$1.$suf1"
+ remove_comment "$2.$suf2"
+ if cmp "$1.$suf1" "$2.$suf2"; then
+ status=0
+ fi
+ fi
+
# Assembler-generated CFI will add an .eh_frame section for -g not
# present in -g0. Try to cope with it by checking that an .eh_frame
# section is present in either object file, and then stripping it