Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
libs_softmmu="-lutil $libs_softmmu"
fi
libs_softmmu="-lutil $libs_softmmu"
fi
+##########################################
+# check if the compiler defines offsetof
+
+need_offsetof=yes
+cat > $TMPC << EOF
+#include <stddef.h>
+int main(void) { struct s { int f; }; return offsetof(struct s, f); }
+EOF
+if compile_prog "" "" ; then
+ need_offsetof=no
+fi
+
# End of CC checks
# After here, no more $cc or $ld runs
# End of CC checks
# After here, no more $cc or $ld runs
if test "$fdt" = "yes" ; then
echo "CONFIG_FDT=y" >> $config_host_mak
fi
if test "$fdt" = "yes" ; then
echo "CONFIG_FDT=y" >> $config_host_mak
fi
+if test "$need_offsetof" = "yes" ; then
+ echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
+fi
# XXX: suppress that
if [ "$bsd" = "yes" ] ; then
# XXX: suppress that
if [ "$bsd" = "yes" ] ; then
#define QEMU_OSDEP_H
#include <stdarg.h>
#define QEMU_OSDEP_H
#include <stdarg.h>
#ifdef __OpenBSD__
#include <sys/types.h>
#include <sys/signal.h>
#ifdef __OpenBSD__
#include <sys/types.h>
#include <sys/signal.h>
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
+#ifdef CONFIG_NEED_OFFSETOF
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
#endif
#ifndef container_of
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
#endif
#ifndef container_of