ldc icon indicating copy to clipboard operation
ldc copied to clipboard

plan to support Loongarch64 chip architecture

Open szly-jerry opened this issue 3 years ago • 6 comments

Hi,Please help me compile the LDC tool chain suitable for Loongarch64 chip platform,thanks you!

szly-jerry avatar May 17 '22 03:05 szly-jerry

loongarch64-linux-gnu tool has packed.

szly-jerry avatar May 17 '22 03:05 szly-jerry

You should be able to cross compile or bootstrap as long as the LLVM LDC is build against has that target enabled.

thewilsonator avatar May 17 '22 08:05 thewilsonator

Seems like they're in the process of upstreaming an existing LLVM backend (in their fork: https://github.com/loongson/llvm-project) to upstream LLVM (https://lists.llvm.org/pipermail/llvm-dev/2021-December/154371.html). Once it's in there and we've upgraded to that version, basic cross-compilation to that new architecture should work fine. druntime will need some work, incl. some predefined version from the compiler for that arch.

If you want to test this early, you should be able to build that LLVM fork and then build & link LDC against it. Something like -mtriple=loongarch64-linux-gnu should then suffice to cross-compile some first code.

kinke avatar May 17 '22 21:05 kinke

@kinke Please help me compile the LDC tool chain suitable for Loongarch64 chip platform,thanks you!

szly-jerry avatar Jul 01 '23 14:07 szly-jerry

As the LoongArch target has been promoted to a default target in LLVM 16 and LDC master newly supports LLVM 16, basic cross-compilation should now work with e.g. the upcoming official v1.34 packages.

Wrt. porting D to that new architecture, see https://wiki.dlang.org/LDC#Architectures ('Others') for a terse summary of what needs to be done (first step: defining the version to be predefined by the compiler, e.g., LoongArch64 or so).

kinke avatar Aug 16 '23 14:08 kinke

I'm not sure whether druntime has already been fully ported upstream, but at least large parts of it should work on LoongArch64 since druntime v2.106, and LDC v1.35 came with initial compiler support. So LDC v1.36 might work already, or should be pretty close at least.

kinke avatar Dec 06 '23 20:12 kinke