chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Make CHICKEN build process deterministic


From: Oleg Kolosov
Subject: Re: [Chicken-hackers] [PATCH] Make CHICKEN build process deterministic
Date: Sun, 5 Jun 2016 17:19:43 +0300

> On 05 Jun 2016, at 16:08, Oleg Kolosov <address@hidden> wrote:
> 
> 
>> On 05 Jun 2016, at 15:13, Kooda <address@hidden> wrote:
>> 
>> Hello,
>> 
>> I’ve been looking, in the past few days, at how to make CHICKEN
>> produce C files deterministically.
>> 
>> My goal here is to make it easier for package managers like Guix to
>> ship CHICKEN, as well as help us see how compiler changes affect the
>> generated output. I’m also highly interested in getting the same
>> binaries each time I compile a CHICKEN project.
>> 
>> So, here is a patch that does just that. I tried to make it as little
>> as possible and may have missed a few things.
>> 
>> The main problem was that the symbol hash table used a random seed,
>> which made the symbol order in the C files random. That’s what the new
>> deterministic-build unit addresses.
>> 
>> The other main source of non-determinism was the mention of the build
>> host and date at the top of the generated C files. I removed that
>> entirely as it doesn’t seem really useful.
>> 
>> I have left two identifiers untouched yet, unique-id in c-backend.scm
>> and make-random-name in support.scm. Both use (current-seconds) which
>> I want to remove.
>> 
>> Though it seems unique-id isn’t used anywhere, can I remove it
>> entirely?
>> 
>> About make-random-name, would it be ok to just remove the
>> current-seconds call or replace it with something else?
>> 
>> I also changed the default `ar` invocation options to make it generate
>> the same .a file each time it’s called with the same files, but sadly
>> the deterministic option doesn’t exist on Apple computers.
>> 
>> I hope all of this isn’t too messy. Please tell me what you think
>> about this change, I don’t want to impose anything.
>> 
>> If the change is accepted, I’ll make a new version of the patch and
>> port everything to chicken-5 as soon as I know what to do with the
>> remaining two identifiers.
>> 
>> Thanks in advance!
>> 
>> 
>> <0001-Make-CHICKEN-build-process-deterministic.patch>_______________________________________________
>> Chicken-hackers mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/chicken-hackers
> 
> Hello!
> 
> Great news! I've tried to figure this out some time ago without much success. 
> But my goal was to make it compatible with ccache.
> 
> I'm not familiar with code generator internals, can't review the patch, but 
> I'm interested in using this if there are no other unintended consequences.
> 
> P.S. Looks like the deterministic-build.scm is empty in the attached file.
> 
> -- 
> Regards, Oleg

I've tried it on 4.10 with ccache without luck - time and date in headers are 
gone but the names of CPS functions are still random. I've even replaced all 
calls to rand and srand with 0 in code just to be sure. Binary *.o files differ 
too.

P.S. Ignore a bit about empty file in previous message - my error.

-- 
Regards, Oleg


reply via email to

[Prev in Thread] Current Thread [Next in Thread]