mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-12-17 09:06:21 +00:00
loongarch: Add support for ELF psABI v1.00 relocations
This patch adds support of the stack-based LoongArch relocations throughout GRUB, including tools, dynamic linkage, and support for conversion of ELF relocations into PE ones. A stack machine is required to handle these per the spec [1] (see the R_LARCH_SOP types), of which a simple implementation is included. These relocations are produced by binutils 2.38 and 2.39, while the newer v2.00 relocs require more recent toolchain (binutils 2.40+ & gcc 13+, or LLVM 16+). GCC 13 has not been officially released as of early 2023, so support for v1.00 relocs are expected to stay relevant for a while. [1] 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> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
This commit is contained in:
@@ -119,6 +119,32 @@ struct grub_module_verifier_arch archs[] = {
|
||||
R_AARCH64_PREL32,
|
||||
-1
|
||||
} },
|
||||
{ "loongarch64", 8, 0, EM_LOONGARCH, GRUB_MODULE_VERIFY_SUPPORTS_REL | GRUB_MODULE_VERIFY_SUPPORTS_RELA, (int[]){
|
||||
R_LARCH_NONE,
|
||||
R_LARCH_64,
|
||||
R_LARCH_MARK_LA,
|
||||
R_LARCH_SOP_PUSH_PCREL,
|
||||
R_LARCH_SOP_PUSH_ABSOLUTE,
|
||||
R_LARCH_SOP_PUSH_PLT_PCREL,
|
||||
R_LARCH_SOP_SUB,
|
||||
R_LARCH_SOP_SL,
|
||||
R_LARCH_SOP_SR,
|
||||
R_LARCH_SOP_ADD,
|
||||
R_LARCH_SOP_AND,
|
||||
R_LARCH_SOP_IF_ELSE,
|
||||
R_LARCH_SOP_POP_32_S_10_5,
|
||||
R_LARCH_SOP_POP_32_U_10_12,
|
||||
R_LARCH_SOP_POP_32_S_10_12,
|
||||
R_LARCH_SOP_POP_32_S_10_16,
|
||||
R_LARCH_SOP_POP_32_S_10_16_S2,
|
||||
R_LARCH_SOP_POP_32_S_5_20,
|
||||
R_LARCH_SOP_POP_32_S_0_5_10_16_S2,
|
||||
R_LARCH_SOP_POP_32_S_0_10_10_16_S2,
|
||||
-1
|
||||
}, (int[]){
|
||||
-1
|
||||
}
|
||||
},
|
||||
{ "mips64el", 8, 0, EM_MIPS, GRUB_MODULE_VERIFY_SUPPORTS_REL | GRUB_MODULE_VERIFY_SUPPORTS_RELA, (int[]){
|
||||
R_MIPS_64,
|
||||
R_MIPS_32,
|
||||
|
||||
Reference in New Issue
Block a user