[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v16 02/10] ELF: Add LoongArch definitions
From: |
Xiaotian Wu |
Subject: |
[PATCH v16 02/10] ELF: Add LoongArch definitions |
Date: |
Thu, 27 Apr 2023 15:43:01 +0800 |
Add ELF e_machine ID [1] and relocations types [2] for LoongArch to
the current in-repo definitions.
[1]:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_e_machine_identifies_the_machine
[2]:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_relocations
Signed-off-by: Zhou Yang <zhouyang@loongson.cn>
Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
---
include/grub/elf.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/include/grub/elf.h b/include/grub/elf.h
index e6f073bc9..c36d7dab2 100644
--- a/include/grub/elf.h
+++ b/include/grub/elf.h
@@ -252,6 +252,7 @@ typedef struct
#define EM_NUM 95
#define EM_AARCH64 183 /* ARM 64-bit architecture */
#define EM_RISCV 243 /* RISC-V */
+#define EM_LOONGARCH 258 /* LoongArch */
/* If it is necessary to assign new unofficial EM_* values, please
pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
@@ -2536,6 +2537,28 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_RISCV_SET32 56
#define R_RISCV_32_PCREL 57
+/* LoongArch relocations */
+#define R_LARCH_NONE 0
+#define R_LARCH_64 2
+#define R_LARCH_MARK_LA 20
+#define R_LARCH_SOP_PUSH_PCREL 22
+#define R_LARCH_SOP_PUSH_ABSOLUTE 23
+#define R_LARCH_SOP_PUSH_PLT_PCREL 29
+#define R_LARCH_SOP_SUB 32
+#define R_LARCH_SOP_SL 33
+#define R_LARCH_SOP_SR 34
+#define R_LARCH_SOP_ADD 35
+#define R_LARCH_SOP_AND 36
+#define R_LARCH_SOP_IF_ELSE 37
+#define R_LARCH_SOP_POP_32_S_10_5 38
+#define R_LARCH_SOP_POP_32_U_10_12 39
+#define R_LARCH_SOP_POP_32_S_10_12 40
+#define R_LARCH_SOP_POP_32_S_10_16 41
+#define R_LARCH_SOP_POP_32_S_10_16_S2 42
+#define R_LARCH_SOP_POP_32_S_5_20 43
+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44
+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45
+
extern grub_err_t grub_elf32_get_shnum (Elf32_Ehdr *e, Elf32_Shnum *shnum);
extern grub_err_t grub_elf32_get_shstrndx (Elf32_Ehdr *e, Elf32_Word
*shstrndx);
extern grub_err_t grub_elf32_get_phnum (Elf32_Ehdr *e, Elf32_Word *phnum);
--
2.40.0
- [PATCH v16 00/10] Add support for LoongArch, Xiaotian Wu, 2023/04/27
- [PATCH v16 01/10] PE: Add LoongArch definitions, Xiaotian Wu, 2023/04/27
- [PATCH v16 02/10] ELF: Add LoongArch definitions,
Xiaotian Wu <=
- [PATCH v16 03/10] LoongArch: Add setjmp implementation, Xiaotian Wu, 2023/04/27
- [PATCH v16 04/10] LoongArch: Add early startup code, Xiaotian Wu, 2023/04/27
- [PATCH v16 05/10] LoongArch: Add support for ELF psABI v1.00 relocations, Xiaotian Wu, 2023/04/27
- [PATCH v16 06/10] LoongArch: Add support for ELF psABI v2.00 relocations, Xiaotian Wu, 2023/04/27
- [PATCH v16 07/10] LoongArch: Add auxiliary files, Xiaotian Wu, 2023/04/27
- [PATCH v16 08/10] LoongArch: Add to build system, Xiaotian Wu, 2023/04/27
- [PATCH v16 09/10] tests: Fix timezone inconsistency in squashfs_test, Xiaotian Wu, 2023/04/27
- [PATCH v16 10/10] tests: Add LoongArch to various test cases, Xiaotian Wu, 2023/04/27
- Re: [PATCH v16 00/10] Add support for LoongArch, Daniel Kiper, 2023/04/28