From patchwork Thu Mar 2 19:08:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 658146 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp67650wrb; Thu, 2 Mar 2023 11:16:44 -0800 (PST) X-Google-Smtp-Source: AK7set/MChW+zLswTrptn9OE7orP6NpvvCFyj5+hfNRFeUx0n2oCOmlyj+xB5AeXMj88LY6eSTuf X-Received: by 2002:a05:6214:400d:b0:571:cb52:7ee2 with SMTP id kd13-20020a056214400d00b00571cb527ee2mr17399045qvb.52.1677784604625; Thu, 02 Mar 2023 11:16:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677784604; cv=none; d=google.com; s=arc-20160816; b=lITKZ7LX7MueGU7phgGoKSZ/UvGmotIi2li/p4CRQO0lHUkfovSiVBZjaC5oPhK9Xo km9xZvDEB5SPF+UhJm/W3a7HIKxZJHWpKA2fU2NNV3ecjjG+IPoH23scMxNben+6uO76 Ha6bzgkxE19b1e/gY7SU9IvnPwo1QDIAepDDytMMhYrfUwIoT8DiuENf0N29bekAynI4 nHU/7IHnjVPAWGFSFBMKMMK7wkCxHTUro8Pq0xpSgbLoz11luJ+7ymJvHYtc0y9Pok+k zTlzoDCOuzbHBU/z9FDaCGTnOqaiXdggHyckt+Eju6Y8w6IGxJ3AspJCxxb8x6oygCQ2 4grA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0nGJS3TcjePwhHIbOnspKgR49rDlBrdUVNx8YN4xopU=; b=BroaJ58nN11Mh1wNRy376d2wbr48GejjlE6nq/BRSkFm7hArw7IiESAZPYy4PPDy7P OYMeLDbdfFm0Tt0r2xb1KSiXWFLRTlgJjyJPS0quszktXYPEHz7OAIvVWFfKYDia6QKv YNnGNFNWbfO7DygGlhdYP5iRdlB9XvNSJ/cXyUY0Hqg4SpTry7qYvn0XlBCjv+XvseJg 43W7jMY/Rrmc5ZSu0wXbWYoM2hrIFPeZUeo9EIgxaM7Gd4mRm17PKByEXWlKHusXo3gZ WANDb1+t+AckQwZNv0Ne/azsnjK4zyWTxJ3kt9Jz1Shbt/l4JNBI6mXjJprJLsRbxZG5 45cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="c2dzS+/v"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u10-20020a0cf1ca000000b0056eec5bab85si12600539qvl.493.2023.03.02.11.16.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 11:16:44 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="c2dzS+/v"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXoNu-0006l0-Sg; Thu, 02 Mar 2023 14:14:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXoNs-0006fz-9a for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:14:32 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXoNj-0000kq-Ms for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:14:31 -0500 Received: by mail-wr1-x42b.google.com with SMTP id l1so116625wry.12 for ; Thu, 02 Mar 2023 11:14:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0nGJS3TcjePwhHIbOnspKgR49rDlBrdUVNx8YN4xopU=; b=c2dzS+/vMLVsojBfKJnEcMJI5C2OOz7g80CJOtOK2sGwGB9UfyRI7b66Zc3u8JAhr7 tIZZPqcIjCZvniFrH7r32uHBud/Fiy3m+p3k1gSDIc7mNt4vR2EtGC98sXXRCyQ9/eFf dbKQSelNgujobyuQ0AWo8bW92pn2l31Rwwal9LQSpNcak4fTZ5REKqUQucip7T1sFwkn jp1BWroal/WWkMEdYmfJTGtzy/UaYpvygzL9MStYCAe3AOAXLZWIH9ffXLWwdttZ24cE Q6nwksCyebBOzkoFpUPoUagwvZJGbH9Xd+gPS4Xv75+1OqDBCDSY7vfRTF7oUfXm3m3B qgNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0nGJS3TcjePwhHIbOnspKgR49rDlBrdUVNx8YN4xopU=; b=c+A/uuYQkvQhLRNsrp1pqzuglSXf6Wof4DqX7oZRQPsS6hHEt1cnaZKneaKwFETmvn iXyJsChkG8K1oj12C6+iVU0vMneHv6xpBGBgLaWFOLxZlrhr4+y4b99Oe+QwYrxAQbBS r8uffoO7aJ8j6zaM6yrkMsmQCBb9Et5LhfpZo3+TGqQrYS4hI276hMefpZxutcISPo00 Y/wdSfBQKXDIRyvGHtUGOWB0L8U2MkN2TCt1nzDrCVqs/7z/e5ncu0qHC0rmfYbSqK2t b449SilfRMjiqo1LPm1LOlN7HGmavcluMmmHxlX1V8z+mB4/Me5juFVQfpAUs7zYxPGe Yf0g== X-Gm-Message-State: AO0yUKUHxi0vvRPIcRD0ZXeSGlQXnUPw7DSM/6ciqN5ybN7P9nsRXRp1 TtF2xq7v/JgeUjSgL1vp3za4aQ== X-Received: by 2002:a05:6000:108c:b0:242:1809:7e17 with SMTP id y12-20020a056000108c00b0024218097e17mr8349240wrw.6.1677784462023; Thu, 02 Mar 2023 11:14:22 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id p1-20020a5d4581000000b002c55551e6e9sm132841wrq.108.2023.03.02.11.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 11:14:21 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 169191FFBF; Thu, 2 Mar 2023 19:08:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Weiwei Li , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Palmer Dabbelt , Laurent Vivier , nicolas.eder@lauterbach.com, Ilya Leoshkevich , kvm@vger.kernel.org, "Edgar E. Iglesias" , David Gibson , Max Filippov , Sunil Muthuswamy , qemu-s390x@nongnu.org, Stafford Horne , Bin Meng , Marek Vasut , Greg Kurz , Song Gao , Aleksandar Rikalo , Liu Zhiwei , Alistair Francis , Chris Wulff , qemu-riscv@nongnu.org, Michael Rolnik , qemu-arm@nongnu.org, Cleber Rosa , Artyom Tarasenko , Marcel Apfelbaum , Eduardo Habkost , Yoshinori Sato , Alexandre Iooss , Daniel Henrique Barboza , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , mads@ynddal.dk, Mark Cave-Ayland , qemu-ppc@nongnu.org, Richard Henderson , John Snow , Xiaojuan Yang , Thomas Huth , Paolo Bonzini , Mahmoud Mandour , Aurelien Jarno , Bastian Koppelmann , Yanan Wang , David Hildenbrand , Taylor Simpson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v4 22/26] gdbstub: only compile gdbstub twice for whole build Date: Thu, 2 Mar 2023 19:08:42 +0000 Message-Id: <20230302190846.2593720-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230302190846.2593720-1-alex.bennee@linaro.org> References: <20230302190846.2593720-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Now we have removed any target specific bits from the core gdbstub code we only need to build it twice. We have to jump a few meson hoops to manually define the CONFIG_USER_ONLY symbol but it seems to work. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v3 - also include user and softmmu bits in the library v4 - include genh for config-poison.h --- gdbstub/gdbstub.c | 4 +--- gdbstub/meson.build | 30 ++++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index e264ed04e7..d9e9bf9294 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -39,9 +39,7 @@ #include "sysemu/hw_accel.h" #include "sysemu/runstate.h" -#include "exec/exec-all.h" #include "exec/replay-core.h" -#include "exec/tb-flush.h" #include "exec/hwaddr.h" #include "internals.h" @@ -1612,7 +1610,7 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = { .cmd_startswith = 1, .schema = "s:l,l0" }, -#if defined(CONFIG_USER_ONLY) && defined(CONFIG_LINUX_USER) +#if defined(CONFIG_USER_ONLY) && defined(CONFIG_LINUX) { .handler = gdb_handle_query_xfer_auxv, .cmd = "Xfer:auxv:read::", diff --git a/gdbstub/meson.build b/gdbstub/meson.build index c876222b9c..d679c7ab86 100644 --- a/gdbstub/meson.build +++ b/gdbstub/meson.build @@ -4,13 +4,35 @@ # types such as hwaddr. # -specific_ss.add(files('gdbstub.c')) +# We need to build the core gdb code via a library to be able to tweak +# cflags so: + +gdb_user_ss = ss.source_set() +gdb_softmmu_ss = ss.source_set() + +# We build two versions of gdbstub, one for each mode +gdb_user_ss.add(files('gdbstub.c', 'user.c')) +gdb_softmmu_ss.add(files('gdbstub.c', 'softmmu.c')) + +gdb_user_ss = gdb_user_ss.apply(config_host, strict: false) +gdb_softmmu_ss = gdb_softmmu_ss.apply(config_host, strict: false) + +libgdb_user = static_library('gdb_user', + gdb_user_ss.sources() + genh, + name_suffix: 'fa', + c_args: '-DCONFIG_USER_ONLY') + +libgdb_softmmu = static_library('gdb_softmmu', + gdb_softmmu_ss.sources() + genh, + name_suffix: 'fa') + +gdb_user = declare_dependency(link_whole: libgdb_user) +user_ss.add(gdb_user) +gdb_softmmu = declare_dependency(link_whole: libgdb_softmmu) +softmmu_ss.add(gdb_softmmu) # These have to built to the target ABI specific_ss.add(files('syscalls.c')) -softmmu_ss.add(files('softmmu.c')) -user_ss.add(files('user.c')) - # The user-target is specialised by the guest specific_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-target.c'))