Date: Mon, 15 Nov 2010 11:10:35 +0100 From: Erik Cederstrand <erik@cederstrand.dk> To: Dimitry Andric <dim@FreeBSD.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: Clang and -frandom-seed Message-ID: <FD61324A-1A22-4731-A563-B0BE8AB93069@cederstrand.dk> In-Reply-To: <4CE06C4F.7000002@FreeBSD.org> References: <E135940E-F79C-4DFA-811D-18CCBF3C609E@cederstrand.dk> <4CE06C4F.7000002@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail-2114-123506905 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Den 15/11/2010 kl. 00.10 skrev Dimitry Andric: > On 2010-11-14 23:29, Erik Cederstrand wrote: >> I noticed that two consecutive builds of (GCC-built) Clang don't = produce identical binaries. This is true for clang, clang++ and tblgen. = I asked on the llvm-dev list yesterday, and it turns out it's because = GCC uses a random seed on some symbols. Apparently, this can be = controlled with the -frandom-seed flag. I haven't tested if this is also = the case for Clang-built Clang. >>=20 > [...] > So this is all on purpose, and I think it would be a bad idea to = disable > it, unless we fully understand the consequences. >=20 > On the other hand, the requirement "The string should be different for > every file you compile", could possibly be fulfilled. Maybe by using > the filename, relative to $SRCDIR, that is being compiled as "seed"? >=20 > This would be unique for each compiled file, but still give the same > result for each build, and also be independent of the particular = machine > you are building on. I was thinking of something along the same lines. I think we agree that = it only needs to be random across files, not across builds. Someone on = llvm-dev also suggested using the path (either full or relative to src/) = as a seed. Where in the build scripts would I need to add this flag? Something = like: CXXFLAGS +=3D -frandom-seed=3D${.TARGET} in src.conf? Thanks, Erik= --Apple-Mail-2114-123506905--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FD61324A-1A22-4731-A563-B0BE8AB93069>