[vbox-dev] Virtualbox 4.2.4 fails to compile with alignment error

Frank Mehnert frank.mehnert at oracle.com
Tue Dec 18 00:34:18 PST 2012


On Monday 17 December 2012 22:00:39 Maurice van der Pot wrote:
> On Mon, Dec 17, 2012 at 04:06:48PM +0100, Frank Mehnert wrote:
> > please share your compile flags. I assume you are using a debug
> > build, do you use any overrides in your LocalConfig.kmk?
> 
> I have no C/CXX/CPP/LDFLAGS set myself. The problem occurs with both
> debug and release builds and the only override I have in LocalConfig is
> to not build the additions.
> 
> I think the problem occurs on my 32-bit machines because they are both
> built without opengl. I see that the VGASTATE::IVBVACallbacks member is
> not present when passing --disable-opengl.

This was the information I was looking for and that explains it. This
configuration is less tested than the standard configuration.

> On 64-bit this structure is 24 bytes in size and assuming it's all
> pointers it'll probably be 12 bytes on 32-bit. This would explain why on
> 32-bit without opengl VGASTATE::Dev would not be 8-byte aligned.

The fix for your case is simple:

--- src/VBox/Devices/Graphics/DevVGA.h  (revision 82816)
+++ src/VBox/Devices/Graphics/DevVGA.h  (working copy)
@@ -277,6 +277,8 @@
 # if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || 
defined(VBOX_WITH_CRHGSMI))
     /** LUN\#0: VBVA callbacks interface */
     PDMIDISPLAYVBVACALLBACKS    IVBVACallbacks;
+# elif HC_ARCH_BITS == 32
+    uint32_t                    Padding0;
 # endif
     /** Pointer to base interface of the driver. */
     R3PTRTYPE(PPDMIBASE)        pDrvBase;

> > > What is the reason that an alignment of 8 bytes is required?
> > > Does this requirement also apply to (some of the) other members of the
> > > structure?
> 
> What I'm still unsure of is why certain members need this 8-byte
> alignment.

The 64-bit alignment is not really necessary but is preferred for
performance reasons.

Kind regards,

Frank
-- 
Dr.-Ing. Frank Mehnert | Software Development Director, VirtualBox
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Geschäftsführer: Jürgen Kunz

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://www.virtualbox.org/pipermail/vbox-dev/attachments/20121218/7d306591/attachment.bin 


More information about the vbox-dev mailing list