Message ID | 1669973.bGtRa8e5aY@fomalhaut |
---|---|
State | New |
Headers | show |
Series | Fix LTO bootstrap on Windows (PR lto/85574) | expand |
On Thu, Jan 28, 2021 at 9:35 AM Eric Botcazou <botcazou@adacore.com> wrote: > > The last fix made for PR lto/85574 introduced a comparison of executables and > this cannot directly work on Windows because they are timestamped. Moreover > nobody sets $(exeext) at top level, at least on MinGW, so you get a weird > behavior because some tools add the implicit .exe suffix and others don't. > > Bootstrapped in LTO mode on Windows, OK for all active branches? OK and sorry for the breakage. Thanks, Richard. > > 2021-01-28 Eric Botcazou <ebotcazou@adacore.com> > > contrib/ > PR lto/85574 > * compare-lto: Deal with PE-COFF executables specifically. > > -- > Eric Botcazou
diff --git a/contrib/compare-lto b/contrib/compare-lto index 17379e196a7..c0bb71c0765 100755 --- a/contrib/compare-lto +++ b/contrib/compare-lto @@ -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