Hi virtualbox developers,
I'm sending you a patch to make virtualbox "build" against gcc-5
(upcoming release, not yet stable.)
As usual my work has to be considered MIT licensed.
I'm not quite confortable with the patch, but I'm happy to share it with you
(I don't attach a file because as said I'm not quite confortable)
1) usual configure changes (don't know the gcc upper bound)
--- a/configure
+++ b/configure
@@ -420,9 +420,9 @@ check_gcc()
elif [ $cc_maj -lt 3 \
-o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
-o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
- -o \( $cc_maj -eq 4 -a $cc_min -gt 9 \) \
- -o $cc_maj -gt 4 ]; then
- log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or
gcc 4.x with 0<x<10"
+ -o \( $cc_maj -eq 5 -a $cc_min -gt 9 \) \
+ -o $cc_maj -gt 5 ]; then
+ log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or
gcc 5.x with 0<x<10"
fail really
else
log_success "found version $cc_ver"
2) three changes because gcc doesn't exactly know how to handle parenthesis
(not gcc-5 specific, I guess it is spotted because of some "Wparenthesis" build
flag that gcc-5 defaults to true)
--- a/src/VBox/Runtime/common/asn1/asn1-ut-bitstring.cpp
+++ b/src/VBox/Runtime/common/asn1/asn1-ut-bitstring.cpp
@@ -77,7 +77,7 @@ static DECLCALLBACK(int) rtAsn1BitStringEncodeCompare(const
void *pvBuf, size_t
{
RTASN1BITSTRINGWRITERCTX *pCtx = (RTASN1BITSTRINGWRITERCTX *)pvUser;
AssertReturn(cbToWrite <= pCtx->cbBuf - pCtx->offBuf, VERR_BUFFER_OVERFLOW);
- if (!memcmp(&pCtx->pbBuf[pCtx->offBuf], pvBuf, cbToWrite) != 0)
+ if (!memcmp(&pCtx->pbBuf[pCtx->offBuf], pvBuf, cbToWrite))
return VERR_NOT_EQUAL;
pCtx->offBuf += (uint32_t)cbToWrite;
return VINF_SUCCESS;
--- a/src/VBox/Runtime/common/asn1/asn1-ut-octetstring.cpp
+++ b/src/VBox/Runtime/common/asn1/asn1-ut-octetstring.cpp
@@ -77,7 +77,7 @@ static DECLCALLBACK(int) rtAsn1OctetStringEncodeCompare(const
void *pvBuf, size_
{
RTASN1OCTETSTRINGWRITERCTX *pCtx = (RTASN1OCTETSTRINGWRITERCTX *)pvUser;
AssertReturn(cbToWrite <= pCtx->cbBuf - pCtx->offBuf, VERR_BUFFER_OVERFLOW);
- if (!memcmp(&pCtx->pbBuf[pCtx->offBuf], pvBuf, cbToWrite) != 0)
+ if (!memcmp(&pCtx->pbBuf[pCtx->offBuf], pvBuf, cbToWrite))
return VERR_NOT_EQUAL;
pCtx->offBuf += (uint32_t)cbToWrite;
return VINF_SUCCESS;
--- a/src/VBox/Runtime/common/zip/tarvfs.cpp
+++ b/src/VBox/Runtime/common/zip/tarvfs.cpp
@@ -366,7 +366,7 @@ static int rtZipTarHdrValidate(PCRTZIPTARHDR pTar,
PRTZIPTARTYPE penmType)
{
case RTZIPTARTYPE_POSIX:
if ( !RT_C_IS_ALNUM(pTar->Common.typeflag)
- && !pTar->Common.typeflag == '\0')
+ && pTar->Common.typeflag != '\0') (maybe we can even remove
the !='\0)
return VERR_TAR_UNKNOWN_TYPE_FLAG;
break;
3) a build failure that goes away without the "-O" flag, but needs to be fixed
:)
(I do not have time/knowledge/resources to properly fix this)
root@Unimatrix04:/virtualbox-4.3.22-dfsg# g++ -c -g -pipe -ansi -Wall
-Wno-unused -Wno-non-virtual-dtor -Wno-invalid-offsetof -Wno-sign-compare
-Wno-unused -Wno-ctor-dtor-privacy -fvisibility-inlines-hidden
-fvisibility=hidden -DVBOX_HAVE_VISIBILITY_HIDDEN -DRT_USE_VISIBILITY_DEFAULT
-fdiagnostics-show-option -Wno-delete-non-virtual-dtor -fPIC -O -pthread
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/build
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/ds
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/io
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/base
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/components
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/threads
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/proxy/src
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/reflect/xptcall/src
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/ipc/ipcd/client/src
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/ipc/ipcd/shared/src
-I/virtualbox-4.3.22-dfsg/s!
rc/libs/xpcom18a4/ipc/ipcd/extensions/lock/src
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/src
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common
-I/virtualbox-4.3.22-dfsg/out/bin/sdk/bindings/xpcom/include
-I/virtualbox-4.3.22-dfsg/out/bin/sdk/bindings/xpcom/include/nsprpub
-I/virtualbox-4.3.22-dfsg/out/bin/sdk/bindings/xpcom/include/string
-I/virtualbox-4.3.22-dfsg/out/bin/sdk/bindings/xpcom/include/xpcom
-I/virtualbox-4.3.22-dfsg/out/bin/sdk/bindings/xpcom/include/ipcd
-I/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4
-I/virtualbox-4.3.22-dfsg/out/obj/VBox-xpcom-xptcall/dtrace
-I/virtualbox-4.3.22-dfsg/include -I/virtualbox-4.3.22-dfsg/out -DVBOX
-DVBOX_OSE -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_DEBUGGER -DRT_OS_LINUX
-D_FILE_OFFSET_BITS=64 -DRT_ARCH_AMD64 -D__AMD64__ -DVBOX_WITH_HARDENING
-DRTPATH_APP_PRIVATE=\"/usr/share/virtualbox\" -D!
RTPATH_APP_PRIVATE_ARCH=\"/usr/lib/virtualbox\" -DRTPATH_SHARE!
D_LIBS=\"/usr/lib/virtualbox\" -DRTPATH_APP_DOCS=\"/usr/share/doc/virtualbox\"
-DMOZILLA_CLIENT=1 -DNDEBUG=1 -D_IMPL_NS_COM -DXPCOM_DLL_BASE=\"VBoxXPCOM\"
-DMOZ_DLL_SUFFIX=\".so\" -DIN_RING3 -DVBOX_USE_IPRT_IN_XPCOM
-DVBOX_WITH_XPCOM_NAMESPACE_CLEANUP -DMOZ_PRESERVE_PIC -D_IMPL_NS_COM
-D_IMPL_NS_BASE -DEXPORT_XPTC_API -DOSTYPE=\"Linux2.6\" -DOSARCH=\"Linux\"
-DXP_UNIX=1 -D_GNU_SOURCE -DHAVE_VISIBILITY_ATTRIBUTE=1 -DHAVE_VA_LIST_AS_ARRAY
-DHAVE_VA_COPY -DVA_COPY\(a\,b\)=__builtin_va_copy\(a\,b\)
-Wp,-MD,/virtualbox-4.3.22-dfsg/out/obj/VBox-xpcom-xptcall/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.o.dep
-Wp,-MT,/virtualbox-4.3.22-dfsg/out/obj/VBox-xpcom-xptcall/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.o
-Wp,-MP -o
/virtualbox-4.3.22-dfsg/out/obj/VBox-xpcom-xptcall/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.o
/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp
/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp:
In function 'nsresult VBoxNsxpXPTC_InvokeByIndex(nsISupports*, PRUint32,
PRUint32, nsXPTCVariant*)':
/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp:211:1:
error: unable to find a register to spill
}
^
/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp:211:1:
error: this is the insn:
(insn 257 256 258 14 (parallel [
(set (reg:DI 325)
(udiv:DI (reg:DI 323)
(reg:DI 365)))
(set (reg:DI 382 [326])
(umod:DI (reg:DI 323)
(reg:DI 365)))
(clobber (reg:CC 17 flags))
])
/virtualbox-4.3.22-dfsg/src/libs/xpcom18a4/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_linux.cpp:147
352 {*udivmoddi4}
(expr_list:REG_UNUSED (reg:DI 382 [326])
(expr_list:REG_DEAD (reg:DI 365)
(expr_list:REG_DEAD (reg:DI 323)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))))
4) there are two "while (iPage-- > 0)" loops
the second makes an undefined behavior when "IN_RC" is not defined
/virtualbox-4.3.22-dfsg/src/VBox/VMM/VMMRZ/PGMRZDynMap.cpp: In function 'int
PGMRCDynMapAssertIntegrity(PVM)':
/virtualbox-4.3.22-dfsg/src/VBox/VMM/VMMRZ/PGMRZDynMap.cpp:1643:9: error: loop
exit may only be reached after undefined behavior
[-Werror=aggressive-loop-optimizations]
while (iPage-- > 0)
^
Hope this helps, in the following months hopefully gcc-5 will be released!
cheers,
Gianfranco
_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev