[02/13] elf-em.h: add EM_ARC

Message ID 20181109031536.GB21511@altlinux.org
State New
Headers show
Series
  • Prepare for PTRACE_GET_SYSCALL_INFO
Related show

Commit Message

Dmitry V. Levin Nov. 9, 2018, 3:15 a.m.
The uapi/linux/audit.h header is going to use EM_ARC in order
to define AUDIT_ARCH_ARC which is needed to implement
syscall_get_arch() which in turn is required to extend
the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.

The value for EM_ARC has been taken from
http://www.sco.com/developers/gabi/2012-12-31/ch4.eheader.html

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 include/uapi/linux/elf-em.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Alexey Brodkin Nov. 9, 2018, 2:20 p.m. | #1
Hi Dmitry,

On Fri, 2018-11-09 at 06:15 +0300, Dmitry V. Levin wrote:
> The uapi/linux/audit.h header is going to use EM_ARC in order
> to define AUDIT_ARCH_ARC which is needed to implement
> syscall_get_arch() which in turn is required to extend
> the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.
> 
> The value for EM_ARC has been taken from
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.sco.com_developers_gabi_2012-2D12-2D31_ch4.eheader.html&d=DwICAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=Xh7PO9ZcwtbHwzwugwhu0NZypO9ObM5zMkXiQ2ja-QI&s=23pqjp37UXKSxQC0AFzqBjPquJdrh_4FjSW00FLRf4k&e=
> 
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
>  include/uapi/linux/elf-em.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
> index ba3696e3d694..56ff3f9d9633 100644
> --- a/include/uapi/linux/elf-em.h
> +++ b/
> @@ -26,6 +26,7 @@
>  #define EM_ARM		40	/* ARM 32 bit */
>  #define EM_SH		42	/* SuperH */
>  #define EM_SPARCV9	43	/* SPARC v9 64-bit */
> +#define EM_ARC		45	/* Argonaut RISC Core */
>  #define EM_H8_300	46	/* Renesas H8/300 */
>  #define EM_IA_64	50	/* HP/Intel IA-64 */
>  #define EM_X86_64	62	/* AMD x86-64 */

I guess we need to add ARCv2 here as well like that:
------------------------>8-----------------------
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 31aa10178335..5c6c263d5c69 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -41,6 +41,7 @@
 #define EM_TILEPRO     188     /* Tilera TILEPro */
 #define EM_MICROBLAZE  189     /* Xilinx MicroBlaze */
 #define EM_TILEGX      191     /* Tilera TILE-Gx */
+#define EM_ARCV2       195     /* Synopsys ARCv2 ISA */
 #define EM_BPF         247     /* Linux BPF - in-kernel virtual machine */
 #define EM_FRV         0x5441  /* Fujitsu FR-V */
------------------------>8-----------------------

See https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=include/elf/common.h;hb=HEAD#l309
Note though that we're moving from EM_ARC_COMPACT2 to EM_ARCV2 name
so it matches real ISA name. This is what we use in Glibc port we're
upstreaming now.

-Alexey
Vineet Gupta Nov. 9, 2018, 4:41 p.m. | #2
On 11/8/18 7:15 PM, Dmitry V. Levin wrote:
> The uapi/linux/audit.h header is going to use EM_ARC in order
> to define AUDIT_ARCH_ARC which is needed to implement
> syscall_get_arch() which in turn is required to extend
> the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.
>
> The value for EM_ARC has been taken from
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.sco.com_developers_gabi_2012-2D12-2D31_ch4.eheader.html&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=c14YS-cH-kdhTOW89KozFhBtBJgs1zXscZojEZQ0THs&m=UCr-dDO1BWV4K-CXhpcDRnN4Urr4_UgSKBeEaczUAmE&s=XmSWUKeqq324aU46NSTbHc12dH-1vVnA4G3Rm-01WD4&e=
>
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
>  include/uapi/linux/elf-em.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
> index ba3696e3d694..56ff3f9d9633 100644
> --- a/include/uapi/linux/elf-em.h
> +++ b/include/uapi/linux/elf-em.h
> @@ -26,6 +26,7 @@
>  #define EM_ARM		40	/* ARM 32 bit */
>  #define EM_SH		42	/* SuperH */
>  #define EM_SPARCV9	43	/* SPARC v9 64-bit */
> +#define EM_ARC		45	/* Argonaut RISC Core */

Please use EM_ARCOMPACT (for original ARC ISA) and EM_ARCV2 - both defined in
arch/arc/include/asm/elf.h

-Vineet

>  #define EM_H8_300	46	/* Renesas H8/300 */
>  #define EM_IA_64	50	/* HP/Intel IA-64 */
>  #define EM_X86_64	62	/* AMD x86-64 */
Dmitry V. Levin Nov. 9, 2018, 9:44 p.m. | #3
On Fri, Nov 09, 2018 at 04:41:36PM +0000, Vineet Gupta wrote:
> On 11/8/18 7:15 PM, Dmitry V. Levin wrote:
> > The uapi/linux/audit.h header is going to use EM_ARC in order
> > to define AUDIT_ARCH_ARC which is needed to implement
> > syscall_get_arch() which in turn is required to extend
> > the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.
> >
> > The value for EM_ARC has been taken from
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.sco.com_developers_gabi_2012-2D12-2D31_ch4.eheader.html&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=c14YS-cH-kdhTOW89KozFhBtBJgs1zXscZojEZQ0THs&m=UCr-dDO1BWV4K-CXhpcDRnN4Urr4_UgSKBeEaczUAmE&s=XmSWUKeqq324aU46NSTbHc12dH-1vVnA4G3Rm-01WD4&e=
> >
> > Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> > ---
> >  include/uapi/linux/elf-em.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
> > index ba3696e3d694..56ff3f9d9633 100644
> > --- a/include/uapi/linux/elf-em.h
> > +++ b/include/uapi/linux/elf-em.h
> > @@ -26,6 +26,7 @@
> >  #define EM_ARM		40	/* ARM 32 bit */
> >  #define EM_SH		42	/* SuperH */
> >  #define EM_SPARCV9	43	/* SPARC v9 64-bit */
> > +#define EM_ARC		45	/* Argonaut RISC Core */
> 
> Please use EM_ARCOMPACT (for original ARC ISA) and EM_ARCV2 - both defined in
> arch/arc/include/asm/elf.h

OK, but we would have to move both EM_ARCOMPACT and EM_ARCV2
to include/uapi/linux/elf-em.h file first, so they could be used
to define AUDIT_ARCH_* constants in include/uapi/linux/audit.h file.

Patch

diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index ba3696e3d694..56ff3f9d9633 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -26,6 +26,7 @@ 
 #define EM_ARM		40	/* ARM 32 bit */
 #define EM_SH		42	/* SuperH */
 #define EM_SPARCV9	43	/* SPARC v9 64-bit */
+#define EM_ARC		45	/* Argonaut RISC Core */
 #define EM_H8_300	46	/* Renesas H8/300 */
 #define EM_IA_64	50	/* HP/Intel IA-64 */
 #define EM_X86_64	62	/* AMD x86-64 */