[v2,2/2] Propagate NT_RISCV_VECTOR from Linux kernel headers to binutils. The value is identical to pre-existing NT_RISCV_CSR but the note names different (NT_RISCV_CSR is "GDB" and NT_RISCV_VECTOR is "CORE")

Message ID 20230810221122.1155980-3-greg.savin@sifive.com
State New
Headers
Series [v2,1/2] Reset note name of NT_RISCV_CSR to "GDB" to be consistent with the intent described in commit db6092f3aec43ea4d10efc5ff74274f04cdc0ad6 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

Greg Savin Aug. 10, 2023, 10:11 p.m. UTC
  ---
 include/elf/common.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Andrew Burgess Aug. 11, 2023, 12:51 p.m. UTC | #1
Greg Savin via Gdb-patches <gdb-patches@sourceware.org> writes:

> ---
>  include/elf/common.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/elf/common.h b/include/elf/common.h
> index e7eede23a07..d28f5c6ccf5 100644
> --- a/include/elf/common.h
> +++ b/include/elf/common.h
> @@ -715,6 +715,8 @@
>  					/*   note name must be "CORE".  */
>  #define NT_RISCV_CSR    0x900		/* RISC-V Control and Status Registers */
>  					/*   note name must be "GDB".  */
> +#define NT_RISCV_VECTOR 0x900		/* RISC-V Vector Registers */
> +					/*   note name must be "CORE".  */

I'm not a binutils maintainer, but do have an interest from the
RISC-V/GDB side.

Given the comments you made in an earlier mail, I guess we're going to
have to restructure some of the core file support in order to handle
NT_RISCV_CSR and NT_RISCV_VECTOR having the same values.  But that
should be doable.

No objections to this patch from me.

Thanks,
Andrew


>  #define NT_SIGINFO	0x53494749	/* Fields of siginfo_t.  */
>  #define NT_FILE		0x46494c45	/* Description of mapped files.  */
>  
> -- 
> 2.25.1
  
Palmer Dabbelt Aug. 11, 2023, 4:43 p.m. UTC | #2
On Fri, 11 Aug 2023 05:51:45 PDT (-0700), Andrew Burgess wrote:
> Greg Savin via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>> ---
>>  include/elf/common.h | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/include/elf/common.h b/include/elf/common.h
>> index e7eede23a07..d28f5c6ccf5 100644
>> --- a/include/elf/common.h
>> +++ b/include/elf/common.h
>> @@ -715,6 +715,8 @@
>>  					/*   note name must be "CORE".  */
>>  #define NT_RISCV_CSR    0x900		/* RISC-V Control and Status Registers */
>>  					/*   note name must be "GDB".  */
>> +#define NT_RISCV_VECTOR 0x900		/* RISC-V Vector Registers */
>> +					/*   note name must be "CORE".  */
>
> I'm not a binutils maintainer, but do have an interest from the
> RISC-V/GDB side.
>
> Given the comments you made in an earlier mail, I guess we're going to
> have to restructure some of the core file support in order to handle
> NT_RISCV_CSR and NT_RISCV_VECTOR having the same values.  But that
> should be doable.
>
> No objections to this patch from me.

NT_RISCV_VECTOR isn't in a releasted kernel, so it's not a stable uABI 
yet.  So there's still time to change it.  0I've got a revert on the 
kernel lists, it'd mean we miss 6.5 but we'd just end up in 6.6 which 
isn't so bad.

> Thanks,
> Andrew
>
>
>>  #define NT_SIGINFO	0x53494749	/* Fields of siginfo_t.  */
>>  #define NT_FILE		0x46494c45	/* Description of mapped files.  */
>>
>> --
>> 2.25.1
  
