[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 10:56:05 PST 2023


abidh wrote:

> Thanks for the pointer. However, the description doesn't appear to have sufficient information to justify the `--gcc-toolchain=` dependent decision. A toolchain should be selected completely from the target triple. I think `RISCVToolChain` should be adjusted to either select a different target triple, or (I am sorry to say this) be removed, since some choices (`crt0.o` `-lgloss`) are strange. It can be added back when we sort out the use cases we want to support and ensure that it doesn't get in the way for users who don't provide `crt0.o` `-lgloss`. More likely, we really don't need this RISCVToolChain and can satisfy the user need with a configuration file.
> 
> If there is a multilib selection need, participate in the discussion of Clang-based multilib https://discourse.llvm.org/t/rfc-multilib/67494
> 
> > So in the toolchain selection code, I have made this dependency of RISCVToolChain on gcc toolchain explicit. It is created if gcc-toolchain option is present. Otherwise Baremetal toolchain is created. I will be happy to hear if there is a better way to choose between these two toolchains.
> 
> @abidh

IIRC the RISCVToolChain was handling the case where clang is used with a gcc sysroot. My aim was to not break the workflow of existing users of RISCVToolChain. But I agree that handling same triple in 2 places is not right. We may be able to do what RISCVToolChain is doing with some modification in BareMetal.cpp and using configuration files. 


https://github.com/llvm/llvm-project/pull/71803


More information about the cfe-commits mailing list