From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
qemu-arm@nongnu.org, qemu-riscv@nongnu.org,
qemu-s390x@nongnu.org,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
nicolas.eder@lauterbach.com, "Stafford Horne" <shorne@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Mahmoud Mandour" <ma.mandourr@gmail.com>,
"Taylor Simpson" <tsimpson@quicinc.com>,
mads@ynddal.dk, "Marek Vasut" <marex@denx.de>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
qemu-ppc@nongnu.org, "Yanan Wang" <wangyanan55@huawei.com>,
"Sunil Muthuswamy" <sunilmut@microsoft.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Bin Meng" <bin.meng@windriver.com>,
"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Michael Rolnik" <mrolnik@gmail.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Xiaojuan Yang" <yangxiaojuan@loongson.cn>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Chris Wulff" <crwulff@gmail.com>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Greg Kurz" <groug@kaod.org>,
"David Hildenbrand" <david@redhat.com>,
"Song Gao" <gaosong@loongson.cn>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>
Subject: [PATCH v3 21/24] gdbstub: only compile gdbstub twice for whole build
Date: Tue, 21 Feb 2023 22:52:24 +0000 [thread overview]
Message-ID: <20230221225227.3735319-22-alex.bennee@linaro.org> (raw)
In-Reply-To: <20230221225227.3735319-1-alex.bennee@linaro.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 <alex.bennee@linaro.org>
---
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
next prev parent reply other threads:[~2023-02-21 23:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 22:52 [PATCH v3 00/24] gdbstub: re-organise to for better compilation behaviour Alex Bennée
2023-02-21 22:52 ` [PATCH v3 01/24] gdbstub/internals.h: clean up include guard Alex Bennée
2023-02-21 22:52 ` [PATCH v3 02/24] gdbstub: fix-up copyright and license files Alex Bennée
2023-02-21 22:52 ` [PATCH v3 03/24] gdbstub: Make syscall_complete/[gs]et_reg target-agnostic typedefs Alex Bennée
2023-02-21 22:52 ` [PATCH v3 04/24] gdbstub: define separate user/system structures Alex Bennée
2023-02-21 22:52 ` [PATCH v3 05/24] gdbstub: move GDBState to shared internals header Alex Bennée
2023-02-21 22:52 ` [PATCH v3 06/24] includes: move tb_flush into its own header Alex Bennée
2023-02-21 22:52 ` [PATCH v3 07/24] gdbstub: move fromhex/tohex routines to internals Alex Bennée
2023-02-21 22:52 ` [PATCH v3 08/24] gdbstub: make various helpers visible to the rest of the module Alex Bennée
2023-02-21 22:52 ` [PATCH v3 09/24] gdbstub: move chunk of softmmu functionality to own file Alex Bennée
2023-02-22 0:26 ` Richard Henderson
2023-02-21 22:52 ` [PATCH v3 10/24] gdbstub: move chunks of user code into own files Alex Bennée
2023-02-22 7:16 ` Richard Henderson
2023-02-21 22:52 ` [PATCH v3 11/24] gdbstub: rationalise signal mapping in softmmu Alex Bennée
2023-02-22 0:32 ` Richard Henderson
2023-02-21 22:52 ` [PATCH v3 12/24] gdbstub: abstract target specific details from gdb_put_packet_binary Alex Bennée
2023-02-21 22:52 ` [PATCH v3 13/24] gdbstub: specialise handle_query_attached Alex Bennée
2023-02-21 22:52 ` [PATCH v3 14/24] gdbstub: specialise target_memory_rw_debug Alex Bennée
2023-02-21 22:52 ` [PATCH v3 15/24] gdbstub: introduce gdb_get_max_cpus Alex Bennée
2023-02-21 22:52 ` [PATCH v3 16/24] gdbstub: specialise stub_can_reverse Alex Bennée
2023-02-21 22:52 ` [PATCH v3 17/24] gdbstub: fix address type of gdb_set_cpu_pc Alex Bennée
2023-02-21 22:52 ` [PATCH v3 18/24] gdbstub: don't use target_ulong while handling registers Alex Bennée
2023-02-22 0:51 ` Richard Henderson
2023-02-21 22:52 ` [PATCH v3 19/24] gdbstub: move register helpers into standalone include Alex Bennée
2023-02-21 22:52 ` [PATCH v3 20/24] gdbstub: move syscall handling to new file Alex Bennée
2023-02-21 22:52 ` Alex Bennée [this message]
2023-02-22 7:18 ` [PATCH v3 21/24] gdbstub: only compile gdbstub twice for whole build Richard Henderson
2023-02-21 22:52 ` [PATCH v3 22/24] testing: probe gdb for supported architectures ahead of time Alex Bennée
2023-02-22 1:10 ` Richard Henderson
2023-02-21 22:52 ` [PATCH v3 23/24] include: split target_long definition from cpu-defs Alex Bennée
2023-02-22 1:17 ` Richard Henderson
2023-02-21 22:52 ` [PATCH v3 24/24] gdbstub: split out softmmu/user specifics for syscall handling Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230221225227.3735319-22-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=alistair.francis@wdc.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=bin.meng@windriver.com \
--cc=clg@kaod.org \
--cc=crwulff@gmail.com \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=erdnaxe@crans.org \
--cc=gaosong@loongson.cn \
--cc=groug@kaod.org \
--cc=iii@linux.ibm.com \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=kbastian@mail.uni-paderborn.de \
--cc=laurent@vivier.eu \
--cc=ma.mandourr@gmail.com \
--cc=mads@ynddal.dk \
--cc=marcel.apfelbaum@gmail.com \
--cc=marex@denx.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mrolnik@gmail.com \
--cc=nicolas.eder@lauterbach.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shorne@gmail.com \
--cc=sunilmut@microsoft.com \
--cc=thuth@redhat.com \
--cc=tsimpson@quicinc.com \
--cc=wangyanan55@huawei.com \
--cc=yangxiaojuan@loongson.cn \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).