[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
mihailo-stojanovic wrote: Perhaps @asb could also weigh in as the initial contributor of RISCVToolchain. https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
MaskRay 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. > 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 https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
mihailo-stojanovic wrote: I believe that more information can be found in the [commit](https://github.com/llvm/llvm-project/commit/45ba2392d7e00aedd4d9fb04070dbae8a7fbbeeb) which added the `RISCVToolChain::hasGCCToolchain` method. As far as I could gather, before this was merged, the only option for baremetal compilation was to provide an existing GCC installation, as `toolchains::RISCVToolChain` expects one to be present. My patch just makes sure that `--gcc-install-dir` works as intended with RISCV baremetal triples, as the option is currently useless, and I believe the `-gcc-toolchain` option is deprecated. https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
MaskRay wrote: I am not familiar with RISC-V baremetal toolchains, but this toolchain gave me a feeling of "there is a lot of fragmentation in this area. However, we as a vendor upstreamed first what we did to clang/lib/Driver/ToolChains/RISCVToolchain.cpp and made it apply to all target triples without an OS (Linux/*BSD)" https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
MaskRay wrote: A user has recently asked me about `RISCVToolChain` and I am puzzled by its behavior. Why is the return value of `RISCVToolChain::hasGCCToolchain` used to choose `toolchains::RISCVToolChain` or `toolchains::BareMetal`? The logic should be decided by the target triple, not whether `--gcc-toolchain=` or `--gcc-install-dir=` is specified or not, or whether `crt0.o` (where does this file come from?) is present or absent. I have a feeling that RISCVToolchain.cpp only works for certain vendors and other vendors cannot use it, and some builtin rules in RISCVToolchain.cpp are not clear about the choices. https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
https://github.com/MaskRay requested changes to this pull request. . https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
asb wrote: Tagging @MaskRay for a quick check of this too, if he has time. https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
https://github.com/kito-cheng approved this pull request. Checked with `Generic_GCC::GCCInstallationDetector::init` to make sure clang will use that to search gcc toolchain, so LGTM. https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang] Enable --gcc-install-dir for RISCV baremetal toolchains (PR #71803)
https://github.com/mihailo-stojanovic edited https://github.com/llvm/llvm-project/pull/71803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits