grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 2/9] Add LoongArch definitions


From: WANG Xuerui
Subject: Re: [PATCH v5 2/9] Add LoongArch definitions
Date: Fri, 29 Jul 2022 15:31:48 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Thunderbird/105.0a1

On 2022/7/29 15:11, Xiaotian Wu wrote:
Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
Signed-off-by: Zhou Yang <zhouyang@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 c478933ee..1c8d4f5d5 100644
--- a/include/grub/elf.h
+++ b/include/grub/elf.h
@@ -248,6 +248,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
@@ -2531,6 +2532,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
+

Welp. This almost certainly needs some additional work, now that the new-style relocs [1][2] are upstreamed, and bound to be generated with the combo of binutils 2.40 trunk and gcc 13.0 trunk. So we'll need to support both flavors in order to stay compatible with both older and newer toolchains.

Do you think this part could be finished relatively quickly so as to not miss the next grub release?

[1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6d13722a97cee3fd397e116bde3bcedbb1e220be
[2]: https://github.com/loongson/LoongArch-Documentation/pull/57

  #ifdef GRUB_TARGET_WORDSIZE
  #if GRUB_TARGET_WORDSIZE == 32



reply via email to

[Prev in Thread] Current Thread [Next in Thread]