[vbox-dev] Remove a hack in bsd which disable -O2 in VBoxSVC

Howard Su howard0su at gmail.com
Fri Feb 11 03:01:41 GMT 2011


The odd link error in freebsd is due to a GCC bug.
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37770)

The following patch is just a hack which shows the fix. I think the
real fix should remove nsModuleComponentInfoEx type, which is an
overkill to me.

-Jun

Index: src/VBox/Main/src-server/xpcom/server.cpp
===================================================================
--- src/VBox/Main/src-server/xpcom/server.cpp   (revision 35903)
+++ src/VBox/Main/src-server/xpcom/server.cpp   (working copy)
@@ -662,24 +662,7 @@

 ////////////////////////////////////////////////////////////////////////////////

-static const nsModuleComponentInfoEx components[] =
-{
-    nsModuleComponentInfoEx(
-        "VirtualBox component",
-        CLSID_VirtualBox,
-        NS_VIRTUALBOX_CONTRACTID,
-        VirtualBoxConstructor, // constructor function
-        NULL, // registration function
-        NULL, // deregistration function
-        VirtualBoxClassFactory::FactoryDestructor, // factory
destructor function
-        NS_CI_INTERFACE_GETTER_NAME(VirtualBox),
-        NULL, // language helper
-        &NS_CLASSINFO_NAME(VirtualBox),
-        0, // flags
-        VirtualBoxClassFactory::FactoryConstructor // factory
constructor function
-    )
-};
-
+static const nsModuleComponentInfoEx components[1];
 /////////////////////////////////////////////////////////////////////////////

 /**
@@ -716,6 +699,22 @@
                        PRUint32 count)
 {
     nsresult rc = NS_OK;
+    components[0] = new nsModuleComponentInfoEx(
+        "VirtualBox component",
+        CLSID_VirtualBox,
+        NS_VIRTUALBOX_CONTRACTID,
+        VirtualBoxConstructor, // constructor function
+        NULL, // registration function
+        NULL, // deregistration function
+        VirtualBoxClassFactory::FactoryDestructor, // factory
destructor function
+        NS_CI_INTERFACE_GETTER_NAME(VirtualBox),
+        NULL, // language helper
+        &NS_CLASSINFO_NAME(VirtualBox),
+        0, // flags
+        VirtualBoxClassFactory::FactoryConstructor // factory
constructor function
+    );
+
+
     const nsModuleComponentInfoEx *info = aComponents;
     for (PRUint32 i = 0; i < count && NS_SUCCEEDED(rc); i++, info++)
     {
Index: src/VBox/Main/Makefile.kmk
===================================================================
--- src/VBox/Main/Makefile.kmk  (revision 35903)
+++ src/VBox/Main/Makefile.kmk  (working copy)
@@ -247,7 +247,7 @@
 ## @todo We're disabling optimizations on FreeBSD to work around strange linker
 #        errors in release builds. Figure out why and how to work
around it in a
 #        more optimal fashion.
-VBoxSVC_CXXFLAGS.freebsd = -O0
+#VBoxSVC_CXXFLAGS.freebsd = -O0

 VBoxSVC_INCS = \
        include \


-- 
-Howard




More information about the vbox-dev mailing list