gcc-4.9.1 generating different code between two successive builds
Martin Sebor
msebor@gmail.com
Tue Dec 22 16:08:00 GMT 2015
On 12/21/2015 11:30 PM, Cole wrote:
> HI Martin,
>
> Thanks very much for the suggestions as well as all the information
> about the qsort issues.
>
> Did you ever publish your changes as a patch, or create a write up
> about what was necessary to create a reproducible build? I would be
> interested to see what others have done, and potentially anything else
> I may have missed.
No we didn't. Unfortunately, most of the work we did back then
was in a proprietary GCC fork.
Martin
>
> Thanks
> /Cole
>
> On 21 December 2015 at 21:08, Martin Sebor <msebor@gmail.com> wrote:
>> 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