Re: [PATCH v7 05/18] [gdb/aarch64] sme: Enable SME registers and pseudo-registers

Luis Machado
2023-10-13T14:50:45Z

On 10/13/23 15:44, Luis Machado wrote:
> On 10/13/23 14:06, Tom Tromey wrote:
>>>>>>> "Luis" == Luis Machado via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>> Hi Luis.
>>
>> This patch caused a gdbserver build failure on aarch64-linux.
>>
>> In file included from ../../src/gdbserver/../gdb/nat/aarch64-scalable-linux-ptrace.h:36,
>> from ../../src/gdbserver/linux-aarch64-low.cc:48:
>> ../../src/gdbserver/linux-aarch64-low.cc: In function 'void aarch64_adjust_register_sets(const aarch64_features&)':
>> ../../src/gdbserver/../gdb/nat/aarch64-scalable-linux-sigcontext.h:304:45: error: '__SVE_VQ_BYTES' was not declared in this scope; did you mean 'SVE_VQ_BYTES'?
>> 304 | ((sizeof (struct user_za_header) + (__SVE_VQ_BYTES - 1)) \
>> | ^~~~~~~~~~~~~~
>> ../../src/gdbserver/../gdb/nat/aarch64-scalable-linux-sigcontext.h:325:10: note: in expansion of macro 'ZA_PT_ZA_OFFSET'
>> 325 | (ZA_PT_ZA_OFFSET + ZA_PT_ZA_SIZE(vq))
>> | ^~~~~~~~~~~~~~~
>> ../../src/gdbserver/linux-aarch64-low.cc:941:28: note: in expansion of macro 'ZA_PT_SIZE'
>> 941 | regset->size = ZA_PT_SIZE (features.svq);
>> | ^~~~~~~~~~
>> CXX nat/aarch64-linux.o
>>
>> Luis> +/* Make sure we only define these if the kernel header doesn't. */
>> Luis> +#ifndef ZA_PT_SIZE
>> ...
>> Luis> +/* Offset from the start of struct user_za_header to the register data */
>> Luis> +#define ZA_PT_ZA_OFFSET \
>> Luis> + ((sizeof (struct user_za_header) + (__SVE_VQ_BYTES - 1)) \
>> Luis> + / __SVE_VQ_BYTES * __SVE_VQ_BYTES)
>>
>> Is it safe to just remove the "__" as the compiler suggests?
>>
>> thanks,
>> Tom
>
> Should be, if it is defined. Let me look into it.

We should use SVE_VQ_BYTES as opposed to __SVE_VQ_BYTES here. __SVE_VQ_BYTES is only available if the
system headers include that definition, which older distros may not include.

Does it build fine with that? If so, I can push that change, but I want to make sure the path of
building aarch64 gdbserver on a system without SVE headers works. My testing systems are probably
newer and have that definition available.