Re: [PATCH v1] bfd/readelf: Add core file support for FEAT_S1POE

Alice Carlotti <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
On Mon, Jun 29, 2026 at 07:31:58AM +0000, [email protected] wrote:
> From: Srinath Parvathaneni <[email protected]>
> 
> Hi,
> 
> Add support for `NT_ARM_POE` dumps/reads for core files.
> 
> Regression tested for aarch64-none-linux-gnu target and
> found no regressions.
> 
> Ok for binutils-master?

Ok, thanks.

Alice

> 
> Regards,
> Srinath.
> ---
>  bfd/elf.c            | 25 +++++++++++++++++++++++++
>  binutils/readelf.c   |  2 ++
>  include/elf/common.h |  2 ++
>  3 files changed, 29 insertions(+)
> 
> diff --git a/bfd/elf.c b/bfd/elf.c
> index c9a68404e9d..c7f557b8be6 100644
> --- a/bfd/elf.c
> +++ b/bfd/elf.c
> @@ -64,6 +64,7 @@ SECTION
>  /* Names of a pseudo-section which represent core notes.  */
>  #define NOTE_PSEUDO_SECTION_AARCH_FPMR		".reg-aarch-fpmr"
>  #define NOTE_PSEUDO_SECTION_AARCH_GCS		".reg-aarch-gcs"
> +#define NOTE_PSEUDO_SECTION_AARCH_POE		".reg-aarch-poe"
>  #define NOTE_PSEUDO_SECTION_AARCH_HW_BREAK	".reg-aarch-hw-break"
>  #define NOTE_PSEUDO_SECTION_AARCH_HW_WATCH	".reg-aarch-hw-watch"
>  #define NOTE_PSEUDO_SECTION_AARCH_MTE		".reg-aarch-mte"
> @@ -10735,6 +10736,15 @@ elfcore_grok_aarch_gcs (bfd *abfd, Elf_Internal_Note *note)
>    return elfcore_make_note_pseudosection (abfd, NOTE_PSEUDO_SECTION_AARCH_GCS, note);
>  }
>  
> +/* Convert NOTE into a bfd_section called ".reg-aarch-poe".  Return TRUE if
> +   successful, otherwise return FALSE.  */
> +
> +static bool
> +elfcore_grok_aarch_poe (bfd *abfd, Elf_Internal_Note *note)
> +{
> +  return elfcore_make_note_pseudosection (abfd, NOTE_PSEUDO_SECTION_AARCH_POE, note);
> +}
> +
>  /* Convert NOTE into the appropriate note pseudo-section for the AArch64 FPMR.
>   * Return TRUE if successful, otherwise return FALSE.  */
>  
> @@ -11179,6 +11189,7 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
>  	case NT_ARC_V2:		return elfcore_grok_arc_v2 (abfd, note);
>  	case NT_ARM_FPMR:	return elfcore_grok_aarch_fpmr (abfd, note);
>  	case NT_ARM_GCS:	return elfcore_grok_aarch_gcs (abfd, note);
> +	case NT_ARM_POE:	return elfcore_grok_aarch_poe (abfd, note);
>  	case NT_ARM_HW_BREAK:	return elfcore_grok_aarch_hw_break (abfd, note);
>  	case NT_ARM_HW_WATCH:	return elfcore_grok_aarch_hw_watch (abfd, note);
>  	case NT_ARM_PAC_MASK:	return elfcore_grok_aarch_pauth (abfd, note);
> @@ -12900,6 +12911,19 @@ elfcore_write_aarch_gcs (bfd *abfd, char *buf, int *bufsiz,
>  			     aarch_gcs, size);
>  }
>  
> +/* Write the buffer of POE register values in AARCH_POE (length SIZE) into
> +   the note buffer BUF and update *BUFSIZ.  ABFD is the bfd the note is being
> +   written into.  Return a pointer to the new start of the note buffer, to
> +   replace BUF which may no longer be valid.  */
> +
> +static char *
> +elfcore_write_aarch_poe (bfd *abfd, char *buf, int *bufsiz,
> +			 const void *aarch_poe, int size)
> +{
> +  return elfcore_write_note (abfd, buf, bufsiz, NOTE_NAME_LINUX, NT_ARM_POE,
> +			     aarch_poe, size);
> +}
> +
>  /* Write the buffer of FPMR value in AARCH_FPMR (length SIZE) into
>     the note buffer BUF and update *BUFSIZ.  ABFD is the bfd the note is being
>     written into.  Return a pointer to the new start of the note buffer, to
> @@ -13024,6 +13048,7 @@ elfcore_write_register_note (bfd *abfd,
>      {
>        { NOTE_PSEUDO_SECTION_AARCH_FPMR,       elfcore_write_aarch_fpmr},
>        { NOTE_PSEUDO_SECTION_AARCH_GCS,        elfcore_write_aarch_gcs},
> +      { NOTE_PSEUDO_SECTION_AARCH_POE,        elfcore_write_aarch_poe},
>        { NOTE_PSEUDO_SECTION_AARCH_HW_BREAK,   elfcore_write_aarch_hw_break},
>        { NOTE_PSEUDO_SECTION_AARCH_HW_WATCH,   elfcore_write_aarch_hw_watch},
>        { NOTE_PSEUDO_SECTION_AARCH_MTE,        elfcore_write_aarch_mte},
> diff --git a/binutils/readelf.c b/binutils/readelf.c
> index bf27f9eec23..61354d7ab11 100644
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -21915,6 +21915,8 @@ get_note_type (Filedata * filedata, unsigned e_type)
>  	return _("NT_ARM_PAC_ENABLED_KEYS (AArch64 pointer authentication enabled keys)");
>        case NT_ARM_FPMR:
>  	return _("NT_ARM_FPMR (AArch64 Floating Point Mode Register)");
> +      case NT_ARM_POE:
> +	return _("NT_ARM_POE (AArch64 Permission Overlay Extension Register)");
>        case NT_ARC_V2:
>  	return _("NT_ARC_V2 (ARC HS accumulator/extra registers)");
>        case NT_RISCV_CSR:
> diff --git a/include/elf/common.h b/include/elf/common.h
> index 1ae68221a89..f811b8daeb5 100644
> --- a/include/elf/common.h
> +++ b/include/elf/common.h
> @@ -760,6 +760,8 @@
>  					/*   Note: name must be "LINUX".  */
>  #define NT_ARM_FPMR     0x40e           /* AArch64 FPMR.  */
>  					/*   Note: name must be "LINUX".  */
> +#define NT_ARM_POE	0x40f		/* AArch64 POE register.  */
> +					/*   Note: name must be "LINUX".  */
>  #define NT_ARM_GCS	0x410		/* AArch64 Guarded Control Stack
>  					   registers.  */
>  					/*   Note  name must be "LINUX".  */
> -- 
> 2.43.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.