From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Fwd: diverse double compilation: using $ORIGIN? Date: Thu, 02 Nov 2017 09:41:07 +0100 Message-ID: <87r2thgjj0.fsf@elephly.net> References: <87wp3agd60.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eABJ3-0005X7-JN for guix-devel@gnu.org; Thu, 02 Nov 2017 04:56:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eABIy-0005Nk-Oq for guix-devel@gnu.org; Thu, 02 Nov 2017 04:56:57 -0400 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eABIy-0005NE-GA for guix-devel@gnu.org; Thu, 02 Nov 2017 04:56:52 -0400 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org [resending to guix-devel@gnu.org because of mail problems / delays] Hi Guix, hi bootstrappers! When building packages, Guix embeds the absolute file name of the output directory in the resulting binary. That=E2=80=99s usually fine and what we want. Now let=E2=80=99s assume that we=E2=80=99d like to build the GCC sources wi= th diverse double compilation: we=E2=80=99d have a =E2=80=9Cgcc=E2=80=9D package that= =E2=80=99s built with =E2=80=9Cgcc-core=E2=80=9D; we=E2=80=99d also have a =E2=80=9Cgcc-from-clan= g=E2=80=9D package that uses Clang as its input. Since the GCC build procedure is performed at least two times (once with the bootstrap compiler, and then again with the GCC variant this produces), the resulting GCC binaries should be identical. Except that they are not. One of the reasons is that the binaries that Guix produces embed the target output directories. This means that the two compiler binaries that result from diverse double compilation will *always* differ in at least the embedded paths, such as paths to itself (e.g. to binaries in the libexec directory) and paths to. I wonder if we can use $ORIGIN in the compiler binaries, so that we can avoid (most) references to the output directories, thereby making the equality check between the diversely built compiler binaries simpler. Is this at all possible? Or do we need to accept that the equality check for diverse double compilation for binaries built with Guix must be aware of /gnu/store references and ignore those? Alternatively, could we move all of these store references into a wrapper script that would tell the binary about them via environment variables? The equality check would only need to exclude the wrapper script then and compare the two sets of compiler binaries naively. Does this make any sense? --=20 Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net