-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling FIR code for RISC-V target #1445
Comments
Hi, thanks for reporting the issue, it is exiting to see flang being tested on new platforms (I am not aware RISC-V was already tested) ! I am not familiar with Chipyard, are you cross-compiling to RISC-V or was the host compiler (LLVM with flang) also compiled on RISC-V ? From the error you are reporting, it looks like the issue is that the flang runtime libraries We have never tried cross-compiling yet, so I am not entirely sure what are all the steps/changes that are needed. The first one I see is to compile a version of the runtime libraries for the target. Then, you may still experience some troubles if the C types between the flang host and the target maps to different hardware type (e.g. |
Hey @jeanPerier,
I was trying to create a Flang that could cross-compile to RISCV, so both the build and host machines are X86, only the target that was changed to RISCV. The approach used was an adaptation of these instructions to create a Clang cross-compiler. I've also tried cross-compiling Flang itself in an attempt to generate the runtime libraries to a RISCV host, but it didn't work either.
That does seem to be the case, and a good first step to try. I've noticed that the libraries are all C++, so trying to cross-compiling them without any alterations to the source code might be possible. In order to cross-compile these libraries, I'm trying to edit the CMake instructions to use the proper target architecture flags when generating the libraries. From what I've looked so far, it seems that the right place to do it would be in the fir-dev/flang/cmake/modules/AddFlang.cmake file. Do you think this might work? Sorry about the (very) late answer. |
I would try avoid the cross-compilation path (from here):
Also, I would try experimenting with Flang's compiler driver, |
Hey,
I'm trying to compile a Fortran hello world source code through FIR to run on a RISC-V target using Chipyard.
It looks something like this:
However, it fails when linking the RISC-V program with the libraries since they are not compatible with RISC-V:
I haven't found a proper way to compile Fortran code to RISC-V, especially when going through FIR.
Is it currently possible to compile FIR code to a RISC-V target?
The text was updated successfully, but these errors were encountered: