[PATCH] D91442: [clang][Driver] Handle risvc in Baremetal.cpp.

Jessica Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 3 04:12:13 PDT 2021


jrtc27 added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:5216-5220
+        if (toolchains::RISCVToolChain::hasGCCToolchain(*this, Args))
+          TC =
+              std::make_unique<toolchains::RISCVToolChain>(*this, Target, Args);
+        else
+          TC = std::make_unique<toolchains::BareMetal>(*this, Target, Args);
----------------
This has broken our use downstream. We construct a normal bare-metal non-multilib baremetal sysroot, no GCC involved, passed explicitly with --sysroot. However, BareMetal's findRISCVMultilibs unconditionally appends multilib paths for anything other than IMAC (always ILP32/LP64) (well, it still appends the path, just the multilib path is curiously empty), without filtering out ones that don't exist like Gnu.cpp. I assume the empty string for IMAC is a hack to allow most normal uses of bare-metal toolchains to work, but it breaks if you want hard float support (or fewer extensions).

I suspect this is best fixed by filtering out non-existent directories from findRISCVMultilibs (and at the same time, fixing IMAC to have a non-empty path, since RISCVToolChain has one for it, and we no longer need the hacky, insufficient workaround)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91442/new/

https://reviews.llvm.org/D91442



More information about the cfe-commits mailing list