I have noticed that two consecutive builds of clang, clang++ and tblgen don't produce identical binaries (as in md5 sums) on identical source code (I'm on FreeBSD). I ran strings(1) on the two clang binaries, and I get the following:
Oh, I should point out that using randomness is the unfortunate part, but you can get deterministic builds by passing -frandom-seed=0 to clang and/or gcc.
Oh, I should point out that using randomness is the unfortunate part, but you can get deterministic builds by passing -frandom-seed=0 to clang and/or gcc.
One thing I have seen done with gcc is "gcc -c foo.c -o foo.o
-frandom-seed=foo.o". That way you still get a different seed for
different output files.
This is definitely not the direct output of clang. We mangle anonymous namespaces the same way that GCC does, i.e. 12_GLOBAL__N_1. If there's a compiler that mangles filenames into anonymous namespace names — or anything later in the toolchain which does it — I'm not aware of it.
I'll try that. I assume that the randomness has a purpose, so what are the negative implications of setting -frandom-seed=0? Will i still have a functioning compiler?
I'll try that. I assume that the randomness has a purpose, so what are the negative implications of setting -frandom-seed=0? Will i still have a functioning compiler?
The compiler being gcc? The manual says:
The STRING should be different for every file you compile.