[PATCH v9 05/10] target/arm: gdbstub: Guard pauth code with CONFIG_TCG

Fabiano Rosas posted 10 patches 2 years, 2 months ago
There is a newer version of this series
[PATCH v9 05/10] target/arm: gdbstub: Guard pauth code with CONFIG_TCG
Posted by Fabiano Rosas 2 years, 2 months ago
We currently don't have the reading of pauth regs implemented for KVM
so wrap the pauth registration with CONFIG_TCG.

This avoids the build error when using --disable-tcg:

libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub64.c.o: in function
`aarch64_gdb_get_pauth_reg': ../target/arm/gdbstub64.c:233: undefined
reference to `pauth_ptr_mask'

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 target/arm/gdbstub.c   | 4 +++-
 target/arm/gdbstub64.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
index 36a1d7dbc5..3ea50bcaaf 100644
--- a/target/arm/gdbstub.c
+++ b/target/arm/gdbstub.c
@@ -23,6 +23,7 @@
 #include "gdbstub/helpers.h"
 #include "internals.h"
 #include "cpregs.h"
+#include "sysemu/tcg.h"
 
 typedef struct RegisterSysregXmlParam {
     CPUState *cs;
@@ -522,7 +523,8 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
                                      aarch64_gdb_set_fpu_reg,
                                      34, "aarch64-fpu.xml", 0);
         }
-        if (isar_feature_aa64_pauth(&cpu->isar)) {
+
+        if (tcg_enabled() && isar_feature_aa64_pauth(&cpu->isar)) {
             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..104a43e471 100644
--- a/target/arm/gdbstub64.c
+++ b/target/arm/gdbstub64.c
@@ -210,6 +210,7 @@ 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) {
@@ -243,6 +244,7 @@ int aarch64_gdb_set_pauth_reg(CPUARMState *env, uint8_t *buf, int reg)
     /* All pseudo registers are read-only. */
     return 0;
 }
+#endif
 
 static void output_vector_union_type(GString *s, int reg_width,
                                      const char *name)
-- 
2.35.3
Re: [PATCH v9 05/10] target/arm: gdbstub: Guard pauth code with CONFIG_TCG
Posted by Richard Henderson 2 years, 2 months ago
On 3/13/23 08:10, Fabiano Rosas wrote:
> We currently don't have the reading of pauth regs implemented for KVM
> so wrap the pauth registration with CONFIG_TCG.
> 
> This avoids the build error when using --disable-tcg:
> 
> libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub64.c.o: in function
> `aarch64_gdb_get_pauth_reg': ../target/arm/gdbstub64.c:233: undefined
> reference to `pauth_ptr_mask'
> 
> Signed-off-by: Fabiano Rosas<farosas@suse.de>
> ---
>   target/arm/gdbstub.c   | 4 +++-
>   target/arm/gdbstub64.c | 2 ++
>   2 files changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~