[PATCH 1/1] readelf: add support for more RISC-V note types

Heinrich Schuchardt heinrich.schuchardt@canonical.com
Wed Sep 9 06:25:02 GMT 2026


On 9/9/26 08:08, Jan Beulich wrote:
> On 09.09.2026 07:57, Heinrich Schuchardt via Binutils wrote:
>> Add definitions and string values for note types
>>
>> * NT_RISCV_VECTOR               0x901
>> * NT_RISCV_TAGGED_ADDR_CTRL     0x902
>> * NT_RISCV_USER_CFI             0x903
>>
>> The constants are defined in Linux' tools/include/uapi/linux/elf.h.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> 
> Largely okay, one nit:
> 
>> --- a/include/elf/common.h
>> +++ b/include/elf/common.h
>> @@ -783,6 +783,12 @@
>>   					/*   note name must be "LINUX".  */
>>   #define NT_RISCV_CSR    0x900		/* RISC-V Control and Status Registers */
>>   					/*   note name must be "LINUX".  */
>> +#define NT_RISCV_VECTOR 0x901           /* RISC-V vector registers */
>> +					/*   note name must be "LINUX".  */
>> +#define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged address control (prctl()) */
>> +					/*   note name must be "LINUX".  */
>> +#define NT_RISCV_USER_CFI	  0x903 /* RISC-V shadow stack state */
>> +					/*   note name must be "LINUX".  */
>>   #define NT_SIGINFO	0x53494749	/* Fields of siginfo_t.  */
>>   #define NT_FILE		0x46494c45	/* Description of mapped files.  */
> 
> Padding used wants to match that of adjacent code. Since I assume this
> wants committing on your behalf anyway, I can make adjustments while
> doing so.
> 
> Jan

Hello Jan,

Thanks for reviewing.

This what it looks like in vim:

  783                                         /*   note name must be 
"LINUX".  */
  784 #define NT_RISCV_CSR    0x900           /* RISC-V Control and 
Status Registers */
  785                                         /*   note name must be 
"LINUX".  */
  786 #define NT_RISCV_VECTOR 0x901           /* RISC-V vector registers */
  787                                         /*   note name must be 
"LINUX".  */
  788 #define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged address 
control (prctl()) */
  789                                         /*   note name must be 
"LINUX".  */
  790 #define NT_RISCV_USER_CFI         0x903 /* RISC-V shadow stack 
state */
  791                                         /*   note name must be 
"LINUX".  */
  792 #define NT_SIGINFO      0x53494749      /* Fields of siginfo_t.  */

I thought this was keeping everything as aligned as possible.
Previous lines also used tabs.

If you see need for change, please, edit when committing.

Best regards

heinrich


More information about the Binutils mailing list