[PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled

Philippe Mathieu-Daudé posted 2 patches 1 year, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230322142902.69511-1-philmd@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>
There is a newer version of this series
target/arm/gdbstub.c   | 7 ++++---
target/arm/gdbstub64.c | 4 ++++
2 files changed, 8 insertions(+), 3 deletions(-)
[PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled
Posted by Philippe Mathieu-Daudé 1 year, 1 month ago
Fix when building QEMU configured with --disable-tcg:

  Undefined symbols for architecture arm64:
    "_arm_v7m_get_sp_ptr", referenced from:
        _m_sysreg_get in target_arm_gdbstub.c.o
    "_arm_v7m_mrs_control", referenced from:
        _arm_gdb_get_m_systemreg in target_arm_gdbstub.c.o
    "_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)

Philippe Mathieu-Daudé (2):
  target/arm/gdbstub: Restrict aarch64_gdb_get_pauth_reg() to CONFIG_TCG
  target/arm/gdbstub: Only advertise M-profile features if TCG available

 target/arm/gdbstub.c   | 7 ++++---
 target/arm/gdbstub64.c | 4 ++++
 2 files changed, 8 insertions(+), 3 deletions(-)

-- 
2.38.1


Re: [PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled
Posted by Peter Maydell 1 year, 1 month ago
On Wed, 22 Mar 2023 at 14:29, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Fix when building QEMU configured with --disable-tcg:
>
>   Undefined symbols for architecture arm64:
>     "_arm_v7m_get_sp_ptr", referenced from:
>         _m_sysreg_get in target_arm_gdbstub.c.o
>     "_arm_v7m_mrs_control", referenced from:
>         _arm_gdb_get_m_systemreg in target_arm_gdbstub.c.o
>     "_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)
>
> Philippe Mathieu-Daudé (2):
>   target/arm/gdbstub: Restrict aarch64_gdb_get_pauth_reg() to CONFIG_TCG
>   target/arm/gdbstub: Only advertise M-profile features if TCG available

I've applied patch 2 to target-arm.next; thanks.

-- PMM
Re: [PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled
Posted by Philippe Mathieu-Daudé 1 year, 1 month ago
On 28/3/23 11:54, Peter Maydell wrote:
> On Wed, 22 Mar 2023 at 14:29, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Fix when building QEMU configured with --disable-tcg:
>>
>>    Undefined symbols for architecture arm64:
>>      "_arm_v7m_get_sp_ptr", referenced from:
>>          _m_sysreg_get in target_arm_gdbstub.c.o
>>      "_arm_v7m_mrs_control", referenced from:
>>          _arm_gdb_get_m_systemreg in target_arm_gdbstub.c.o
>>      "_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)
>>
>> Philippe Mathieu-Daudé (2):
>>    target/arm/gdbstub: Restrict aarch64_gdb_get_pauth_reg() to CONFIG_TCG
>>    target/arm/gdbstub: Only advertise M-profile features if TCG available
> 
> I've applied patch 2 to target-arm.next; thanks.

If you only take #2, then you need to squash this from #1:

-- >8 --
diff --git 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"
---

I can respin if it eases your workflow.

Thanks,

Phil.

Re: [PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled
Posted by Philippe Mathieu-Daudé 1 year, 1 month ago
On 28/3/23 15:20, Philippe Mathieu-Daudé wrote:
> On 28/3/23 11:54, Peter Maydell wrote:
>> On Wed, 22 Mar 2023 at 14:29, Philippe Mathieu-Daudé 
>> <philmd@linaro.org> wrote:
>>>
>>> Fix when building QEMU configured with --disable-tcg:
>>>
>>>    Undefined symbols for architecture arm64:
>>>      "_arm_v7m_get_sp_ptr", referenced from:
>>>          _m_sysreg_get in target_arm_gdbstub.c.o
>>>      "_arm_v7m_mrs_control", referenced from:
>>>          _arm_gdb_get_m_systemreg in target_arm_gdbstub.c.o
>>>      "_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)
>>>
>>> Philippe Mathieu-Daudé (2):
>>>    target/arm/gdbstub: Restrict aarch64_gdb_get_pauth_reg() to 
>>> CONFIG_TCG
>>>    target/arm/gdbstub: Only advertise M-profile features if TCG 
>>> available
>>
>> I've applied patch 2 to target-arm.next; thanks.
> 
> If you only take #2, then you need to squash this from #1:
> 
> -- >8 --
> diff --git 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"
> ---
> 
> I can respin if it eases your workflow.

Posted as:
https://lore.kernel.org/qemu-devel/20230328133054.6553-2-philmd@linaro.org/

Along with rth's suggestion as another patch.

Re: [PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled
Posted by Philippe Mathieu-Daudé 1 year, 1 month ago
On 22/3/23 15:29, Philippe Mathieu-Daudé wrote:
> Fix when building QEMU configured with --disable-tcg:
> 
>    Undefined symbols for architecture arm64:
>      "_arm_v7m_get_sp_ptr", referenced from:
>          _m_sysreg_get in target_arm_gdbstub.c.o
>      "_arm_v7m_mrs_control", referenced from:
>          _arm_gdb_get_m_systemreg in target_arm_gdbstub.c.o
>      "_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)

Beside having the non-TCG configs tested in CI, (I think) we can avoid
such breakage by moving the TCG-specific declarations from
target/arm/internals.h to some target/arm/tcg/tcg-internals.h header.
(target/arm/internals.h is 1400+ LoC anyway). Worth it?

Re: [PATCH-for-8.0 0/2] target/arm/gdbstub: Fix builds when TCG is disabled
Posted by Fabiano Rosas 1 year, 1 month ago
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> On 22/3/23 15:29, Philippe Mathieu-Daudé wrote:
>> Fix when building QEMU configured with --disable-tcg:
>> 
>>    Undefined symbols for architecture arm64:
>>      "_arm_v7m_get_sp_ptr", referenced from:
>>          _m_sysreg_get in target_arm_gdbstub.c.o
>>      "_arm_v7m_mrs_control", referenced from:
>>          _arm_gdb_get_m_systemreg in target_arm_gdbstub.c.o
>>      "_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)
>
> Beside having the non-TCG configs tested in CI, (I think) we can avoid
> such breakage by moving the TCG-specific declarations from
> target/arm/internals.h to some target/arm/tcg/tcg-internals.h header.
> (target/arm/internals.h is 1400+ LoC anyway). Worth it?

I think it would be worth it. That still leaves the issue of these small
functions that are semantically related to what is being emulated but
don't need any TCG-specific symbols. It would be nice if we had a
default approach for where to put them. Without going back to sticking
everything in helper.c, of course. =)