From owner-freebsd-toolchain@FreeBSD.ORG Sun Nov 21 15:23:05 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 350CA1065674 for ; Sun, 21 Nov 2010 15:23:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id A8E968FC14 for ; Sun, 21 Nov 2010 15:23:04 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:b9a3:5f94:4931:f43f] (unknown [IPv6:2001:7b8:3a7:0:b9a3:5f94:4931:f43f]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id DE9E15C5A; Sun, 21 Nov 2010 16:22:58 +0100 (CET) Message-ID: <4CE93959.7070600@FreeBSD.org> Date: Sun, 21 Nov 2010 16:23:05 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13pre) Gecko/20101118 Lanikai/3.1.7pre MIME-Version: 1.0 To: Erik Cederstrand References: <4CE06C4F.7000002@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Sun, 21 Nov 2010 15:23:05 -0000 On 2010-11-15 11:10, Erik Cederstrand wrote: > 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. The path should relative, to guarantee the same result for every location you can put the source. > Where in the build scripts would I need to add this flag? Something like: > > CXXFLAGS += -frandom-seed=${.TARGET} Rather use: CXXFLAGS+=-frandom-seed=${.IMPSRC:S/^${.CURDIR}\///} which is rather contorted, but I see no other way to generate a relative path. :) Also, this generates an empty '-frandom-seed=' option for every command that uses CXXFLAGS but isn't a compilation at all, such as most linking commands. It is probably not harmful, though.