Mercurial > hg > CbC > CbC_gcc
diff contrib/compare-debug @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children |
line wrap: on
line diff
--- a/contrib/compare-debug Sun Aug 21 07:07:55 2011 +0900 +++ b/contrib/compare-debug Fri Oct 27 22:46:09 2017 +0900 @@ -2,7 +2,7 @@ # Compare stripped copies of two given object files. -# Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation +# Copyright (C) 2007, 2008, 2009, 2010, 2012 Free Software Foundation # Originally by Alexandre Oliva <aoliva@redhat.com> # This file is part of GCC. @@ -73,11 +73,35 @@ ;; 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