Skip to content

Commit 2a597ed

Browse files
author
Baoquan He
committed
LoongArch: Add ELF-related definitions
JIRA: https://issues.redhat.com/browse/RHEL-32199 Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Conflict: There's conflict in 1st hunk of scripts/sorttable.c. commit 08145b0 Author: Huacai Chen <chenhuacai@kernel.org> Date: Tue May 31 18:04:10 2022 +0800 LoongArch: Add ELF-related definitions Add ELF-related definitions for LoongArch, including: EM_LOONGARCH, KEXEC_ARCH_LOONGARCH, AUDIT_ARCH_LOONGARCH32, AUDIT_ARCH_LOONGARCH64 and NT_LOONGARCH_*. Reviewed-by: WANG Xuerui <git@xen0n.name> Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Baoquan He <bhe@redhat.com>
1 parent baf4018 commit 2a597ed

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

include/uapi/linux/audit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,8 @@ enum {
439439
#define AUDIT_ARCH_UNICORE (EM_UNICORE|__AUDIT_ARCH_LE)
440440
#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
441441
#define AUDIT_ARCH_XTENSA (EM_XTENSA)
442+
#define AUDIT_ARCH_LOONGARCH32 (EM_LOONGARCH|__AUDIT_ARCH_LE)
443+
#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
442444

443445
#define AUDIT_PERM_EXEC 1
444446
#define AUDIT_PERM_WRITE 2

include/uapi/linux/elf-em.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#define EM_RISCV 243 /* RISC-V */
5252
#define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */
5353
#define EM_CSKY 252 /* C-SKY */
54+
#define EM_LOONGARCH 258 /* LoongArch */
5455
#define EM_FRV 0x5441 /* Fujitsu FR-V */
5556

5657
/*

include/uapi/linux/elf.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ typedef struct elf64_shdr {
440440
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */
441441
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */
442442
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */
443+
#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */
444+
#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */
445+
#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */
446+
#define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */
447+
#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */
443448

444449
/* Note types with note name "GNU" */
445450
#define NT_GNU_PROPERTY_TYPE_0 5

include/uapi/linux/kexec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#define KEXEC_ARCH_MIPS ( 8 << 16)
4545
#define KEXEC_ARCH_AARCH64 (183 << 16)
4646
#define KEXEC_ARCH_RISCV (243 << 16)
47+
#define KEXEC_ARCH_LOONGARCH (258 << 16)
4748

4849
/* The artificial cap on the number of segments passed to kexec_load. */
4950
#define KEXEC_SEGMENT_MAX 16

scripts/sorttable.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
#define EM_ARCV2 195
5555
#endif
5656

57+
#ifndef EM_LOONGARCH
58+
#define EM_LOONGARCH 258
59+
#endif
60+
5761
static uint32_t (*r)(const uint32_t *);
5862
static uint16_t (*r2)(const uint16_t *);
5963
static uint64_t (*r8)(const uint64_t *);
@@ -306,6 +310,7 @@ static int do_file(char const *const fname, void *addr)
306310
case EM_ARCOMPACT:
307311
case EM_ARCV2:
308312
case EM_ARM:
313+
case EM_LOONGARCH:
309314
case EM_MICROBLAZE:
310315
case EM_MIPS:
311316
case EM_XTENSA:

0 commit comments

Comments
 (0)