[all-commits] [llvm/llvm-project] 8a31f7: [lld][LoongArch] Support the R_LARCH_PCREL20_S2 re...
Lu Weining via All-commits
all-commits at lists.llvm.org
Tue Aug 8 18:56:19 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8a31f7ddb8436fa2a8ad754eb51618139cf63415
https://github.com/llvm/llvm-project/commit/8a31f7ddb8436fa2a8ad754eb51618139cf63415
Author: Weining Lu <luweining at loongson.cn>
Date: 2023-08-09 (Wed, 09 Aug 2023)
Changed paths:
M lld/ELF/Arch/LoongArch.cpp
A lld/test/ELF/loongarch-pcrel20-s2.s
Log Message:
-----------
[lld][LoongArch] Support the R_LARCH_PCREL20_S2 relocation type
`R_LARCH_PCREL20_S2` is a new added relocation type in LoongArch ELF
psABI v2.10 [1] which is not corvered by D138135 except `R_LARCH_64_PCREL`.
A motivation to support `R_LARCH_PCREL20_S2` in lld is to build the
runtime of .NET core (a.k.a `CoreCLR`) in which strict PC-relative
semantics need to be guaranteed [2]. The normal `pcalau12i + addi.d`
approach doesn't work because the code will be copied to other places
with different "page" and offsets. To achieve this, we can use `pcaddi`
with explicit `R_LARCH_PCREL20_S2` reloc to address +-2MB PC-relative
range with 4-bytes aligned.
[1]: https://github.com/loongson/la-abi-specs/releases/tag/v2.10
[2]: https://github.com/dotnet/runtime/blob/release/7.0/src/coreclr/vm/loongarch64/asmhelpers.S#L307
Reviewed By: xen0n, MaskRay
Differential Revision: https://reviews.llvm.org/D156772
More information about the All-commits
mailing list