RISC-V and LLVM

Hello

Anyone in here working on RISC-V LLVM toolchain?
I know about the lowRISC project but their documentation says that they still need the entire GNU toolchain for the linker, headers and some other stuff.

If there’s anyone in here working on RISC-V and LLVM i’d like to talk.

At SiFive that’s me.

For RISC-V gcc has a big headstart on clang/llvm as Andrew Waterman (I believe) started working on gcc for RISC-V at basically the same time as they were designing and iterating the instruction set seven or eight years ago.

LLVM is getting very close to being usable, and will be for some purposes once a few more patches (especially from the lowRISC project) have been merged. However some things have not even been started by anyone, as far as I’m aware. For example a hard float ABI.

And, yes, LLVM will depend on the gnu headers and linker for the foreseeable future, unless changing that gets to the top of someone’s priority list. It’s unlikely to be at the top of our list any time soon – we want LLVM for possible better code generation (yet to be proven) and because it’s easier to use for adding instruction set extensions and because a significant portion of the Linux packages that have not yet been ported to RISC-V depend on LLVM. None of that depends on replacing the gnu linker or headers.

Someone has started work on lld for RISC-V but I expect it will be a while before it’s usable.

That’s why I am here.

I’d like to get up to speed on the current state of things.

I don’t mind if the LLVM code is slower, the fact that LLVM upstream is more responsive is good enough for me.

A quick question, why does some projects use GNU headers?

I did see the linker code upstream as well, which is great.

I know nothing about the hard float ABI but if it needs to get implemented, then I’ll just have to learn.

From my understanding and the way I see this problem the first goal would be to get rid of the GNU headers since it doesn’t make sense for me to build the GNU toolchain to use LLVM when I can just work on improving things as I go.

That goes back to the question that I asked above, why do some LLVM projects use GNU headers?

Because they are there, they work, we don’t have any ideological or practical reason not to use them, and we have other important things we’d rather put our effort into.

If you’d like to contribute to the LLVM project that’s great and all help is appreciated, but this is the wrong place to ask about it. I suggest you join one or more of the mailing lists at http://lists.llvm.org/mailman/listinfo

I have nothing against GNU tools as I use them all the time.

The issue is that on FreeBSD LLVM is the shipped compiler and installing GCC takes a long time.

It’s about practicality for me and not and nothing to do with ideology.

I asked since you say you’re the LLVM guy and I honestly don’t know.

If you find it too much to give a reasonable explanation of why LLVM uses GCC headers instead of their own, that’s acceptable.

Best

I’ve answered the question, to the best of my knowledge. I’m working on LLVM but I didn’t start the LLVM project or make any of the major decisions about it. People in the LLVM mailing lists did, and your questions would be better directed to them.

When you configure and build LLVM you tell it where to find the system headers. If you already have system headers that didn’t come from GNU that’s fine – use them. On embedded targets we use Newlib. But on GNU/Linux we use GNU headers.

Thanks I really appreciate the clarification.

I’ll be putting this towards the top of my priorities since I need to get these things sorted out.