Andes Technology is pleased to announce that we are open-sourcing our
RISC-V port of lld (the LLVM linker), and we plan to submit and
integrate the port back to lld upstream.
Our implementation supports both RV32 and RV64 (including RVC),
linking of static and (PIE) dynamic executables and DSOs, support for
TLS, and comes with associated unit tests. The port is split into
three patches, all of which are up for review on LLVM phabricator:
1. Support RISC-V target and basic relocation:
https://reviews.llvm.org/D39322
This patch adds RISC-V support and allows lld to link static ELF
executables (elf/newlib toolchain).
2. Support PIC/PIE:
https://reviews.llvm.org/D39323
With this patch, lld is able to create shared library as well as (PIE)
dynamic executables (linux/glibc toolchain).
3. Support TLS:
https://reviews.llvm.org/D39324
This patch adds support for all four (initial/local-exec,
global/local-dynamic) TLS model. TLS relaxation isn't supported yet.
You may also clone the repository directly from GitHub (build
instructions included):
https://github.com/andestech/lld
We have tested lld in gcc, plumhall and supertest testsuites as a
drop-in replacement of ld.bfd, using both gcc and our llvm/clang port
(
https://github.com/andestech/riscv-llvm-toolchain) as the main
compiler. We've also been using lld internally to iron out any
potential bugs.
In the future, we'll continue to work on lld, including its
integration with the llvm/clang port to form a complete LLVM-based
toolchain for RISC-V.
Any comments, feedback or bug reports (to GitHub) are appreciated.
--
Chih-Mao Chen (PkmX)
Software R&D, Andes Technology