From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F793C636D7 for ; Tue, 21 Feb 2023 23:03:55 +0000 (UTC) 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-Google-Smtp-Source: AK7set8S+FZTxNAK5rZh2HHkQd/hnzrrhL2WwPDiw8cG6ld8jNrsdaTQg9S2QcTmWQRJwiW1Octe2g== 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=20Benn=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=20Le=20Goater?= , Eduardo Habkost , Bin Meng , Bastian Koppelmann , Palmer Dabbelt , Marcel Apfelbaum , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Rolnik , Aleksandar Rikalo , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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')) -- 2.39.1