qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org, Richard Henderson <richard.henderson@linaro.org>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Claudio Fontana" <cfontana@suse.de>,
	qemu-arm@nongnu.org, "Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH-for-8.0 1/2] target/arm/gdbstub: Restrict aarch64_gdb_get_pauth_reg() to CONFIG_TCG
Date: Wed, 22 Mar 2023 15:29:01 +0100	[thread overview]
Message-ID: <20230322142902.69511-2-philmd@linaro.org> (raw)
In-Reply-To: <20230322142902.69511-1-philmd@linaro.org>

aarch64_gdb_get_pauth_reg() -- although disabled since commit
5787d17a42 ("target/arm: Don't advertise aarch64-pauth.xml to
gdb") is still compiled in. It calls pauth_ptr_mask() which is
located in target/arm/tcg/pauth_helper.c, a TCG specific helper.

Restrict aarch64_gdb_get_pauth_reg() to TCG to avoid a linking
error when TCG is not enabled:

  Undefined symbols for architecture arm64:
    "_pauth_ptr_mask", referenced from:
        _aarch64_gdb_get_pauth_reg in target_arm_gdbstub64.c.o
  ld: symbol(s) not found for architecture arm64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Fixes: e995d5cce4 ("target/arm: Implement gdbstub pauth extension")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/arm/gdbstub.c   | 3 ++-
 target/arm/gdbstub64.c | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
index 3bd86cee97..655369dc74 100644
--- a/target/arm/gdbstub.c
+++ b/target/arm/gdbstub.c
@@ -21,6 +21,7 @@
 #include "cpu.h"
 #include "exec/gdbstub.h"
 #include "gdbstub/helpers.h"
+#include "sysemu/tcg.h"
 #include "internals.h"
 #include "cpregs.h"
 
@@ -526,7 +527,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
          * crash if they see this XML from QEMU; disable it for the 8.0
          * release, pending a better solution.
          */
-        if (isar_feature_aa64_pauth(&cpu->isar)) {
+        if (isar_feature_aa64_pauth(&cpu->isar) && tcg_enabled()) {
             gdb_register_coprocessor(cs, aarch64_gdb_get_pauth_reg,
                                      aarch64_gdb_set_pauth_reg,
                                      4, "aarch64-pauth.xml", 0);
diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c
index ec1e07f139..3bb0923cbf 100644
--- a/target/arm/gdbstub64.c
+++ b/target/arm/gdbstub64.c
@@ -210,6 +210,8 @@ int aarch64_gdb_set_sve_reg(CPUARMState *env, uint8_t *buf, int reg)
     return 0;
 }
 
+#ifdef CONFIG_TCG
+
 int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg)
 {
     switch (reg) {
@@ -244,6 +246,8 @@ int aarch64_gdb_set_pauth_reg(CPUARMState *env, uint8_t *buf, int reg)
     return 0;
 }
 
+#endif
+
 static void output_vector_union_type(GString *s, int reg_width,
                                      const char *name)
 {
-- 
2.38.1



  reply	other threads:[~2023-03-22 14:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 14:29 [PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled Philippe Mathieu-Daudé
2023-03-22 14:29 ` Philippe Mathieu-Daudé [this message]
2023-03-22 15:15   ` [PATCH-for-8.0 1/2] target/arm/gdbstub: Restrict aarch64_gdb_get_pauth_reg() to CONFIG_TCG Richard Henderson
2023-03-28 13:34     ` Philippe Mathieu-Daudé
2023-03-22 14:29 ` [PATCH-for-8.0 2/2] target/arm/gdbstub: Only advertise M-profile features if TCG available Philippe Mathieu-Daudé
2023-03-22 15:13   ` Richard Henderson
2023-03-22 16:21   ` Alex Bennée
2023-03-22 14:32 ` [PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled Philippe Mathieu-Daudé
2023-03-22 17:45   ` Fabiano Rosas
2023-03-28  9:54 ` Peter Maydell
2023-03-28 13:20   ` Philippe Mathieu-Daudé
2023-03-28 13:33     ` Philippe Mathieu-Daudé

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=20230322142902.69511-2-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=cfontana@suse.de \
    --cc=farosas@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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).