ldc-developers / ldc

The LLVM-based D Compiler.
http://wiki.dlang.org/LDC
Other
1.21k stars 262 forks source link

plan to support Loongarch64 chip architecture #3986

Open szly-jerry opened 2 years ago

szly-jerry commented 2 years ago

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

szly-jerry commented 2 years ago

loongarch64-linux-gnu tool has packed.

thewilsonator commented 2 years ago

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

kinke commented 2 years ago

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.

szly-jerry commented 1 year ago

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

kinke commented 1 year ago

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 commented 11 months ago

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.