Skip to content

Commit 08145b0

Browse files
committed
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 <[email protected]> Reviewed-by: Jiaxun Yang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent f23b225 commit 08145b0

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
@@ -438,6 +438,11 @@ typedef struct elf64_shdr {
438438
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */
439439
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */
440440
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */
441+
#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */
442+
#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */
443+
#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */
444+
#define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */
445+
#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */
441446

442447
/* Note types with note name "GNU" */
443448
#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
@@ -43,6 +43,7 @@
4343
#define KEXEC_ARCH_MIPS ( 8 << 16)
4444
#define KEXEC_ARCH_AARCH64 (183 << 16)
4545
#define KEXEC_ARCH_RISCV (243 << 16)
46+
#define KEXEC_ARCH_LOONGARCH (258 << 16)
4647

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

scripts/sorttable.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
#define EM_RISCV 243
6161
#endif
6262

63+
#ifndef EM_LOONGARCH
64+
#define EM_LOONGARCH 258
65+
#endif
66+
6367
static uint32_t (*r)(const uint32_t *);
6468
static uint16_t (*r2)(const uint16_t *);
6569
static uint64_t (*r8)(const uint64_t *);
@@ -313,6 +317,7 @@ static int do_file(char const *const fname, void *addr)
313317
case EM_ARCOMPACT:
314318
case EM_ARCV2:
315319
case EM_ARM:
320+
case EM_LOONGARCH:
316321
case EM_MICROBLAZE:
317322
case EM_MIPS:
318323
case EM_XTENSA:

0 commit comments

Comments
 (0)