aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorWANG Xuerui <git@xen0n.name>2023-07-25 17:03:28 +0800
committerWeining Lu <luweining@loongson.cn>2023-07-25 17:06:07 +0800
commit6084ee742064cf8121444febee342133b0cb7abd (patch)
treec1411cf1e4795a5fd6149c087e068d4eaac6234d /lld/ELF/ScriptParser.cpp
parent4cf11d8a65dfded59761ec52804a86277b9c0036 (diff)
downloadllvm-6084ee742064cf8121444febee342133b0cb7abd.zip
llvm-6084ee742064cf8121444febee342133b0cb7abd.tar.gz
llvm-6084ee742064cf8121444febee342133b0cb7abd.tar.bz2
[lld][ELF] Support LoongArch
This adds support for the LoongArch ELF psABI v2.00 [1] relocation model to LLD. The deprecated stack-machine-based psABI v1 relocs are not supported. The code is tested by successfully bootstrapping a Gentoo/LoongArch stage3, complete with common GNU userland tools and both the LLVM and GNU toolchains (GNU toolchain is present only for building glibc, LLVM+Clang+LLD are used for the rest). Large programs like QEMU are tested to work as well. [1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html Reviewed By: MaskRay, SixWeining Differential Revision: https://reviews.llvm.org/D138135
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r--lld/ELF/ScriptParser.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index dbe86be..3577e78 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -445,6 +445,8 @@ static std::pair<ELFKind, uint16_t> parseBfdName(StringRef s) {
.Case("elf64-littleriscv", {ELF64LEKind, EM_RISCV})
.Case("elf64-sparc", {ELF64BEKind, EM_SPARCV9})
.Case("elf32-msp430", {ELF32LEKind, EM_MSP430})
+ .Case("elf32-loongarch", {ELF32LEKind, EM_LOONGARCH})
+ .Case("elf64-loongarch", {ELF64LEKind, EM_LOONGARCH})
.Default({ELFNoneKind, EM_NONE});
}