]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - contrib/compare-lto
Avoid assuming maximum string length is constant [PR102960].
[thirdparty/gcc.git] / contrib / compare-lto
index 17379e196a7bd47a8eabd21f132cafe70a375073..c0bb71c07650e7132925c64f7ef4e094d462b1b9 100755 (executable)
@@ -32,7 +32,7 @@ case $1 in
 esac
 
 if test $# != 2; then
-  echo 'usage: compare-lto file1.o file2.o' >&2
+  echo 'usage: compare-lto file1 file2' >&2
   exit 1
 fi
 
@@ -101,6 +101,25 @@ else
     else
       status=1
     fi
+
+  # PE-COFF executables are timestamped so skip leading bytes for them.
+  else
+    case "$1" in
+      *.exe)
+        if cmp -i 256 "$1" "$2"; then
+          status=0
+        else
+          status=1
+        fi
+        ;;
+      *)
+        if test -f "$1.exe" && cmp -i 256 "$1.exe" "$2.exe"; then
+          status=0
+        else
+          status=1
+        fi
+        ;;
+    esac
   fi
 fi