public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* reproducible build
@ 2015-08-23 13:50 Stephan Gatzka
  2015-08-23 21:10 ` Martin Sebor
  0 siblings, 1 reply; 3+ messages in thread
From: Stephan Gatzka @ 2015-08-23 13:50 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

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.

I wasn't able to write such a snippet, so any help would be very
appreciated.

Regards,

Stephan

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3678 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: reproducible build
  2015-08-23 13:50 reproducible build Stephan Gatzka
@ 2015-08-23 21:10 ` Martin Sebor
  2015-08-24  4:46   ` Stephan Gatzka
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Sebor @ 2015-08-23 21:10 UTC (permalink / raw)
  To: Stephan Gatzka, gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: reproducible build
  2015-08-23 21:10 ` Martin Sebor
@ 2015-08-24  4:46   ` Stephan Gatzka
  0 siblings, 0 replies; 3+ messages in thread
From: Stephan Gatzka @ 2015-08-24  4:46 UTC (permalink / raw)
  To: Martin Sebor, gcc-help

Hi!

> 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

Ah, thanks, that is the stuff I was looking for.

Regards,

Stephan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-24  4:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-23 13:50 reproducible build Stephan Gatzka
2015-08-23 21:10 ` Martin Sebor
2015-08-24  4:46   ` Stephan Gatzka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).