From owner-freebsd-emulation@freebsd.org Mon Sep 18 03:27:09 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 50007E1A3D0 for ; Mon, 18 Sep 2017 03:27:09 +0000 (UTC) (envelope-from soralx@cydem.org) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 31B537CBBF for ; Mon, 18 Sep 2017 03:27:09 +0000 (UTC) (envelope-from soralx@cydem.org) Received: by mailman.ysv.freebsd.org (Postfix) id 2DD16E1A3CC; Mon, 18 Sep 2017 03:27:09 +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 2D7B9E1A3CB for ; Mon, 18 Sep 2017 03:27:09 +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 081437CBBE for ; Mon, 18 Sep 2017 03:27:09 +0000 (UTC) (envelope-from soralx@cydem.org) Received: by freefall.freebsd.org (Postfix) id 4A52F11718; Mon, 18 Sep 2017 03:27:08 +0000 (UTC) Delivered-To: vbox@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (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 3351811717 for ; Mon, 18 Sep 2017 03:27:08 +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 602767CBBD for ; Mon, 18 Sep 2017 03:27:06 +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 A654EF802 for ; Sun, 17 Sep 2017 19:55:53 -0700 (PDT) Date: Sun, 17 Sep 2017 19:55:51 -0700 From: To: Subject: [virtualbox-ose] Build failure: global register variable Message-ID: <20170917195419.431341e7@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: Mon, 18 Sep 2017 10:54:24 +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: Mon, 18 Sep 2017 03:27:09 -0000 Howdy! Any ideas on what could be a cause of the following build failure on this machine? FreeBSD 12.0-CURRENT #0 r323633 amd64 # cc --version FreeBSD clang version 5.0.0 (tags/RELEASE_500/final 312559) (based on LLVM 5.0.0svn) Target: x86_64-unknown-freebsd12.0 Thread model: posix InstalledDir: /usr/bin CPU: Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz (2691.32-MHz K8-class CPU) Origin="GenuineIntel" Id=0x206a7 Family=0x6 Model=0x2a Stepping=7 Features=0xbfebfbff Features2=0x1fbae3ff AMD Features=0x28100800 AMD Features2=0x1 XSAVE Features=0x1 VT-x: Basic Features=0xda0400 Pin-Based Controls=0x7f Primary Processor Controls=0xfff9fffe Secondary Processor Controls=0xff Exit Controls=0xda0400 Entry Controls=0xda0400 EPT Features=0x6114141 VPID Features=0xf01 TSC: P-state invariant, performance statistics Data TLB0: 2-MByte or 4 MByte pages, 4-way set associative, 32 entries Data TLB: 4 KB pages, 4-way set associative, 64 entries Instruction TLB: 2M/4M pages, fully associative, 8 entries Instruction TLB: 4KByte pages, 4-way set associative, 64 entries 64-Byte prefetching Shared 2nd-Level TLB: 4 KByte pages, 4-way associative, 512 entries L2 cache: 256 kbytes, 8-way associative, 64 bytes/line real memory = 8589934592 (8192 MB) 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" ^ In file included from /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/cpu-exec.c:30: /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" ^ 1 error generated. kmk: *** [/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/out/freebsd.amd64/release/obj/VBoxRemPrimary/cpu-exec.o] Error 1 The failing command: @cc -c -O2 -g -pipe -O2 -mtune=generic -fno-omit-frame-pointer -fno-strict-aliasing -fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -DRT_USE_VISIBILITY_DEFAULT -fPIC -Wno-sign-compare -Werror-implicit-function-declaration -m64 -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/Sun/crt -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/Sun -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/target-i386 -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/tcg -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/fpu -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/out/freebsd.amd64/release/obj/VBoxRemPrimary -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/VBox/VMM/include -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/tcg/i386 -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler -I/usr/local/include -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/out/freebsd.amd64/release/obj/VBoxRemPrimary/dtrace -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/include -I/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/out/freebsd.amd64/release -DVBOX -DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_REM -DVBOX_WITH_RAW_MODE -DRT_OS_FREEBSD -D__FREEBSD__ -DRT_ARCH_AMD64 -D__AMD64__ -DVBOX_WITH_DEBUGGER -DVBOX_WITH_HARDENING -DRTPATH_APP_PRIVATE=\"/usr/local/share/virtualbox-ose\" -DRTPATH_APP_PRIVATE_ARCH=\"/usr/local/lib/virtualbox\" -DRTPATH_SHARED_LIBS=\"/usr/local/lib/virtualbox\" -DRTPATH_APP_DOCS=\"/usr/local/share/doc/virtualbox-ose\" -DIN_RING3 -DHC_ARCH_BITS=64 -DGC_ARCH_BITS=64 -DPIC -DIN_REM_R3 -DREM_INCLUDE_CPU_H -DNEED_CPU_H -DVBOX_WITH_NEW_APIC -DVBOX_WITH_RAW_MODE -DVBOX_WITH_RAW_RING1 -DLOG_USE_C99 -D_BSD -D__x86_64__ -Wp,-MD,/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/out/freebsd.amd64/release/obj/V BoxRemPrimary/cpu-exec.o.dep -Wp,-MT,/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/out/freebsd.amd64/release/obj/VBoxRemPrimary/cpu-exec.o -Wp,-MP -o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/out/freebsd.amd64/release/obj/VBoxRemPrimary/cpu-exec.o /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recompiler/cpu-exec.c kmk: *** Waiting for unfinished jobs.... -- [SorAlx] ridin' VN2000 Classic LT From owner-freebsd-emulation@freebsd.org Thu Sep 21 02:17:18 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 9558AE0A59B for ; Thu, 21 Sep 2017 02:17:18 +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 7932063A48 for ; Thu, 21 Sep 2017 02:17:18 +0000 (UTC) (envelope-from soralx@cydem.org) Received: by mailman.ysv.freebsd.org (Postfix) id 788B7E0A59A; Thu, 21 Sep 2017 02:17:18 +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 781F9E0A599 for ; Thu, 21 Sep 2017 02:17:18 +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 5269E63A47 for ; Thu, 21 Sep 2017 02:17:18 +0000 (UTC) (envelope-from soralx@cydem.org) Received: by freefall.freebsd.org (Postfix) id 960E246A7; Thu, 21 Sep 2017 02:17:17 +0000 (UTC) Delivered-To: vbox@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (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 7F31946A6 for ; Thu, 21 Sep 2017 02:17:17 +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 BAE0463A45 for ; Thu, 21 Sep 2017 02:17:16 +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 CB94FF804 for ; Wed, 20 Sep 2017 19:17:10 -0700 (PDT) Date: Wed, 20 Sep 2017 19:17:10 -0700 From: To: Subject: Re: [virtualbox-ose] Build failure: global register variable Message-ID: <20170920191710.58d335df@mscad14> In-Reply-To: <20170917195419.431341e7@mscad14> References: <20170917195419.431341e7@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 09:55:02 +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 02:17:18 -0000 > Howdy! > > Any ideas on what could be a cause of the following build failure > on this machine? > > [...] > 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. -- [SorAlx] ridin' VN2000 Classic LT 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 From owner-freebsd-emulation@freebsd.org Fri Sep 22 23:01:30 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 8D165E146D0 for ; Fri, 22 Sep 2017 23:01:30 +0000 (UTC) (envelope-from jkim@FreeBSD.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 6A367822B6 for ; Fri, 22 Sep 2017 23:01:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: by mailman.ysv.freebsd.org (Postfix) id 69309E146CF; Fri, 22 Sep 2017 23:01:30 +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 68ACEE146CE for ; Fri, 22 Sep 2017 23:01:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 3A627822B5 for ; Fri, 22 Sep 2017 23:01:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: by freefall.freebsd.org (Postfix) id 87B7883FF; Fri, 22 Sep 2017 23:01:29 +0000 (UTC) Delivered-To: vbox@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (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 5AA2B83FE for ; Fri, 22 Sep 2017 23:01:29 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) by mx1.freebsd.org (Postfix) with ESMTP id 30C15821B5; Fri, 22 Sep 2017 23:01:25 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: [virtualbox-ose] Build failure: global register variable To: soralx@cydem.org, vbox@FreeBSD.org References: <20170917195419.431341e7@mscad14> <20170920191710.58d335df@mscad14> <20170921160000.689755f8@mscad14> From: Jung-uk Kim Message-ID: <5c68323f-5fed-342b-ad92-e74d178f9daf@FreeBSD.org> Date: Fri, 22 Sep 2017 19:00:30 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170921160000.689755f8@mscad14> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6dqovKTVV29EhUUsPtMhBjAgAMWjB914i" X-Mailman-Approved-At: Sat, 23 Sep 2017 10:48:58 +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: Fri, 22 Sep 2017 23:01:30 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6dqovKTVV29EhUUsPtMhBjAgAMWjB914i Content-Type: multipart/mixed; boundary="pf5um9quJBItC4M3Itu0WE8AhVaH4cDA0"; protected-headers="v1" From: Jung-uk Kim To: soralx@cydem.org, vbox@FreeBSD.org Message-ID: <5c68323f-5fed-342b-ad92-e74d178f9daf@FreeBSD.org> Subject: Re: [virtualbox-ose] Build failure: global register variable References: <20170917195419.431341e7@mscad14> <20170920191710.58d335df@mscad14> <20170921160000.689755f8@mscad14> In-Reply-To: <20170921160000.689755f8@mscad14> --pf5um9quJBItC4M3Itu0WE8AhVaH4cDA0 Content-Type: multipart/mixed; boundary="------------108A7E82504979B3712037CF" Content-Language: en-US This is a multi-part message in MIME format. --------------108A7E82504979B3712037CF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/21/2017 19:00, soralx@cydem.org wrote: >=20 >>> [...] >>> kBuild: Compiling VBoxRemPrimary >>> - /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/reco= mpiler/target-i386/op_helper.c >>> In file included >>> from /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/r= ecompiler/target-i386/op_helper.c:29: >>> /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/re= compiler/target-i386/exec.h:41:38: >>> error: register 'r14' unsuitable for global register variables on thi= s >>> target register struct CPUX86State *env asm(AREG0); ^ >>> /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.28/src/recomp= iler/dyngen-exec.h:81:15: >>> note: expanded from macro 'AREG0' >>> #define AREG0 "r14" =20 >> >> 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. >=20 > 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]. >=20 > 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. >=20 > [0] clang/lib/Basic/Targets/X86.h: > 860 bool validateGlobalRegisterVariable(StringRef RegName, unsigned= RegSize, > 861 bool &HasSizeMismatch) cons= t 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 =3D RegSize !=3D 64; > 867 return true; > 868 } Please try the attached patch. Jung-uk Kim --------------108A7E82504979B3712037CF Content-Type: text/x-patch; name="vbox.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="vbox.diff" Index: emulators/virtualbox-ose/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- emulators/virtualbox-ose/Makefile (revision 450418) +++ emulators/virtualbox-ose/Makefile (working copy) @@ -227,8 +227,12 @@ KMK_FLAGS+=3D -j${MAKE_JOBS_NUMBER} PATCH_DEPENDS+=3D ${LOCALBASE}/share/kBuild/tools/GXX3.kmk:devel/kBuild EXTRA_PATCHES+=3D ${PATCHDIR}/extrapatch-Config.kmk \ ${PATCHDIR}/extrapatch-src-VBox-Devices-PC-ipxe-Makefile.kmk \ - ${PATCHDIR}/extrapatch-src-recompiler-Makefile.kmk + ${PATCHDIR}/extrapatch-src_recompiler_dyngen-exec.h \ + ${PATCHDIR}/extrapatch-src_recompiler_tcg_i386_tcg-target.h +.if ${COMPILER_VERSION} < 35 +EXTRA_PATCHES+=3D ${PATCHDIR}/extrapatch-src-recompiler-Makefile.kmk .endif +.endif =20 .if ${PYTHON_MAJOR_VER} >=3D 3 PLIST_SUB+=3D PYTHON_PYCDIR=3D/__pycache__/ \ Index: emulators/virtualbox-ose/files/extrapatch-src_recompiler_dyngen-ex= ec.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- emulators/virtualbox-ose/files/extrapatch-src_recompiler_dyngen-exec.= h (nonexistent) +++ emulators/virtualbox-ose/files/extrapatch-src_recompiler_dyngen-exec.= h (working copy) @@ -0,0 +1,21 @@ +--- src/recompiler/dyngen-exec.h.orig 2017-09-13 09:34:47 UTC ++++ src/recompiler/dyngen-exec.h +@@ -75,10 +75,18 @@ typedef void * host_reg_t; + # ifndef VBOX + #define AREG0 "ebp" + # else /* VBOX - why are we different? frame-pointer optimizations on = mac? */ ++# ifndef __clang__ + # define AREG0 "esi" ++# else /* __clang __ */ ++# define AREG0 "ebp" ++# endif /* __clang __ */ + # endif /* VBOX */ + #elif defined(__x86_64__) ++# ifndef __clang__ + #define AREG0 "r14" ++# else /* __clang__ */ ++# define AREG0 "rbp" ++# endif /* __clang__ */ + #elif defined(_ARCH_PPC) + #define AREG0 "r27" + #elif defined(__arm__) Property changes on: emulators/virtualbox-ose/files/extrapatch-src_recomp= iler_dyngen-exec.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: emulators/virtualbox-ose/files/extrapatch-src_recompiler_tcg_i386_= tcg-target.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- emulators/virtualbox-ose/files/extrapatch-src_recompiler_tcg_i386_tcg= -target.h (nonexistent) +++ emulators/virtualbox-ose/files/extrapatch-src_recompiler_tcg_i386_tcg= -target.h (working copy) @@ -0,0 +1,23 @@ +--- src/recompiler/tcg/i386/tcg-target.h.orig 2017-09-13 09:34:48 UTC ++++ src/recompiler/tcg/i386/tcg-target.h +@@ -120,12 +120,20 @@ enum { +=20 + /* Note: must be synced with dyngen-exec.h */ + #if TCG_TARGET_REG_BITS =3D=3D 64 ++# ifndef __clang__ + # define TCG_AREG0 TCG_REG_R14 ++# else /* __clang__ */ ++# define TCG_AREG0 TCG_REG_RBP ++# endif /* __clang__ */ + #else + # ifndef VBOX /* we're using ESI instead of EBP, probably due to frame = pointer opt issues */ + # define TCG_AREG0 TCG_REG_EBP + # else /* VBOX */ ++# ifndef __clang__ + # define TCG_AREG0 TCG_REG_ESI ++# else /* __clang__ */ ++# define TCG_AREG0 TCG_REG_EBP ++# endif /* __clang__ */ + # endif /* VBOX */ + #endif +=20 Property changes on: emulators/virtualbox-ose/files/extrapatch-src_recomp= iler_tcg_i386_tcg-target.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property --------------108A7E82504979B3712037CF-- --pf5um9quJBItC4M3Itu0WE8AhVaH4cDA0-- --6dqovKTVV29EhUUsPtMhBjAgAMWjB914i Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAlnFlkAACgkQfJ+WJvzb 8Ua4MAf+NUABUa4WfBQrbFp27k0l7/pb/uoUamFOKjHGQNSG8xKR7Gzk8xCCfUy4 Xxf098Srgk6MtYqtHkHHXxExxDWx2UEMQa9jvBVwauJsgns2sVF+x89F9Bxbkx+a 1044JdOVRcNUp5vCp9sFbiaXqNo2FhCBdZFfs3ND1IBKvhEBZyI727UaaJd6cVJQ jHfyZCSrf+mdf9dlMBpNqmtcupzMzXyEZSonktbaByYvO0OVJ1AZGGYLfmM1ak7S jSaxNyB6TSV42RlTTgvYAljIL7486HfJssyyS1B7n17LEldiC04xEOkejA5m1ftE RT1FMIZVI/4DRaiDATjM378vIqt8fQ== =MMqD -----END PGP SIGNATURE----- --6dqovKTVV29EhUUsPtMhBjAgAMWjB914i--