Re: reproducible build

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

 



On 08/23/2015 07:50 AM, Stephan Gatzka wrote:
Hi!

I just added support for reproducible builds (-frandom-seed=) into the
qbs build system.

For a automated test case I'd like to have a small snippet of C/C++
code, which definitely leads to different object files if compiled
twice.

Probably the simplest program that produces a different object file
every second is:

  const char s[] = __DATE__ __TIME__;

but based on the mention of -frandom-seed I suspect a better test
case might be one whose outcome can be controlled by the option,
which is pretty much any file compiled with -flto:

$ (set -x; cat a.c && for o in '' -frandom-seed=123; do gcc -flto -c $o -o a1.o a.c && gcc -flto -c $o -o a2.o a.c && diff a1.o a2.o; done)
+ cat a.c
int bar (void) { return 0; }
+ for o in ''\'''\''' -frandom-seed=123
+ gcc -flto -c -o a1.o a.c
+ gcc -flto -c -o a2.o a.c
+ diff a1.o a2.o
Binary files a1.o and a2.o differ
+ for o in ''\'''\''' -frandom-seed=123
+ gcc -flto -c -frandom-seed=123 -o a1.o a.c
+ gcc -flto -c -frandom-seed=123 -o a2.o a.c
+ diff a1.o a2.o

Martin



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux