]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Ignore new LoongArch PC-relative relocations and relaxations 1160/head
authorAlexey Sheplyakov <asheplyakov@basealt.ru>
Wed, 21 Feb 2024 09:07:21 +0000 (13:07 +0400)
committerMichael Brown <mcb30@ipxe.org>
Thu, 22 Feb 2024 14:40:53 +0000 (14:40 +0000)
commitee6185dcf5ad7b0d5e486e66c424341764fc221d
tree3353a5c8cc2530db1f2dcd38f49d7705ae0fdaa0
parente5f3ba0ca773e8ea4dcfec6e10f18a06d14e79e0
[efi] Ignore new LoongArch PC-relative relocations and relaxations

Several new relocations types have been added in LoongArch ABI version
2.10.  In particular:

- R_LARCH_B16 (18-bit PC-relative jump)
- R_LARCH_B21 (23-bit PC-relative jump)
- R_LARCH_PCREL20_S2 (22-bit PC-relative offset)

Also relocation relaxations have been introduced.  Recent GCC (13.2)
and binutils 2.41+ use these types of relocations, which confuses
elf2efi tool.  As a result, iPXE EFI images for LoongArch fail to
build with the following error:

  Unrecognised relocation type 103

Fix by ignoring R_LARCH_B{16,21} and R_LARCH_PCREL20_S2 (as with other
PC-relative relocations), and by ignoring relaxations (R_LARCH_RELAX).
Relocation relaxations are basically optimizations: ignoring them
results in a correct binary (although it might be suboptimal).

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/util/elf2efi.c