diff mbox

Add elf.h NT_* macros from Linux 4.15 (bug 14890)

Message ID alpine.DEB.2.20.1802011815290.21283@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Feb. 1, 2018, 6:16 p.m. UTC
[Proposed for once the release changes for 2.27, and the post-release 
changes opening master for development for 2.28, have been committed.]

Linux 4.15 adds NT_S390_RI_CB to linux/elf.h (and NT_ARM_SVE, which we
already have in glibc).  This shows up that various other ELF note
values from linux/elf.h are missing from glibc's elf.h.

This patch adds the missing values that are relevant to glibc
architectures.  As elf.h is a general description of the ELF format,
not necessarily limited to glibc configurations, there's an argument
for having the remaining NT_* values that Linux uses for non-glibc
architectures in glibc's elf.h as well, but this patch does not add
them.

Adding the NT_PRFPREG name is bug 14890.  That bug also requests
making the NT_FPREGSET name obsolete.  Given that elf.h is not just
for Linux but can describe ELF for other operating systems, I don't
think that a change of name in the Linux kernel is sufficient
justification for declaring the other name obsolete; there can be
multiple names for the same note value, even with incompatible
semantics, if those reflect variants of the ELF format in actual use.
For example, FreeBSD appears still to have the name NT_FPREGSET
<https://github.com/freebsd/freebsd/blob/master/sys/sys/elf_common.h>
(note: I haven't checked whether the FreeBSD kernel actually generates
such notes or whether this is actually an other-OS definition present
in FreeBSD's header).

2018-02-01  Joseph Myers  <joseph@codesourcery.com>

	[BZ #14890]
	* elf/elf.h (NT_PRFPREG): New macro.
	(NT_S390_VXRS_LOW): Likewise.
	(NT_S390_VXRS_HIGH): Likewise.
	(NT_S390_GS_CB): Likewise.
	(NT_S390_GS_BC): Likewise.
	(NT_S390_RI_CB): Likewise.

Comments

Dmitry V. Levin Feb. 6, 2018, 12:25 a.m. UTC | #1
On Thu, Feb 01, 2018 at 06:16:25PM +0000, Joseph Myers wrote:
> [Proposed for once the release changes for 2.27, and the post-release 
> changes opening master for development for 2.28, have been committed.]
> 
> Linux 4.15 adds NT_S390_RI_CB to linux/elf.h (and NT_ARM_SVE, which we
> already have in glibc).  This shows up that various other ELF note
> values from linux/elf.h are missing from glibc's elf.h.
> 
> This patch adds the missing values that are relevant to glibc
> architectures.  As elf.h is a general description of the ELF format,
> not necessarily limited to glibc configurations, there's an argument
> for having the remaining NT_* values that Linux uses for non-glibc
> architectures in glibc's elf.h as well, but this patch does not add
> them.
> 
> Adding the NT_PRFPREG name is bug 14890.  That bug also requests
> making the NT_FPREGSET name obsolete.  Given that elf.h is not just
> for Linux but can describe ELF for other operating systems, I don't
> think that a change of name in the Linux kernel is sufficient
> justification for declaring the other name obsolete; there can be
> multiple names for the same note value, even with incompatible
> semantics, if those reflect variants of the ELF format in actual use.
> For example, FreeBSD appears still to have the name NT_FPREGSET
> <https://github.com/freebsd/freebsd/blob/master/sys/sys/elf_common.h>
> (note: I haven't checked whether the FreeBSD kernel actually generates
> such notes or whether this is actually an other-OS definition present
> in FreeBSD's header).
> 
> 2018-02-01  Joseph Myers  <joseph@codesourcery.com>
> 
> 	[BZ #14890]
> 	* elf/elf.h (NT_PRFPREG): New macro.
> 	(NT_S390_VXRS_LOW): Likewise.
> 	(NT_S390_VXRS_HIGH): Likewise.
> 	(NT_S390_GS_CB): Likewise.
> 	(NT_S390_GS_BC): Likewise.
> 	(NT_S390_RI_CB): Likewise.
> 
> diff --git a/elf/elf.h b/elf/elf.h
> index 954f326..59313f5 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -739,6 +739,8 @@ typedef struct
>  /* Legal values for note segment descriptor types for core files. */
>  
>  #define NT_PRSTATUS	1		/* Contains copy of prstatus struct */
> +#define NT_PRFPREG	2		/* Contains copy of fpregset
> +					   struct.  */
>  #define NT_FPREGSET	2		/* Contains copy of fpregset struct */
>  #define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */
>  #define NT_PRXREG	4		/* Contains copy of prxregset struct */
> @@ -790,6 +792,13 @@ typedef struct
>  #define NT_S390_LAST_BREAK	0x306	/* s390 breaking event address */
>  #define NT_S390_SYSTEM_CALL	0x307	/* s390 system call restart data */
>  #define NT_S390_TDB	0x308		/* s390 transaction diagnostic block */
> +#define NT_S390_VXRS_LOW	0x309	/* s390 vector registers 0-15
> +					   upper half.  */
> +#define NT_S390_VXRS_HIGH	0x30a	/* s390 vector registers 16-31.  */
> +#define NT_S390_GS_CB	0x30b		/* s390 guarded storage registers.  */
> +#define NT_S390_GS_BC	0x30c		/* s390 guarded storage
> +					   broadcast control block.  */
> +#define NT_S390_RI_CB	0x30d		/* s390 runtime instrumentation.  */
>  #define NT_ARM_VFP	0x400		/* ARM VFP/NEON registers */
>  #define NT_ARM_TLS	0x401		/* ARM TLS register */
>  #define NT_ARM_HW_BREAK	0x402		/* ARM hardware breakpoint registers */

I've double-checked that this change matches Linux 4.15 headers.
diff mbox

Patch

diff --git a/elf/elf.h b/elf/elf.h
index 954f326..59313f5 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -739,6 +739,8 @@  typedef struct
 /* Legal values for note segment descriptor types for core files. */
 
 #define NT_PRSTATUS	1		/* Contains copy of prstatus struct */
+#define NT_PRFPREG	2		/* Contains copy of fpregset
+					   struct.  */
 #define NT_FPREGSET	2		/* Contains copy of fpregset struct */
 #define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */
 #define NT_PRXREG	4		/* Contains copy of prxregset struct */
@@ -790,6 +792,13 @@  typedef struct
 #define NT_S390_LAST_BREAK	0x306	/* s390 breaking event address */
 #define NT_S390_SYSTEM_CALL	0x307	/* s390 system call restart data */
 #define NT_S390_TDB	0x308		/* s390 transaction diagnostic block */
+#define NT_S390_VXRS_LOW	0x309	/* s390 vector registers 0-15
+					   upper half.  */
+#define NT_S390_VXRS_HIGH	0x30a	/* s390 vector registers 16-31.  */
+#define NT_S390_GS_CB	0x30b		/* s390 guarded storage registers.  */
+#define NT_S390_GS_BC	0x30c		/* s390 guarded storage
+					   broadcast control block.  */
+#define NT_S390_RI_CB	0x30d		/* s390 runtime instrumentation.  */
 #define NT_ARM_VFP	0x400		/* ARM VFP/NEON registers */
 #define NT_ARM_TLS	0x401		/* ARM TLS register */
 #define NT_ARM_HW_BREAK	0x402		/* ARM hardware breakpoint registers */