Index: /trunk/Config.kmk
===================================================================
--- /trunk/Config.kmk	(revision 16018)
+++ /trunk/Config.kmk	(revision 16019)
@@ -2021,4 +2021,14 @@
  TEMPLATE_VBOXGCEXE_LDFLAGS.strict = -g
  TEMPLATE_VBOXGCEXE_LDFLAGS.release = -g
+ if1of ($(KBUILD_TARGET),freebsd)
+  # The FreeBSD port of gcc isn't picking up -m32 where it should. the .o order below isn't
+  # quite right (target source comes first), if it stops working we'll have to write a linker tool.
+  TEMPLATE_VBOXGCEXE_DEFS.$(KBUILD_TARGET)    = $(TEMPLATE_VBOXGC_DEFS.$(KBUILD_TARGET))    IPRT_DONT_USE_SYSTEM_STDINT_H
+  TEMPLATE_VBOXGCEXE_LDFLAGS.$(KBUILD_TARGET) = $(TEMPLATE_VBOXGC_LDFLAGS.$(KBUILD_TARGET)) -nostdlib -v
+  TEMPLATE_VBOXGCEXE_SOURCES.$(KBUILD_TARGET) = /usr/lib32/crtend.o /usr/lib32/crtn.o
+  TEMPLATE_VBOXGCEXE_SOURCES                  =	/usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/crtbegin.o
+  TEMPLATE_VBOXGCEXE_LIBPATH.$(KBUILD_TARGET) = /usr/lib32
+  TEMPLATE_VBOXGCEXE_LIBS.$(KBUILD_TARGET)    = /usr/lib32/libc.so
+ endif
 endif
 
Index: /trunk/include/iprt/stdint.h
===================================================================
--- /trunk/include/iprt/stdint.h	(revision 16018)
+++ /trunk/include/iprt/stdint.h	(revision 16019)
@@ -46,10 +46,11 @@
 #include <iprt/cdefs.h>
 
-#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) && !defined(_MSC_VER) && !defined(__IBMC__) && !defined(__IBMCPP__) && !defined(IPRT_NO_CRT) && !defined(DOXYGEN_RUNNING)
+#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) && !defined(_MSC_VER) && !defined(__IBMC__) && !defined(__IBMCPP__) \
+  && !defined(IPRT_NO_CRT) && !defined(IPRT_DONT_USE_SYSTEM_STDINT_H) && !defined(DOXYGEN_RUNNING)
 # include <stdint.h>
 
 #else
 
-#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) || defined(IPRT_NO_CRT) || defined(DOXGEN_RUNNING)
+#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) || defined(IPRT_NO_CRT) || defined(IPRT_DONT_USE_SYSTEM_STDINT_H) || defined(DOXGEN_RUNNING)
 /* machine specific */
 typedef signed char         __int8_t;
@@ -168,4 +169,18 @@
 #endif /* !C++ || __STDC_CONSTANT_MACROS */
 
+#if defined(RT_OS_FREEBSD) && defined(IPRT_DONT_USE_SYSTEM_STDINT_H)
+/* This is a hack to get tstVMStructGC.cpp building on FreeBSD. */
+# define __uintptr_t __bad_uintptr_t
+# define __uint64_t __bad_uint64_t
+# define __uint32_t __bad_uint32_t
+# define __uint16_t __bad_uint16_t
+# define __uint8_t  __bad_uint8_t
+# define __intptr_t __bad_intptr_t
+# define __int64_t  __bad_int64_t
+# define __int32_t  __bad_int32_t
+# define __int16_t  __bad_int16_t
+# define __int8_t   __bad_int8_t
+#endif
+
 #endif /* ! have usable stdint.h */
 
Index: /trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
===================================================================
--- /trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp	(revision 16018)
+++ /trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp	(revision 16019)
@@ -34,4 +34,19 @@
 #endif
 
+#include <VBox/types.h>
+#include <iprt/assert.h>
+AssertCompileSize(uint8_t,  1);
+AssertCompileSize(uint16_t, 2);
+AssertCompileSize(uint32_t, 4);
+AssertCompileSize(uint64_t, 8);
+AssertCompileSize(RTRCPTR,  4);
+#ifdef VBOX_WITH_64_BITS_GUESTS
+AssertCompileSize(RTGCPTR,  8);
+#else
+AssertCompileSize(RTGCPTR,  8);
+#endif
+AssertCompileSize(RTGCPHYS, 8);
+AssertCompileSize(RTHCPHYS, 8);
+
 
 /*******************************************************************************
@@ -46,23 +61,23 @@
 #include <VBox/vmm.h>
 #include <VBox/stam.h>
-#include "PDMInternal.h"
+#include "../PDMInternal.h"
 #include <VBox/pdm.h>
-#include "CFGMInternal.h"
-#include "CPUMInternal.h"
-#include "MMInternal.h"
-#include "PGMInternal.h"
-#include "SELMInternal.h"
-#include "TRPMInternal.h"
-#include "TMInternal.h"
-#include "IOMInternal.h"
-#include "REMInternal.h"
-#include "HWACCMInternal.h"
-#include "PATMInternal.h"
-#include "VMMInternal.h"
-#include "DBGFInternal.h"
-#include "STAMInternal.h"
-#include "CSAMInternal.h"
-#include "EMInternal.h"
-#include "REMInternal.h"
+#include "../CFGMInternal.h"
+#include "../CPUMInternal.h"
+#include "../MMInternal.h"
+#include "../PGMInternal.h"
+#include "../SELMInternal.h"
+#include "../TRPMInternal.h"
+#include "../TMInternal.h"
+#include "../IOMInternal.h"
+#include "../REMInternal.h"
+#include "../HWACCMInternal.h"
+#include "../PATM/PATMInternal.h"
+#include "../VMMInternal.h"
+#include "../DBGFInternal.h"
+#include "../STAMInternal.h"
+#include "../PATM/CSAMInternal.h"
+#include "../EMInternal.h"
+#include "../REMInternal.h"
 #include <VBox/vm.h>
 #include <VBox/param.h>
