{"id":2221050,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2221050/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408105605.172465-3-mjt@tls.msk.ru/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260408105605.172465-3-mjt@tls.msk.ru>","date":"2026-04-08T10:55:57","name":"[PULL,2/3] Allow building qemu tools on 32-bit hosts","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d81632222c056fe2524cfd998df79e54c8961e9c","submitter":{"id":183,"url":"http://patchwork.ozlabs.org/api/1.1/people/183/?format=json","name":"Michael Tokarev","email":"mjt@tls.msk.ru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408105605.172465-3-mjt@tls.msk.ru/mbox/","series":[{"id":499181,"url":"http://patchwork.ozlabs.org/api/1.1/series/499181/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499181","date":"2026-04-08T10:55:57","name":"[PULL,1/3] util/meson.build: do not add cpuinfo-$arch to util_ss for 32bit CPUs","version":1,"mbox":"http://patchwork.ozlabs.org/series/499181/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221050/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221050/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=tls.msk.ru header.i=@tls.msk.ru header.a=rsa-sha256\n header.s=202602 header.b=Xeh8Vkgj;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (unknown [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frWwz6Tt6z1xv0\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 04:36:18 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAXkw-0008Ts-Up; Wed, 08 Apr 2026 14:36:03 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <mjt@tls.msk.ru>)\n id 1wAXkv-0008TM-DR; Wed, 08 Apr 2026 14:36:01 -0400","from isrv.corpit.ru ([212.248.84.144])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <mjt@tls.msk.ru>)\n id 1wAQds-0000Pc-Ow; Wed, 08 Apr 2026 07:00:20 -0400","from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2])\n by isrv.corpit.ru (Postfix) with ESMTP id 13E5F19C29C;\n Wed, 08 Apr 2026 13:55:20 +0300 (MSK)","from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146])\n by tsrv.corpit.ru (Postfix) with ESMTP id 62B2C391676;\n Wed, 08 Apr 2026 13:56:07 +0300 (MSK)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=tls.msk.ru; s=202602;\n t=1775645720; bh=yPuWulHjK9XHbqL5n11NbBkjSHKE9YvNKtuG5clkRXo=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=Xeh8Vkgj8PvTf6iOOsnHgrCohwXkBTcAsIuoL4pmvmTVzjyOr7CUKBnjLByQ7EDg8\n pK2HUNC5cNkbuBty41CJKs3/hHlFqi96bb6g0GhZ45I5CvNGOry1WPNxm5moNi0iOY\n PZlgnxHsy2sf95HXPFc06kt/OJpswTBds9cxoZjDQY5m7c7SCV+v5FYOwixEJAVGBR\n F1oQVtfMVw5FX5QQsw0YfT4JZM5PlZ3f8qzPTFjU+2rPNzq7D71GI7zR8Jm9Pcop2s\n s3rRzbGnTOK+m2rDUHTD5lBJVnARPq3kIlcWRuo4EEZgKJ+OBs4w4dT9HurpatcS/e\n jUyN0XvrVmblA==","From":"Michael Tokarev <mjt@tls.msk.ru>","To":"qemu-devel@nongnu.org","Cc":"Helge Deller <deller@kernel.org>, qemu-trivial@nongnu.org,\n Helge Deller <deller@gmx.de>,\n Richard Henderson <richard.henderson@linaro.org>,\n Michael Tokarev <mjt@tls.msk.ru>","Subject":"[PULL 2/3] Allow building qemu tools on 32-bit hosts","Date":"Wed,  8 Apr 2026 13:55:57 +0300","Message-ID":"<20260408105605.172465-3-mjt@tls.msk.ru>","X-Mailer":"git-send-email 2.47.3","In-Reply-To":"<20260408105605.172465-1-mjt@tls.msk.ru>","References":"<20260408105605.172465-1-mjt@tls.msk.ru>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru;\n helo=isrv.corpit.ru","X-Spam_score_int":"-19","X-Spam_score":"-2.0","X-Spam_bar":"--","X-Spam_report":"(-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"From: Helge Deller <deller@kernel.org>\n\nQemu's tools like qemu-img are often needed on 32-bit platforms,\nalthough the actual qemu emulators have been discontinued on 32-bit.\n\nTo allow building the tools on 32-bit this patch implements three small\nchanges:\n\na) The check in meson.build is changed to still error out if the user\ntries to build qemu-system or qemu-user on a 32-bit platform, but allows\nbuilding tools (e.g. by \"--enable-tools\") alone.\n\nb) The compile time check in atomic.h now checks against\nsizeof(uint64_t) so that 32-bit environments can still build\nsuccessfully, while 128-bit atomic operations are prevented to sneak in.\n\nc) Allow linking against libatomic as long as we don't build the\nqemu-system and qemu-user binaries.\n\nSucessfully tested on the 32-bit big-endian powerpc architecture.\n\nSigned-off-by: Helge Deller <deller@gmx.de>\nSuggested-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Michael Tokarev <mjt@tls.msk.ru>\nSigned-off-by: Michael Tokarev <mjt@tls.msk.ru>\n---\n include/qemu/atomic.h |  6 +++---\n meson.build           | 16 ++++++++++++----\n 2 files changed, 15 insertions(+), 7 deletions(-)","diff":"diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h\nindex dc9290084b..e4dd948863 100644\n--- a/include/qemu/atomic.h\n+++ b/include/qemu/atomic.h\n@@ -58,11 +58,11 @@\n \n /*\n  * Sanity check that the size of an atomic operation isn't \"overly large\".\n- * Despite the fact that e.g. i686 has 64-bit atomic operations, we do not\n+ * Despite the fact that e.g. x86-64 has 128-bit atomic operations, we do not\n  * want to use them because we ought not need them, and this lets us do a\n- * bit of sanity checking that other 32-bit hosts might build.\n+ * bit of sanity checking that other 32- and 64-bit hosts might build.\n  */\n-#define ATOMIC_REG_SIZE  sizeof(void *)\n+#define ATOMIC_REG_SIZE  sizeof(uint64_t)\n \n /* Weak atomic operations prevent the compiler moving other\n  * loads/stores past the atomic operation load/store. However there is\ndiff --git a/meson.build b/meson.build\nindex daa58e46a3..ab3e97eb9f 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -323,8 +323,8 @@ endif\n # Compiler flags #\n ##################\n \n-if cc.sizeof('void *') < 8\n-  error('QEMU requires a 64-bit CPU host architecture')\n+if (cc.sizeof('void *') < 8) and (have_system or have_user)\n+  error('QEMU emulator requires a 64-bit CPU host architecture. Only tools may be built for 32-bit.')\n endif\n \n foreach lang : all_languages\n@@ -423,8 +423,16 @@ endif\n #\n # Later checks assume we won't get atomic ops for int128 without\n # explicitly asking for -latomic, so we must disable GCC's new\n-# automatic linking with the new -fno-link-libatomic flag\n-qemu_isa_flags += cc.get_supported_arguments('-fno-link-libatomic')\n+# automatic linking with the new -fno-link-libatomic flag.\n+#\n+# When not building the emulators, but qemu helper tools only\n+# (e.g. on 32-bit hosts), libatomic is sometimes required and\n+# thus acceptable.\n+if (have_system or have_user)\n+  qemu_isa_flags += cc.get_supported_arguments('-fno-link-libatomic')\n+else\n+  qemu_ldflags += cc.get_supported_link_arguments('-latomic')\n+endif\n \n qemu_common_flags = qemu_isa_flags + qemu_common_flags\n \n","prefixes":["PULL","2/3"]}