[Looking for Mentor] RISC-V linker

There’s the lowRISC project: https://github.com/lowRISC/riscv-llvm

I’d like to use LLVM RISC-V but reading the FAQ there’s this line:

How can I build upstream LLVM+Clang and use it to cross-compile for a riscv32 target?

First you will need a built RISC-V gcc toolchain. The linker, compiled libraries, and libc header files will be used. You can build your own by following the instructions at the riscv-gnu-toolchain repo. It is sufficient to do the following:

That’s a bit of a waste…

Why would I build the entire GNU RISC-V toolchain just to build the LLVM toolchain?

I think that LLVM should have the capabilities use it’s own linker, compiled libraries, etc…

I’d like to find a mentor who I can occasionally ping with a question here or there about certain things while trying to get this up and running.

A major question that I have that I come across many times with LLVM projects are that they still require GNU headers, why is that?

I’ve tracked down the relevant starting place to lib/Driver/ToolChains/*

Where different linkers are implemented.

I did see a code review where someone from LLVM wanted to implement risc-v detection code in baremetal instead of creating something new: https://reviews.llvm.org/D42673

but looking recently there’s the RISC-V headers for Clang:
http://llvm.org/svn/llvm-project/cfe/trunk/lib/Driver/ToolChains/RISCV.h

http://llvm.org/svn/llvm-project/cfe/trunk/lib/Driver/ToolChains/RISCV.cpp

I’d like to help to get the linker up and running so that I can avoid having to build the entire GNU toolchain to use RISC-V.

Best,
Owen

I am a beginner looking for help to run baremetal code for RISC-V.It would be very helpful if you could specify the method to run the baremetal code for riscv-llvm and the linker used.

Not a riscv person but the last change to that repo was 2018. There’s a good chance latest llvm is in a much better shape.

@asb ?

@richunorman this is a really old thread. As David says, all the code in that repo has since been fully upstreamed. If you’re seeking help with RISC-V and LLVM it would probably be best to start a new thread and give as much information as you can about your question (what you’re trying to achieve, what you’ve tried so far etc). Thanks!

Edit: Ah, I see you’ve started a thread here - perfect.

1 Like