mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-21 16:07:03 +00:00

`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 (cherry picked from commit 8a31f7ddb8436fa2a8ad754eb51618139cf63415)
LLVM Linker (lld)
This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.
lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.
Benchmarking
In order to make sure various developers can evaluate patches over the same tests, we create a collection of self contained programs.
It is hosted at https://s3-us-west-2.amazonaws.com/linker-tests/lld-speed-test.tar.xz
The current sha256 is 10eec685463d5a8bbf08d77f4ca96282161d396c65bd97dc99dbde644a31610f
.