gcc-4.9.1 generating different code between two successive builds
Martin Sebor
msebor@gmail.com
Mon Dec 21 19:08:00 GMT 2015
On 12/20/2015 11:39 PM, Cole wrote:
> Hi,
>
> I am busy trying to generate a package for gcc that is consistent
> between two successive builds, and I am now down to the final few
> files.
>
> I am stuck with the file: cilk-abi-cilk-for.o, which is obviously
> built with -O2, but between two successive builds, the assembly code
> generated is different. Please refer to [1] for output and details.
>
> Would anyone have any suggestions that I might be able to try to get
> the file to generate the same assembly code?
It's been some time since I had to deal with this problem and
my recollection is somewhat fuzzy and probably inaccurate. IIRC,
part of it was caused by qsort being unstable (I think that was
on Solaris). We replaced it with a stable version. Another part
of it might have been caused by changes in the address space
layout caused by ASLR (causing differences in hash values used
by the register allocator or something like that). We disabled
ASLR to get around that (and other problems). With that, we had
fully repeatable builds. This was in the GCC 4.5 time frame.
With newer versions, there's also LTO that can affect things.
The -frandom-seed= option exists to make it possible to emit
identical object files that might otherwise be different.
Martin
More information about the Gcc
mailing list