]> git.ipfire.org Git - thirdparty/grub.git/commit
loongarch: Add support for ELF psABI v1.00 relocations
authorXiaotian Wu <wuxiaotian@loongson.cn>
Thu, 27 Apr 2023 07:43:04 +0000 (15:43 +0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 17 May 2023 10:59:08 +0000 (12:59 +0200)
commitb264f098be2c55bc5216df545adfadba407d9090
tree80b4c8483422910f247d397bef9f51d81353e883
parent6a42dd9e259ba8611069d39fab9ce89bc70f4b47
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>
grub-core/kern/dl.c
grub-core/kern/loongarch64/dl.c [new file with mode: 0644]
grub-core/kern/loongarch64/dl_helper.c [new file with mode: 0644]
include/grub/dl.h
include/grub/loongarch64/reloc.h [new file with mode: 0644]
util/grub-mkimagexx.c
util/grub-module-verifier.c