/*
* Sanity check that the size of an atomic operation isn't "overly large".
- * Despite the fact that e.g. i686 has 64-bit atomic operations, we do not
+ * Despite the fact that e.g. x86-64 has 128-bit atomic operations, we do not
* want to use them because we ought not need them, and this lets us do a
- * bit of sanity checking that other 32-bit hosts might build.
+ * bit of sanity checking that other 32- and 64-bit hosts might build.
*/
-#define ATOMIC_REG_SIZE sizeof(void *)
+#define ATOMIC_REG_SIZE sizeof(uint64_t)
/* Weak atomic operations prevent the compiler moving other
* loads/stores past the atomic operation load/store. However there is
# Compiler flags #
##################
-if cc.sizeof('void *') < 8
- error('QEMU requires a 64-bit CPU host architecture')
+if (cc.sizeof('void *') < 8) and (have_system or have_user)
+ error('QEMU emulator requires a 64-bit CPU host architecture. Only tools may be built for 32-bit.')
endif
foreach lang : all_languages
#
# Later checks assume we won't get atomic ops for int128 without
# explicitly asking for -latomic, so we must disable GCC's new
-# automatic linking with the new -fno-link-libatomic flag
-qemu_isa_flags += cc.get_supported_arguments('-fno-link-libatomic')
+# automatic linking with the new -fno-link-libatomic flag.
+#
+# When not building the emulators, but qemu helper tools only
+# (e.g. on 32-bit hosts), libatomic is sometimes required and
+# thus acceptable.
+if (have_system or have_user)
+ qemu_isa_flags += cc.get_supported_arguments('-fno-link-libatomic')
+else
+ qemu_ldflags += cc.get_supported_link_arguments('-latomic')
+endif
qemu_common_flags = qemu_isa_flags + qemu_common_flags