[ANN] RISC-V port of lld

175 views
Skip to first unread message

PkmX

unread,
Oct 26, 2017, 4:32:48 AM10/26/17
to sw-...@groups.riscv.org
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

Alex Bradbury

unread,
Oct 26, 2017, 4:48:17 AM10/26/17
to PkmX, RISC-V SW Dev
Fantastic - I'm really glad you've been able to open source this.

I had one question: What is the status for linker relaxation - do you
have an initial prototype implementation, or does it need further
design work?

In your patch submission you mentioned some deficiencies in the psABI
documentation. It would be great if you could find time to help expand
it, or at least create issues to track the information that was
missing.

Best,

Alex

PkmX

unread,
Oct 26, 2017, 3:06:23 PM10/26/17
to Alex Bradbury, RISC-V SW Dev
On Thu, Oct 26, 2017 at 4:48 PM, Alex Bradbury <a...@asbradbury.org> wrote:
> Fantastic - I'm really glad you've been able to open source this.
>
> I had one question: What is the status for linker relaxation - do you
> have an initial prototype implementation, or does it need further
> design work?
>
> In your patch submission you mentioned some deficiencies in the psABI
> documentation. It would be great if you could find time to help expand
> it, or at least create issues to track the information that was
> missing.
>
> Best,
>
> Alex

We have been working on an ad-hoc implementation of linker relaxation
in lld, but I think it still needs some cleanup and some thoughts
about how to proper integrate into the architecture-independent part
of lld.

And yes, I'm going to expand the missing parts of the ABI
documentation when I find some time for that.

----

PkmX

unread,
Nov 12, 2017, 4:31:03 AM11/12/17
to sw-...@groups.riscv.org
Hi,

FYI, the GitHub repository has been moved to the RISC-V organization at:

https://github.com/riscv/riscv-lld


In the past weeks, we've also made a lot of progress in reviewing the patches and getting the port upstreamed. If you have any comments, please check out LLVM phabricator D39322~D39324. Thanks.



--
Chih-Mao Chen (PkmX)
Software R&D, Andes Technology

Palmer Dabbelt

unread,
Nov 13, 2017, 2:36:17 PM11/13/17
to pkm...@gmail.com, Alex Bradbury, sw-...@groups.riscv.org
On Sun, 12 Nov 2017 01:31:00 PST (-0800), pkm...@gmail.com wrote:
> Hi,
>
> FYI, the GitHub repository has been moved to the RISC-V organization at:
>
> https://github.com/riscv/riscv-lld
>
>
> In the past weeks, we've also made a lot of progress in reviewing the
> patches and getting the port upstreamed. If you have any comments, please
> check out LLVM phabricator D39322~D39324. Thanks.

Thanks to everyone who's been working on the RISC-V ports of the various LLVM
tools, it's really great to see a port of such a large project look like it's
going to get upstream.
Reply all
Reply to author
Forward
0 new messages