This uses the system ld.gold which does not have RISCV enabled. I also tried building the gold linker as per The LLVM gold plugin — LLVM 20.0.0git documentation but that also does not seem to have RISCV support.
Questions:
Is there a recipe to build ld.gold with RISCV enabled?
Is there another linker that supports LTO for RISCV that I should be using?
Using LLVMgold.so with ld.bfd worked! I followed the steps in The LLVM gold plugin — LLVM 20.0.0git documentation to build LLVMgold.so as part of my LLVM build.
I then directly invoked ld.bfd and passed it -plugin=</path/to/LLVMgold.so> as:
Question:
I am now building LLVMgold.so as part of my LLVM, and the default LLVM build always builds libLTO.so. Does this mean that any changes that I make to any of the LTO-specific passes in LLVM will be reflected in both libLTO.so as well as LLVMgold.so? Or in other words, do I also need to pass the libLTO.so to ld.bfd?