Bug#780000: gcc-4.9: LTO makes the build unreproducible
Package: gcc-4.9
Version: 4.9.2-10
Severity: minor
With the attached file, or really any program (e.g. src:pax):
1$ gcc -O2 -g -fPIE -fstack-protector-strong -flto=jobserver -c bottles.c
2$ gcc -O2 -g -fPIE -fstack-protector-strong -flto=jobserver -o x1 bottles.o
3$ gcc -O2 -g -fPIE -fstack-protector-strong -flto=jobserver -o x2 bottles.o
4$ md5sum x1 x2
9d58f432cfe6437fd83a807578400efe x1
a57d1253be60b9a520c140e9c55e5b47 x2
Removing “-flto=jobserver” from line #1 (!) makes it succeed.
If LTO information is included in the object file, even not
using LTO during link (line #2 and #3) creates diverging output.
While I like the reproducible builds effort in Debian, I kinda
don’t want to eliminate LTO for it… though src:mksh hasn’t been
using LTO for a while, as it regularily breaks in newer versions
of GCC…
-- System Information:
Debian Release: 8.0
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 3.16.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)
Versions of packages gcc-4.9 depends on:
ii binutils 2.25-5
ii cpp-4.9 4.9.2-10
ii gcc-4.9-base 4.9.2-10
ii libc6 2.19-15
ii libcloog-isl4 0.18.2-1+b2
ii libgcc-4.9-dev 4.9.2-10
ii libgmp10 2:6.0.0+dfsg-6
ii libisl10 0.12.2-2
ii libmpc3 1.0.3-1
ii libmpfr4 3.1.2-3
ii zlib1g 1:1.2.8.dfsg-2+b1
Versions of packages gcc-4.9 recommends:
ii libc6-dev 2.19-15
Versions of packages gcc-4.9 suggests:
pn gcc-4.9-doc <none>
pn gcc-4.9-locales <none>
pn gcc-4.9-multilib <none>
pn libasan1-dbg <none>
pn libatomic1-dbg <none>
pn libcilkrts5-dbg <none>
pn libgcc1-dbg <none>
pn libgomp1-dbg <none>
pn libitm1-dbg <none>
pn liblsan0-dbg <none>
pn libquadmath0-dbg <none>
pn libtsan0-dbg <none>
pn libubsan0-dbg <none>
-- no debconf information
/* $MirOS: contrib/hosted/tg/hellow/bottles.c,v 1.1 2011/04/02 19:49:44 tg Exp $ */
#include <stdio.h>
int
main(void)
{
int b;
for (b = 99; b >= 0; b--) {
switch (b) {
case 0:
printf("No more bottles of beer on the wall, no more bottles of beer.\n");
printf("Go to the store and buy some more, 99 bottles of beer on the wall.\n");
break;
case 1:
printf("1 bottle of beer on the wall, 1 bottle of beer.\n");
printf("Take one down and pass it around, no more bottles of beer on the wall.\n\n");
break;
default:
printf("%d bottles of beer on the wall, %d bottles of beer.\n", b, b);
printf("Take one down and pass it around, %d %s of beer on the wall.\n\n",
b - 1, ((b - 1) > 1) ? "bottles" : "bottle");
break;
}
}
return (0);
}
Reply to: