Date: Tue, 14 Apr 2020 13:51:04 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org Subject: svn commit: r531690 - in branches/2020Q2/emulators/virtualbox-ose: . files Message-ID: <202004141351.03EDp43F087476@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Tue Apr 14 13:51:04 2020 New Revision: 531690 URL: https://svnweb.freebsd.org/changeset/ports/531690 Log: MFH: r531689 emulators/virtualbox-ose: Switch build to USES= compiler:c++14-lang The runtime breakage that started occurring after the LLVM 7 -> 8 transition has been diagnosed with help from cem@, and the attached patch fixes it. The problem ended up being that tail-call optimization was being applied to this function (which should probably be written in assembly instead) and moving the tail-call to later on after some stack manipulations. The problem with this is that this particular function uses alloca() to carefully craft a stack that it's expecting to be used for the function it's calling at the end. The new patch fixes this using a technique that was committed later on in upstream changeset 75061 to address a similar failure with GCC sanitizers enabled. The FreeBSD-specific component of this patch is using the different stack setup if __clang__ is defined as well. The extra hunk in the Config patch has been added because the VirtualBox build system cannot cope with LLVM version numbers in the way it's expecting. Hardcode it to GCC 4.2 for FreeBSD, which is what the clang __GNU* macros describe, to fix build breakage that happens with newer LLVM as the build system decides our LLVM is an even older and more broken version of GCC with a broken regparm. PR: 236616, 244847 Approved by: koobs (mentor) Approved by: ports-secteam (blanket: major runtime fix caused by bad build) Added: branches/2020Q2/emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_xpcom_reflect_xptcall_src_md_unix_xptcinvoke__x86__64__linux.cpp - copied unchanged from r531689, head/emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_xpcom_reflect_xptcall_src_md_unix_xptcinvoke__x86__64__linux.cpp Modified: branches/2020Q2/emulators/virtualbox-ose/Makefile branches/2020Q2/emulators/virtualbox-ose/files/patch-Config.kmk Directory Properties: branches/2020Q2/ (props changed) Modified: branches/2020Q2/emulators/virtualbox-ose/Makefile ============================================================================== --- branches/2020Q2/emulators/virtualbox-ose/Makefile Tue Apr 14 13:47:51 2020 (r531689) +++ branches/2020Q2/emulators/virtualbox-ose/Makefile Tue Apr 14 13:51:04 2020 (r531690) @@ -3,7 +3,7 @@ PORTNAME= virtualbox-ose PORTVERSION= 5.2.34 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= emulators MASTER_SITES= https://download.oracle.com/virtualbox/${PORTVERSION}/ DISTFILES= VirtualBox-${PORTVERSION}${EXTRACT_SUFX} ${GUESTADDITIONS} @@ -30,13 +30,8 @@ CPE_PRODUCT= vm_virtualbox WRKSRC= ${WRKDIR}/VirtualBox-${PORTVERSION} ONLY_FOR_ARCHS= i386 amd64 -USES= cpe gnome iconv pkgconfig ssl tar:bzip2 +USES= compiler:c++14-lang cpe gnome iconv pkgconfig ssl tar:bzip2 USE_GNOME= libidl libxml2 -# machine/atomic.h may use features that are only available in GCC9. This is -# a workaround, anyways- we should be expressing USES= compiler:c++14-lang, but -# contemporary clang miscompiles virtualbox in some fashion and yields runtime -# breakage. -USE_GCC= any HAS_CONFIGURE= yes CONFIGURE_ARGS= --disable-java --passive-mesa Modified: branches/2020Q2/emulators/virtualbox-ose/files/patch-Config.kmk ============================================================================== --- branches/2020Q2/emulators/virtualbox-ose/files/patch-Config.kmk Tue Apr 14 13:47:51 2020 (r531689) +++ branches/2020Q2/emulators/virtualbox-ose/files/patch-Config.kmk Tue Apr 14 13:51:04 2020 (r531690) @@ -74,6 +74,17 @@ # branding VBOX_BRAND_LICENSE_HTML := $(PATH_ROOT)/doc/License-gpl-2.0.html VBOX_BRAND_LICENSE_RTF := $(PATH_ROOT)/doc/License-gpl-2.0.rtf +@@ -2538,6 +2534,10 @@ ifeq ($(KBUILD_HOST),win) ## @todo can drop this now, + # This isn't important (yet) on windows, so cook the result until + # cygwin is feeling better. + VBOX_GCC_VERSION := $(int-add $(int-mul 10000, 3), $(int-mul 100, 3), 3) ++else ifeq($(KBUILD_HOST,freebsd)) ++ # At a minimum, we'll be building with GCC 4.2 on FreeBSD. LLVM will always ++ # pose as GCC 4.2 anyways, so this seems safe. ++ VBOX_GCC_VERSION := $(int-add $(int-mul 10000, 4), $(int-mul 100, 2), 0) + else + # This is kind of bad, the returned string needs to be re-evaluated before use. + # The reason for this hack is that the windows kmk_ash cannot deal with $((1+1)). @@ -4158,6 +4154,7 @@ ifdef VBOX_WITH_RAW_MODE TEMPLATE_VBoxRc_TOOL = $(VBOX_GCC32_TOOL) TEMPLATE_VBoxRc_CXXFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC32_Wno-variadic-macros) -fno-exceptions $(VBOX_GCC_GC_OPT) $(VBOX_GCC_GC_FP) -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fno-strict-aliasing $(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) -fno-rtti $(VBOX_GCC_IPRT_FMT_CHECK) Copied: branches/2020Q2/emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_xpcom_reflect_xptcall_src_md_unix_xptcinvoke__x86__64__linux.cpp (from r531689, head/emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_xpcom_reflect_xptcall_src_md_unix_xptcinvoke__x86__64__linux.cpp) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/2020Q2/emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_xpcom_reflect_xptcall_src_md_unix_xptcinvoke__x86__64__linux.cpp Tue Apr 14 13:51:04 2020 (r531690, copy of r531689, head/emulators/virtualbox-ose/files/patch-src_libs_xpcom18a4_xpcom_reflect_xptcall_src_md_unix_xptcinvoke__x86__64__linux.cpp) @@ -0,0 +1,38 @@ +--- src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp.orig 2019-10-10 18:15:53 UTC ++++ src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp +@@ -143,11 +143,22 @@ XPTC_InvokeByIndex(nsISupports * that, PRUint32 method + if (nr_stack) + nr_stack = (nr_stack + 1) & ~1; + ++#if !defined(VBOX_WITH_GCC_SANITIZER) && !defined(__clang__) + // Load parameters to stack, if necessary + PRUint64 *stack = (PRUint64 *) __builtin_alloca(nr_stack * 8); ++#else ++ typedef struct { PRUint64 stack[20]; } methodStack; ++ if (nr_stack > 20) ++ return NS_ERROR_CALL_FAILED; ++ methodStack stack; ++#endif + PRUint64 gpregs[GPR_COUNT]; + double fpregs[FPR_COUNT]; ++#if !defined(VBOX_WITH_GCC_SANITIZER) && !defined(__clang__) + invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs); ++#else ++ invoke_copy_to_stack(stack.stack, paramCount, params, gpregs, fpregs); ++#endif + + // Load FPR registers from fpregs[] + register double d0 asm("xmm0"); +@@ -205,7 +216,12 @@ XPTC_InvokeByIndex(nsISupports * that, PRUint32 method + methodAddress += 8 * methodIndex; + methodAddress = *((PRUint64 *)methodAddress); + ++#if !defined(VBOX_WITH_GCC_SANITIZER) && !defined(__clang__) + typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64); + PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5); ++#else ++ typedef PRUint32 (*Method)(PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, PRUint64, methodStack); ++ PRUint32 result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5, stack); ++#endif + return result; + }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004141351.03EDp43F087476>