1
0
forked from pool/virtualbox

Edit cxx17.patch for compatibility with the Extension Pack

This commit is contained in:
Jan Engelhardt 2024-10-02 01:41:53 +02:00
parent e025fac446
commit e20690747e
2 changed files with 49 additions and 10 deletions

View File

@ -1,20 +1,36 @@
From: Jan Engelhardt <ej@inai.de> From: Jan Engelhardt <ej@inai.de>
Date: 2024-09-20 22:48:58.758026690 +0200 Date: 2024-09-20 22:48:58.758026690 +0200
The code uses <filesystem>, so ensure we always use -std=c++17 at the very least. The code uses <filesystem>, so ensure we always use -std=c++17 at the
very least.
Prior to C++17, noexcept cannot be part of a type alias, and noexcept is not part of the Prior to C++17, noexcept cannot be part of a type alias, and so is
function signature. So it was ok that FNCONSUMER *didn't* match the function definition. not part of the function signature, and so is not part of the ABI.
In C++17, noexcept is part of the signature, so its absence/presence is significant. In C++17, noexcept is significant. There is a compile error because
the FNCONSUMER alias as defined in a .h file does not match the
function body in a .cpp file.
The def file is also wrong, but no one at virtualbox.org noticed for
some reason, even though the def mismatch also caused a link/build
failure in its own right.
To resolve the mismatch between .cpp/.h, the function signature is
augmented by RT_NOEXCEPT, based upon the function head being the
authoritative source as to whether something was meant to be noexcept
or not.
In turn, adding RT_NOEXCEPT causes a change in the ABI of VBoxRT.so.
The closed-source VirtualBox extension pack does not expect that and
is unable to load [LD_BIND_NOW=1]. To resolve _that_, we add extra
symbol aliases.
The def file is also wrong, but no one at virtualbox.org noticed for some reason even
though it also caused a link/build failure.
--- ---
Config.kmk | 3 +++ Config.kmk | 3 +++
include/iprt/cpp/restclient.h | 12 ++++++++++-- include/iprt/cpp/restclient.h | 12 ++++++++++--
src/VBox/Runtime/VBox/VBoxRTImp-gcc.def | 2 +- src/VBox/Runtime/VBox/VBoxRTImp-gcc.def | 2 +-
3 files changed, 14 insertions(+), 3 deletions(-) src/VBox/Runtime/common/rest/rest-binary.cpp | 9 +++++++++
4 files changed, 23 insertions(+), 3 deletions(-)
Index: VirtualBox-7.1.0/Config.kmk Index: VirtualBox-7.1.0/Config.kmk
=================================================================== ===================================================================
@ -73,3 +89,20 @@ Index: VirtualBox-7.1.0/src/VBox/Runtime/VBox/VBoxRTImp-gcc.def
_ZN22RTCRestBinaryParameter19setProducerCallbackEPDoFiPS_PvmyPmES1_y ; after-noexcept int64=llong _ZN22RTCRestBinaryParameter19setProducerCallbackEPDoFiPS_PvmyPmES1_y ; after-noexcept int64=llong
_ZN22RTCRestBinaryParameterC1Ev _ZN22RTCRestBinaryParameterC1Ev
_ZN22RTCRestBinaryParameterC2Ev _ZN22RTCRestBinaryParameterC2Ev
Index: VirtualBox-7.1.0/src/VBox/Runtime/common/rest/rest-binary.cpp
===================================================================
--- VirtualBox-7.1.0.orig/src/VBox/Runtime/common/rest/rest-binary.cpp
+++ VirtualBox-7.1.0/src/VBox/Runtime/common/rest/rest-binary.cpp
@@ -706,3 +706,12 @@ void RTCRestBinaryResponse::receiveCompl
AssertRC(rc);
}
+// extpack was built with wrong -std=, add a redirect
+extern "C" void DECLEXPORT_CLASS __attribute__((weak,
+alias("_ZN21RTCRestBinaryResponse19setConsumerCallbackEPDoFiPS_PKvmjmmEPv"))) // T symbol that exists
+ _ZN21RTCRestBinaryResponse19setConsumerCallbackEPFiPS_PKvmjmmEPv( // W symbol to make
+ RTCRestBinaryResponse::PFNCONSUMER, void *);
+extern "C" void DECLEXPORT_CLASS __attribute__((weak,
+alias("_ZN22RTCRestBinaryParameter19setProducerCallbackEPDoFiPS_PvmmPmES1_m"))) // T
+ _ZN22RTCRestBinaryParameter19setProducerCallbackEPFiPS_PvmmPmES1_m( // W
+ RTCRestBinaryParameter::PFNPRODUCER, void *, uint64_t);

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Oct 1 23:30:00 UTC 2024 - Jan Engelhardt <jengelh@inai.de>
- Edit cxx17.patch to make the Extension Pack work with our
compiler flags and RT_NOEXCEPT choices. [boo#1231225]
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Sep 29 12:00:17 UTC 2024 - Jan Engelhardt <jengelh@inai.de> Sun Sep 29 12:00:17 UTC 2024 - Jan Engelhardt <jengelh@inai.de>