diff options
| author | Weining Lu <luweining@loongson.cn> | 2023-08-09 09:54:41 +0800 |
|---|---|---|
| committer | Weining Lu <luweining@loongson.cn> | 2023-08-09 09:55:27 +0800 |
| commit | 8a31f7ddb8436fa2a8ad754eb51618139cf63415 (patch) | |
| tree | fad24b9838d5b10b2082e68c34ca49bac67105cb /clang/lib/Frontend/CompilerInvocation.cpp | |
| parent | 2b0bfb6928ef070f3e79dfee0b34a2895a414d59 (diff) | |
| download | llvm-8a31f7ddb8436fa2a8ad754eb51618139cf63415.zip llvm-8a31f7ddb8436fa2a8ad754eb51618139cf63415.tar.gz llvm-8a31f7ddb8436fa2a8ad754eb51618139cf63415.tar.bz2 | |
[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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions
