diff mbox series

[RFC,02/25] kvx: Add ELF-related definitions

Message ID 20230103164359.24347-3-ysionneau@kalray.eu (mailing list archive)
State New
Headers show
Series Upstream kvx Linux port | expand

Commit Message

Yann Sionneau Jan. 3, 2023, 4:43 p.m. UTC
Add ELF-related definitions for kvx, including: EM_KVX,
AUDIT_ARCH_KVX and NT_KVX_TCA.

CC: Paul Moore <paul@paul-moore.com>
CC: Eric Paris <eparis@redhat.com>
CC: Eric Biederman <ebiederm@xmission.com>
CC: Kees Cook <keescook@chromium.org>
CC: linux-audit@redhat.com
CC: linux-kernel@vger.kernel.org
CC: linux-mm@kvack.org
Co-developed-by: Clement Leger <clement.leger@bootlin.com>
Signed-off-by: Clement Leger <clement.leger@bootlin.com>
Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
---
 include/uapi/linux/audit.h  | 1 +
 include/uapi/linux/elf-em.h | 1 +
 include/uapi/linux/elf.h    | 1 +
 3 files changed, 3 insertions(+)

Comments

Eric W. Biederman Jan. 3, 2023, 9:35 p.m. UTC | #1
Yann Sionneau <ysionneau@kalray.eu> writes:

> Add ELF-related definitions for kvx, including: EM_KVX,
> AUDIT_ARCH_KVX and NT_KVX_TCA.

Has someone written an SYSVABI architecture specification for
your architecture?

I feel uncomfortable with the linux-kernel headers being the
authoritative place for the ELF abi definitions.

Especially since the linux kernel does not deal with relocations,
and the kernel headers could diverge from the real world and no one
would notice..

I know at least at one point the linux standards base was taking
up the work on collecting up some of these definitions.  I would
be happy if there was anything outside of the linux kernel that
people could refer too.

Eric

> CC: Paul Moore <paul@paul-moore.com>
> CC: Eric Paris <eparis@redhat.com>
> CC: Eric Biederman <ebiederm@xmission.com>
> CC: Kees Cook <keescook@chromium.org>
> CC: linux-audit@redhat.com
> CC: linux-kernel@vger.kernel.org
> CC: linux-mm@kvack.org
> Co-developed-by: Clement Leger <clement.leger@bootlin.com>
> Signed-off-by: Clement Leger <clement.leger@bootlin.com>
> Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
> ---
>  include/uapi/linux/audit.h  | 1 +
>  include/uapi/linux/elf-em.h | 1 +
>  include/uapi/linux/elf.h    | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
> index d676ed2b246e..4db7aa3f84c7 100644
> --- a/include/uapi/linux/audit.h
> +++ b/include/uapi/linux/audit.h
> @@ -402,6 +402,7 @@ enum {
>  #define AUDIT_ARCH_HEXAGON	(EM_HEXAGON)
>  #define AUDIT_ARCH_I386		(EM_386|__AUDIT_ARCH_LE)
>  #define AUDIT_ARCH_IA64		(EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
> +#define AUDIT_ARCH_KVX		(EM_KVX|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
>  #define AUDIT_ARCH_M32R		(EM_M32R)
>  #define AUDIT_ARCH_M68K		(EM_68K)
>  #define AUDIT_ARCH_MICROBLAZE	(EM_MICROBLAZE)
> diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
> index ef38c2bc5ab7..9cc348be7f86 100644
> --- a/include/uapi/linux/elf-em.h
> +++ b/include/uapi/linux/elf-em.h
> @@ -51,6 +51,7 @@
>  #define EM_RISCV	243	/* RISC-V */
>  #define EM_BPF		247	/* Linux BPF - in-kernel virtual machine */
>  #define EM_CSKY		252	/* C-SKY */
> +#define EM_KVX		256	/* Kalray VLIW Architecture */
>  #define EM_LOONGARCH	258	/* LoongArch */
>  #define EM_FRV		0x5441	/* Fujitsu FR-V */
>  
> diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
> index c7b056af9ef0..49094f3be06c 100644
> --- a/include/uapi/linux/elf.h
> +++ b/include/uapi/linux/elf.h
> @@ -444,6 +444,7 @@ typedef struct elf64_shdr {
>  #define NT_LOONGARCH_LSX	0xa02	/* LoongArch Loongson SIMD Extension registers */
>  #define NT_LOONGARCH_LASX	0xa03	/* LoongArch Loongson Advanced SIMD Extension registers */
>  #define NT_LOONGARCH_LBT	0xa04	/* LoongArch Loongson Binary Translation registers */
> +#define NT_KVX_TCA		0x900	/* kvx TCA registers */
>  
>  /* Note types with note name "GNU" */
>  #define NT_GNU_PROPERTY_TYPE_0	5
Yann Sionneau Jan. 18, 2023, 8:48 a.m. UTC | #2
On 03/01/2023 22:35, Eric W. Biederman wrote:
> Yann Sionneau <ysionneau@kalray.eu> writes:
>
>> Add ELF-related definitions for kvx, including: EM_KVX,
>> AUDIT_ARCH_KVX and NT_KVX_TCA.
> Has someone written an SYSVABI architecture specification for
> your architecture?

Internally at Kalray we have an ABI document, I started a discussion 
about its publication.

It will not be part of the V2, but I'm working on it.

>
> I feel uncomfortable with the linux-kernel headers being the
> authoritative place for the ELF abi definitions.
>
> Especially since the linux kernel does not deal with relocations,
> and the kernel headers could diverge from the real world and no one
> would notice..
>
> I know at least at one point the linux standards base was taking
> up the work on collecting up some of these definitions.  I would
> be happy if there was anything outside of the linux kernel that
> people could refer too.

I completely agree with you!

Thanks for the review.
diff mbox series

Patch

diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index d676ed2b246e..4db7aa3f84c7 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -402,6 +402,7 @@  enum {
 #define AUDIT_ARCH_HEXAGON	(EM_HEXAGON)
 #define AUDIT_ARCH_I386		(EM_386|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_IA64		(EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_KVX		(EM_KVX|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_M32R		(EM_M32R)
 #define AUDIT_ARCH_M68K		(EM_68K)
 #define AUDIT_ARCH_MICROBLAZE	(EM_MICROBLAZE)
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index ef38c2bc5ab7..9cc348be7f86 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -51,6 +51,7 @@ 
 #define EM_RISCV	243	/* RISC-V */
 #define EM_BPF		247	/* Linux BPF - in-kernel virtual machine */
 #define EM_CSKY		252	/* C-SKY */
+#define EM_KVX		256	/* Kalray VLIW Architecture */
 #define EM_LOONGARCH	258	/* LoongArch */
 #define EM_FRV		0x5441	/* Fujitsu FR-V */
 
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index c7b056af9ef0..49094f3be06c 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -444,6 +444,7 @@  typedef struct elf64_shdr {
 #define NT_LOONGARCH_LSX	0xa02	/* LoongArch Loongson SIMD Extension registers */
 #define NT_LOONGARCH_LASX	0xa03	/* LoongArch Loongson Advanced SIMD Extension registers */
 #define NT_LOONGARCH_LBT	0xa04	/* LoongArch Loongson Binary Translation registers */
+#define NT_KVX_TCA		0x900	/* kvx TCA registers */
 
 /* Note types with note name "GNU" */
 #define NT_GNU_PROPERTY_TYPE_0	5