From patchwork Tue Feb 21 22:52:24 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: 655396 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp374518wrb; Tue, 21 Feb 2023 15:03:54 -0800 (PST) X-Google-Smtp-Source: AK7set9e6hSRe9vvPQzH0K+t6QeTtxqGxy1hBx8ViJY6Nh03Zyh4gZVpX2n7gdo3OsHC0yALXk5Q X-Received: by 2002:a05:6214:27eb:b0:56f:6f5:502d with SMTP id jt11-20020a05621427eb00b0056f06f5502dmr11262128qvb.17.1677020634745; Tue, 21 Feb 2023 15:03:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677020634; cv=none; d=google.com; s=arc-20160816; b=SitXFrufCAWMtyBi/cb5Mq/H23DR+q47kFC9ehlUe7LQKh7+9SJaaQCuDdMSjswWuM Z6qBCYbY5fwxvpL/jNFjnDiduHkTtIXwh0wJVMVl4XQK89b4CFRocFFxBv7OOmcT5Mgl truaPgWCtrrK06MOjIyhCCpyZkflHIDibX86njMV5CJwWgE4vAl+Bg6/TIa3roETq1IE lY/nalcYc2Zft3OLddW8R4Ar84tux7qjlOvOzRbFn+8m/t67UdoCHfzUy2GMQ+5OPeOV UNevhQLBVhDGMrxpz9AzLfnCiAJaOYkvuhHeIYdOguO5Rzz0NJg5yVQY6leQVCtSAx6N cI7A== 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=TVHpGqkcdr2gO4uob9X2D+X5gkMbOtaQKWo3v4EPeXY=; b=ze/mEkLc8LGj7QEm+PffiomUtDvkBybAe/zWA5D51QA1+3NdcHA1e/ipfTFLP9J3MZ GgF2gSLSPsrlZvKPiFTVCwtLXkmdW8mpZLQ9ZEAHdIUHj/G6bFxK+V19/i/iKHI9g6WD nk6Kn93Qn5A2gt592/yCANsl3DMQZNWbwXYCfiwBw2EUs13uKOtrsRsvpamM2te6zJSM 685yFk6vfGSomByMro6K+ttWZTTDr6n14MdJW3DR2lAJqoeL1iODM57CJ3YCqa7zg1u/ WS8ZR8xex/d3QpyRneyHMTMKsRnilfaBswj+RO+HgLRY8LIQrhW4WraCjJ8w1TJl1FyZ benQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iGquWRm6; 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 z18-20020a0c8f12000000b005710a8a37cfsi6133357qvd.98.2023.02.21.15.03.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Feb 2023 15:03:54 -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=iGquWRm6; 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 1pUbeZ-0006nc-O8; Tue, 21 Feb 2023 18:02:31 -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 1pUbeI-0006Tb-Gs for qemu-devel@nongnu.org; Tue, 21 Feb 2023 18:02:14 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUbe7-0006HN-3G for qemu-devel@nongnu.org; Tue, 21 Feb 2023 18:02:14 -0500 Received: by mail-wm1-x32c.google.com with SMTP id o38-20020a05600c512600b003e8320d1c11so75736wms.1 for ; Tue, 21 Feb 2023 15:02:01 -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=TVHpGqkcdr2gO4uob9X2D+X5gkMbOtaQKWo3v4EPeXY=; b=iGquWRm6hguyiLKLVJTz6HRy0PovTLPeMQ4ZFPxtt1CCrP9lujTRvaAj3umXypY+De oMMu3gRC09AnqP3uKvlCSV/9KLYN1F25xsn1yF+tWmcsNCdr3jUl+Bq/vgrXDq+ON1hg jz0IycpKzHGokCz4G/EaiKAwOmarp0nFhO652ta5yMj0g/9fP3c/dlcNI/8qWHxHPbQf dYKVS4met2t6cluob25JG4YhzkP6cRTg1ftSbJSfpG+p6cQCMrltHryrTFx6QF0eVQDB OtMn+6WWR1e2nUBbsHyLdhBs/RZeZ1qJoo0DbCsSoV1LFVmh2mgrY/Wsfzv3QfG7CVq6 q1aQ== 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=TVHpGqkcdr2gO4uob9X2D+X5gkMbOtaQKWo3v4EPeXY=; b=T7VkeCOy0zJ0OIOW0qu7Ygq729ytiiFF2cORpAxV5ROOpLvyJryA+gawPDTIMA0ZBw EzuuiRj6knBhIJC/axr3wqD8x9o8mCIzRaXJqL7coT+PfTxXPV3u3CfcSDo4zqicZh/q +PHgz5a9EhdqYaPvmyzncjlrtn06IyJJ4DQUFuA2+dilQ0CITnHD4cWRyxi2A22cCs2q HPLS7PM8r+3jcQihmnR/lYePZ4m59Wd4UJ50uTzQ5yS9oyG33E3p5SJqUgn0bBEGyyFQ /bOWKmdG6PiO/hebLnF+dtU1Bw0PvWCxZOcQjUtdJ4Num+8HmSRiGrC5/tofvP8XQxqJ XMfg== X-Gm-Message-State: AO0yUKW05oTp2IJLDGa/Es6iyyoEZGODHuXvuUNijnPAPMjiIhsLyIys Y8f6HqW+XLmwFLy4eZj7wLov6g== X-Received: by 2002:a05:600c:2ad6:b0:3df:f7f3:d007 with SMTP id t22-20020a05600c2ad600b003dff7f3d007mr4302001wme.17.1677020520311; Tue, 21 Feb 2023 15:02:00 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id t23-20020a05600c2f9700b003dc521f336esm5381055wmn.14.2023.02.21.15.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 15:01:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E2FFE1FFCC; Tue, 21 Feb 2023 22:52:30 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Yoshinori Sato , nicolas.eder@lauterbach.com, Stafford Horne , Daniel Henrique Barboza , Mahmoud Mandour , Taylor Simpson , mads@ynddal.dk, Marek Vasut , Artyom Tarasenko , Alistair Francis , qemu-ppc@nongnu.org, Yanan Wang , Sunil Muthuswamy , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Eduardo Habkost , Bin Meng , Bastian Koppelmann , Palmer Dabbelt , Marcel Apfelbaum , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Rolnik , Aleksandar Rikalo , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Aurelien Jarno , Xiaojuan Yang , Richard Henderson , Peter Maydell , Alexandre Iooss , Chris Wulff , Jiaxun Yang , David Gibson , "Edgar E. Iglesias" , Greg Kurz , David Hildenbrand , Song Gao , Ilya Leoshkevich , Max Filippov , Mark Cave-Ayland Subject: [PATCH v3 21/24] gdbstub: only compile gdbstub twice for whole build Date: Tue, 21 Feb 2023 22:52:24 +0000 Message-Id: <20230221225227.3735319-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221225227.3735319-1-alex.bennee@linaro.org> References: <20230221225227.3735319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.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 --- v3 - also include user and softmmu bits in the library --- gdbstub/gdbstub.c | 3 +-- gdbstub/user-target.c | 2 +- gdbstub/meson.build | 32 ++++++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index a8b321710c..791cb79bf6 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -39,7 +39,6 @@ #include "sysemu/hw_accel.h" #include "sysemu/runstate.h" -#include "exec/exec-all.h" #include "exec/tb-flush.h" #include "exec/hwaddr.h" #include "sysemu/replay.h" @@ -1611,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/user-target.c b/gdbstub/user-target.c index e1d9650c1e..a0c10d6e12 100644 --- a/gdbstub/user-target.c +++ b/gdbstub/user-target.c @@ -233,7 +233,7 @@ static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr, } -#if defined(CONFIG_LINUX_USER) +#if defined(CONFIG_LINUX) void gdb_handle_query_xfer_auxv(GArray *params, void *user_ctx) { TaskState *ts; diff --git a/gdbstub/meson.build b/gdbstub/meson.build index 56c40c25ef..6abf067afc 100644 --- a/gdbstub/meson.build +++ b/gdbstub/meson.build @@ -4,13 +4,33 @@ # 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(), + name_suffix: 'fa', + c_args: '-DCONFIG_USER_ONLY') + +libgdb_softmmu = static_library('gdb_softmmu', gdb_softmmu_ss.sources(), + 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')) - -# and BSD? -specific_ss.add(when: 'CONFIG_LINUX_USER', if_true: files('user-target.c')) +# The user-target is specialised by the guest +specific_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-target.c'))