From owner-freebsd-toolchain@FreeBSD.ORG Mon Nov 15 10:10:39 2010 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E51C2106564A; Mon, 15 Nov 2010 10:10:38 +0000 (UTC) (envelope-from erik@cederstrand.dk) Received: from csmtp3.one.com (csmtp3.one.com [91.198.169.23]) by mx1.freebsd.org (Postfix) with ESMTP id 7A2348FC08; Mon, 15 Nov 2010 10:10:38 +0000 (UTC) Received: from [192.168.0.22] (0x573fa596.cpe.ge-1-1-0-1109.ronqu1.customer.tele.dk [87.63.165.150]) by csmtp3.one.com (Postfix) with ESMTP id A78642406D6E; Mon, 15 Nov 2010 10:10:36 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; boundary=Apple-Mail-2114-123506905; protocol="application/pkcs7-signature"; micalg=sha1 From: Erik Cederstrand In-Reply-To: <4CE06C4F.7000002@FreeBSD.org> Date: Mon, 15 Nov 2010 11:10:35 +0100 Message-Id: References: <4CE06C4F.7000002@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1081) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-toolchain@freebsd.org Subject: Re: Clang and -frandom-seed X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2010 10:10:39 -0000 --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--