From owner-svn-ports-all@freebsd.org Mon Sep 25 21:39:31 2017 Return-Path: Delivered-To: svn-ports-all@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 4BE9EE24B2C; Mon, 25 Sep 2017 21:39:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DBEE6A879; Mon, 25 Sep 2017 21:39:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8PLdUTD068206; Mon, 25 Sep 2017 21:39:30 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8PLdTCI068203; Mon, 25 Sep 2017 21:39:29 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201709252139.v8PLdTCI068203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 25 Sep 2017 21:39:29 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r450636 - in head/emulators/virtualbox-ose: . files X-SVN-Group: ports-head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/emulators/virtualbox-ose: . files X-SVN-Commit-Revision: 450636 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Sep 2017 21:39:31 -0000 Author: jkim Date: Mon Sep 25 21:39:29 2017 New Revision: 450636 URL: https://svnweb.freebsd.org/changeset/ports/450636 Log: Build recompiler with Clang if global register variable is supported. Note support for global register variable was proposed in the following upstream code reviews: https://reviews.llvm.org/D3261 https://reviews.llvm.org/D3797 and commits: http://llvm.org/viewvc/llvm-project?view=revision&revision=208104 http://llvm.org/viewvc/llvm-project?view=revision&revision=209149 However, it has very limited support as described in the following upstream PR in the gory details: https://bugs.llvm.org/show_bug.cgi?id=31005 Although it is incomplete, I *believe* Clang 3.5 and later has just enough code to support (ancient) QEMU-based recompiler. If you experience any VM crash related to recompiler, e.g., "fatal error in recompiler cpu" in its VBox.log, please let me know. FYI, QEMU was rewritten not to use this GCC-specific feature long time ago: http://lists.gnu.org/archive/html/qemu-devel/2011-05/msg00855.html https://www.mail-archive.com/qemu-devel@nongnu.org/msg63834.html Unfortunately, VirtualBox stopped merging code from QEMU for some time now. Tested by: soralx@cydem.org Added: head/emulators/virtualbox-ose/files/extrapatch-src_recompiler_dyngen-exec.h (contents, props changed) head/emulators/virtualbox-ose/files/extrapatch-src_recompiler_tcg_i386_tcg-target.h (contents, props changed) Modified: head/emulators/virtualbox-ose/Makefile Modified: head/emulators/virtualbox-ose/Makefile ============================================================================== --- head/emulators/virtualbox-ose/Makefile Mon Sep 25 21:21:33 2017 (r450635) +++ head/emulators/virtualbox-ose/Makefile Mon Sep 25 21:39:29 2017 (r450636) @@ -3,6 +3,7 @@ PORTNAME= virtualbox-ose PORTVERSION= 5.1.28 +PORTREVISION= 1 CATEGORIES= emulators MASTER_SITES= http://download.virtualbox.org/virtualbox/${PORTVERSION}/ DISTFILES= VirtualBox-${PORTVERSION}${EXTRACT_SUFX} ${GUESTADDITIONS} @@ -227,7 +228,11 @@ KMK_FLAGS+= -j${MAKE_JOBS_NUMBER} PATCH_DEPENDS+= ${LOCALBASE}/share/kBuild/tools/GXX3.kmk:devel/kBuild EXTRA_PATCHES+= ${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+= ${PATCHDIR}/extrapatch-src-recompiler-Makefile.kmk +.endif .endif .if ${PYTHON_MAJOR_VER} >= 3 Added: head/emulators/virtualbox-ose/files/extrapatch-src_recompiler_dyngen-exec.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/extrapatch-src_recompiler_dyngen-exec.h Mon Sep 25 21:39:29 2017 (r450636) @@ -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__) Added: head/emulators/virtualbox-ose/files/extrapatch-src_recompiler_tcg_i386_tcg-target.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/virtualbox-ose/files/extrapatch-src_recompiler_tcg_i386_tcg-target.h Mon Sep 25 21:39:29 2017 (r450636) @@ -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 { + + /* Note: must be synced with dyngen-exec.h */ + #if TCG_TARGET_REG_BITS == 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 +