From owner-freebsd-emulation@freebsd.org Thu Sep 21 23:00:04 2017 Return-Path: Delivered-To: freebsd-emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 397A6E285D1 for ; Thu, 21 Sep 2017 23:00:04 +0000 (UTC) (envelope-from soralx@cydem.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 1E7056E6F1 for ; Thu, 21 Sep 2017 23:00:04 +0000 (UTC) (envelope-from soralx@cydem.org) Received: by mailman.ysv.freebsd.org (Postfix) id 1A9C0E285D0; Thu, 21 Sep 2017 23:00:04 +0000 (UTC) Delivered-To: emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A35DE285CF for ; Thu, 21 Sep 2017 23:00:04 +0000 (UTC) (envelope-from soralx@cydem.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E87BC6E6F0 for ; Thu, 21 Sep 2017 23:00:03 +0000 (UTC) (envelope-from soralx@cydem.org) Received: by freefall.freebsd.org (Postfix) id 2464914D3F; Thu, 21 Sep 2017 23:00:03 +0000 (UTC) Delivered-To: vbox@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id E8FDD14D3E for ; Thu, 21 Sep 2017 23:00:02 +0000 (UTC) (envelope-from soralx@cydem.org) Received: from smtp.triumf.ca (smtp.triumf.ca [142.90.100.188]) by mx1.freebsd.org (Postfix) with ESMTP id 09D916E6EC for ; Thu, 21 Sep 2017 23:00:01 +0000 (UTC) (envelope-from soralx@cydem.org) Received: from mscad14 (mscad14.triumf.ca [142.90.115.36]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.triumf.ca (Postfix) with ESMTP id D055CF805 for ; Thu, 21 Sep 2017 16:00:00 -0700 (PDT) Date: Thu, 21 Sep 2017 16:00:00 -0700 From: To: Subject: Re: [virtualbox-ose] Build failure: global register variable Message-ID: <20170921160000.689755f8@mscad14> In-Reply-To: <20170920191710.58d335df@mscad14> References: <20170917195419.431341e7@mscad14> <20170920191710.58d335df@mscad14> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; amd64-portbld-freebsd9.3) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 21 Sep 2017 23:30:23 +0000 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Sep 2017 23:00:04 -0000 > > [...] > > kBuild: Compiling VBoxRemPrimary > > - /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/target-i386/op_helper.c > > In file included > > from /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/target-i386/op_helper.c:29: > > /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/target-i386/exec.h:41:38: > > error: register 'r14' unsuitable for global register variables on this > > target register struct CPUX86State *env asm(AREG0); ^ > > /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/dyngen-exec.h:81:15: > > note: expanded from macro 'AREG0' > > #define AREG0 "r14" > > Turns out that the fix for this is to make sure that devel/kBuild > is compiled with GCC, not clang; thus, that module of VBox that > has global register variable (and fails to build with clang) is > automagically built with gcc. So some parts of VBox are built > with base clang, some with gcc from ports; it is awkward, but > it all works somehow. Alternatively, one can try changing 'r14' to 'rbp' in definition of "AREG0" for amd64 at src/recompiler/dyngen-exec.h:81. This is the only place where gcc is needed, as clang cannot handle r14 for now [0]. I recompiled kBuild with clang, and succeeded compiling virtualbox-ose with 'r14' to 'rbp' change. It seems to work normally, but I don't know what are the performance implications of using up rbp. [0] clang/lib/Basic/Targets/X86.h: 860 bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, 861 bool &HasSizeMismatch) const override { 862 // rsp and rbp are the only 64-bit registers the x86 backend can currently 863 // handle. 864 if (RegName.equals("rsp") || RegName.equals("rbp")) { 865 // Check that the register size is 64-bit. 866 HasSizeMismatch = RegSize != 64; 867 return true; 868 } -- [SorAlx] ridin' VN2000 Classic LT