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

Howard Su howard0su at gmail.com
Mon Feb 14 01:42:49 GMT 2011


Latest version of patch, tested in FreeBSD 8.1


Index: VBox/Main/src-server/xpcom/server.cpp
===================================================================
--- VBox/Main/src-server/xpcom/server.cpp       (revision 35941)
+++ VBox/Main/src-server/xpcom/server.cpp       (working copy)
@@ -662,23 +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;

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

@@ -941,8 +925,24 @@
         }

         registrar->AutoRegister(nsnull);
-        rc = RegisterSelfComponents(registrar, components,
-                                    NS_ARRAY_LENGTH (components));
+
+       components = 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
+       );
+
+       rc = RegisterSelfComponents(registrar, components,
+                                    1);
         if (NS_FAILED(rc))
         {
             RTMsgError("Failed to register server components! (rc=%Rhrc)", rc);
@@ -1098,5 +1098,7 @@
     if (g_pszPidFile)
         RTFileDelete(g_pszPidFile);

+    delete components;
+
     return 0;
 }
Index: VBox/Main/Makefile.kmk
===================================================================
--- VBox/Main/Makefile.kmk      (revision 35941)
+++ VBox/Main/Makefile.kmk      (working copy)
@@ -244,10 +244,6 @@
 VBoxSVC_DEFS.freebsd += VBOX_USE_LIBHAL

 VBoxSVC_CXXFLAGS = $(filter-out -Wno-unused,$(TEMPLATE_VBOXMAINEXE_CXXFLAGS))
-## @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_INCS = \
        include \




More information about the vbox-dev mailing list