From patchwork Thu Jan 5 16:43:20 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: 639297 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp330932pvb; Thu, 5 Jan 2023 09:06:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXs6X2E6HM7XUIX2/ZieHwzE0huZPsIGq+cyHb2LAjhiGjfc2pdo30fgfSABLe+9gNJA7RPF X-Received: by 2002:ac8:6b8b:0:b0:3a7:e91e:60fd with SMTP id z11-20020ac86b8b000000b003a7e91e60fdmr71413617qts.62.1672938395918; Thu, 05 Jan 2023 09:06:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672938395; cv=none; d=google.com; s=arc-20160816; b=iXNZ/neqiFHdTecmBc6QyQhaGJoh3GB6TYEizGLPGj2PO2sBt0nhWzb/M5AeoTec7/ fMWPYX3dhCRJs+Ux1W1qiyGmIjnEzuo6tJ6fAQMgMMtLR33+IIpQHrqoXnCZmxi5vAsr fAbEvW4Wlo+lGalo3j5r8y6J2g0YURG41Eygyy+xP1Oz49ypZs64oXxPPtY9jZIYGdXa KwzflvNvNaqoq/IOXSoNs9b/lcz7bA/cYuPaUa5CFvT+2Uets6KHiS0ynFCZgOUO3vd7 Vijs541WALWNw0e8TkHNK+pKBa94eyZln25z+LuhQemYQcA7Bdun1/Q0gGkedF8mnP/0 mhUg== 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=NcS4hNAbvjNn/XqrZsftJnuUUOYptsSXutjGWOmXxwg=; b=Hw+VLABUFrVq8qYzqin4QPeuWikpGDHPH5/8AvuevjqVr5yH721orQzulTXL9LEjDv eHDShLOwU1nx0YA2Cc+GQIotcYENsq6qBGc10Yvbr0Bzj6v9O7XtOf684oElpA8ge37W tiRuQKQeJfr+PVJpo03f0bjs836JWkT8GX5J/gttEEAazo/1draH0aj3z8ughJov1RfC 54ILayaPZq5BjR+itLSQpPqj4b6Vh9bAZSHbv6g9mDYLHf+x5m89pY3SgKa3cxopRLhL 8NujNTWJVrYX7ONb9WdewVDenz8Ee36XtbRCvP1CUQPA7w+Gf2zYMdp6yZNbB9DNJ8A1 qz2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eeHobIq0; 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 fv11-20020a05622a4a0b00b003a69a68d247si20742693qtb.133.2023.01.05.09.06.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 09:06:35 -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=eeHobIq0; 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 1pDTLY-0007kf-PU; Thu, 05 Jan 2023 11:44:04 -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 1pDTLP-0007ML-Ib for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:43:55 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDTL0-00073J-J8 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 11:43:55 -0500 Received: by mail-wm1-x32b.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so1777257wms.2 for ; Thu, 05 Jan 2023 08:43:30 -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=NcS4hNAbvjNn/XqrZsftJnuUUOYptsSXutjGWOmXxwg=; b=eeHobIq0oBfhjiOKBmm6NvI8P4yo6+bjI5J8A7uuJXpPvFzDmjud2skPw9j0wsJD5h ZQHrQpl1Zy4Phn2wjGJFyN1hrLv3937t77xLUi/9aM0En3AGRVS/6ws1mWrMAd45BjOo 2y8JEuxUByimIZMtTQLikH7nPtlLODRW7m/QyzBQ3KODjqeFLcC+esSkn2Il0vzDdCYz G651qKWEuAamMAnZngBh03Cd7IKHCQUH+ANAIMkiHeaDqCh2VbqNacHPswHlLddviPD4 Nlv2TDmzcWxeGncz9Rj4HJy7IuIZ6J1SJgWjBIs4xFvwj0TpyRZ4Ja/m3y12zvh0O7lI egUg== 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=NcS4hNAbvjNn/XqrZsftJnuUUOYptsSXutjGWOmXxwg=; b=Xz+MHNVZCp8y2x8a8jECCGTCxvYZFyRgqu7Z7ufocT/ClPcAl2yyaO+6V60eM58SIo SaNGrtnF5onM52/ZlvrA0vQC6veZXfCeR3StYh2b/isbls8bsiuyPr/qjo+oLfOcEG+x f1YlzwqojZOF06+Ep/IDk1qIb9MGggNvRBjPTRSBwG/9tPTVCB7Eg40/8XCRns8OppTm BFBytaEbIAnkUW5X8Fx9c4tYQiKh4maSz01TciTqlUaqJfqb8o8Cp5t6xsLWctlsKBHd ahdIrsnD749HkJqWjqDa5cdeUDW08uWMj9YU2JoocNz0peVNVtzqCdB1JF/Q27yZAiiW zq+A== X-Gm-Message-State: AFqh2kp4kqVG6ddhm7K/5+kVC0jQNtYSKtHGcEYZrVAkFbYBJhF4tmdL FhGrruDiL5JUUpT7hI9SzXjAuQ== X-Received: by 2002:a05:600c:4e08:b0:3d2:139e:f64f with SMTP id b8-20020a05600c4e0800b003d2139ef64fmr39086784wmq.40.1672937009248; Thu, 05 Jan 2023 08:43:29 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id p7-20020a05600c1d8700b003d973d4fb28sm3071619wms.4.2023.01.05.08.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 08:43:27 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B7CBF1FFCB; Thu, 5 Jan 2023 16:43:21 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org, alex.bennee@gmail.com Cc: David Hildenbrand , Sunil Muthuswamy , Aurelien Jarno , Michael Rolnik , Aleksandar Rikalo , Greg Kurz , Ilya Leoshkevich , Thomas Huth , qemu-ppc@nongnu.org, Laurent Vivier , Max Filippov , Yanan Wang , Marek Vasut , Stafford Horne , Peter Maydell , Daniel Henrique Barboza , Palmer Dabbelt , =?utf-8?q?Alex_Benn=C3=A9e?= , Taylor Simpson , Marcel Apfelbaum , Alexandre Iooss , Chris Wulff , Richard Henderson , Eduardo Habkost , Song Gao , Mark Cave-Ayland , =?utf-8?q?C=C3=A9dric_Le_?= =?utf-8?q?Goater?= , Artyom Tarasenko , Paolo Bonzini , qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Alistair Francis , "Edgar E. Iglesias" , Bastian Koppelmann , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Bin Meng , Mahmoud Mandour , David Gibson , Yoshinori Sato , Xiaojuan Yang , qemu-arm@nongnu.org Subject: [PATCH v2 21/21] gdbstub: only compile gdbstub twice for whole build Date: Thu, 5 Jan 2023 16:43:20 +0000 Message-Id: <20230105164320.2164095-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230105164320.2164095-1-alex.bennee@linaro.org> References: <20230105164320.2164095-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.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 --- gdbstub/gdbstub.c | 3 +-- gdbstub/user-target.c | 2 +- gdbstub/meson.build | 32 ++++++++++++++++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 57bbda3505..0dbb9f5338 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 83e04e1c23..46f5729999 100644 --- a/gdbstub/user-target.c +++ b/gdbstub/user-target.c @@ -235,7 +235,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..193c20203d 100644 --- a/gdbstub/meson.build +++ b/gdbstub/meson.build @@ -4,13 +4,37 @@ # 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: -# These have to built to the target ABI -specific_ss.add(files('syscalls.c')) +gdb_user_ss = ss.source_set() +gdb_softmmu_ss = ss.source_set() -softmmu_ss.add(files('softmmu.c')) +# We build two versions of gdbstub, one for each mode +gdb_user_ss.add(files('gdbstub.c')) +gdb_softmmu_ss.add(files('gdbstub.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) + +# The rest of the mode specific code can be added directly user_ss.add(files('user.c')) +softmmu_ss.add(files('softmmu.c')) + +# These have to built to the target ABI +specific_ss.add(files('syscalls.c')) # and BSD? specific_ss.add(when: 'CONFIG_LINUX_USER', if_true: files('user-target.c'))