John Baldwin Aug. 12, 2023, 12:47 a.m. UTC | #3
On 8/11/23 9:43 AM, Palmer Dabbelt wrote:
> On Fri, 11 Aug 2023 05:51:45 PDT (-0700), Andrew Burgess wrote:
>> Greg Savin via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>>> ---
>>>   include/elf/common.h | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/include/elf/common.h b/include/elf/common.h
>>> index e7eede23a07..d28f5c6ccf5 100644
>>> --- a/include/elf/common.h
>>> +++ b/include/elf/common.h
>>> @@ -715,6 +715,8 @@
>>>   					/*   note name must be "CORE".  */
>>>   #define NT_RISCV_CSR    0x900		/* RISC-V Control and Status Registers */
>>>   					/*   note name must be "GDB".  */
>>> +#define NT_RISCV_VECTOR 0x900		/* RISC-V Vector Registers */
>>> +					/*   note name must be "CORE".  */
>>
>> I'm not a binutils maintainer, but do have an interest from the
>> RISC-V/GDB side.
>>
>> Given the comments you made in an earlier mail, I guess we're going to
>> have to restructure some of the core file support in order to handle
>> NT_RISCV_CSR and NT_RISCV_VECTOR having the same values.  But that
>> should be doable.
>>
>> No objections to this patch from me.
> 
> NT_RISCV_VECTOR isn't in a releasted kernel, so it's not a stable uABI
> yet.  So there's still time to change it.  0I've got a revert on the
> kernel lists, it'd mean we miss 6.5 but we'd just end up in 6.6 which
> isn't so bad.

While it is possible to handle colliding NT_RISCV_* values, it will probably
be simpler all-around if you are able to make NT_RISCV_VECTOR be 0x901 since
you are going to revert and redo.
  
Palmer Dabbelt Aug. 12, 2023, 12:50 a.m. UTC | #4
On Fri, 11 Aug 2023 17:47:29 PDT (-0700), jhb@FreeBSD.org wrote:
> On 8/11/23 9:43 AM, Palmer Dabbelt wrote:
>> On Fri, 11 Aug 2023 05:51:45 PDT (-0700), Andrew Burgess wrote:
>>> Greg Savin via Gdb-patches <gdb-patches@sourceware.org> writes:
>>>
>>>> ---
>>>>   include/elf/common.h | 2 ++
>>>>   1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/include/elf/common.h b/include/elf/common.h
>>>> index e7eede23a07..d28f5c6ccf5 100644
>>>> --- a/include/elf/common.h
>>>> +++ b/include/elf/common.h
>>>> @@ -715,6 +715,8 @@
>>>>   					/*   note name must be "CORE".  */
>>>>   #define NT_RISCV_CSR    0x900		/* RISC-V Control and Status Registers */
>>>>   					/*   note name must be "GDB".  */
>>>> +#define NT_RISCV_VECTOR 0x900		/* RISC-V Vector Registers */
>>>> +					/*   note name must be "CORE".  */
>>>
>>> I'm not a binutils maintainer, but do have an interest from the
>>> RISC-V/GDB side.
>>>
>>> Given the comments you made in an earlier mail, I guess we're going to
>>> have to restructure some of the core file support in order to handle
>>> NT_RISCV_CSR and NT_RISCV_VECTOR having the same values.  But that
>>> should be doable.
>>>
>>> No objections to this patch from me.
>>
>> NT_RISCV_VECTOR isn't in a releasted kernel, so it's not a stable uABI
>> yet.  So there's still time to change it.  0I've got a revert on the
>> kernel lists, it'd mean we miss 6.5 but we'd just end up in 6.6 which
>> isn't so bad.
>
> While it is possible to handle colliding NT_RISCV_* values, it will probably
> be simpler all-around if you are able to make NT_RISCV_VECTOR be 0x901 since
> you are going to revert and redo.

Ya, that'd be part of the reason to backport it, there's also one or two 
other bugs we found so it's probably just a good sign this wasn't 
adequately reviewed.  Here's the Linux patch 
<https://lore.kernel.org/all/20230810214810.21905-1-palmer@rivosinc.com/>
  

Patch

diff --git a/include/elf/common.h b/include/elf/common.h
index e7eede23a07..d28f5c6ccf5 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -715,6 +715,8 @@ 
 					/*   note name must be "CORE".  */
 #define NT_RISCV_CSR    0x900		/* RISC-V Control and Status Registers */
 					/*   note name must be "GDB".  */
+#define NT_RISCV_VECTOR 0x900		/* RISC-V Vector Registers */
+					/*   note name must be "CORE".  */
 #define NT_SIGINFO	0x53494749	/* Fields of siginfo_t.  */
 #define NT_FILE		0x46494c45	/* Description of mapped files.  */