[PATCH] D154357: [Driver] Recognize powerpc-unknown-eabi as a bare-metal toolchain

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 12 23:51:57 PDT 2023


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

In D154357#4492625 <https://reviews.llvm.org/D154357#4492625>, @cwalther wrote:

> I am unable to provoke any problem with my tests by putting various things in `/usr/lib/gcc/`, and I also can’t find any code that would go looking there on the code path that is exercised by these tests. Can you give me a hint where that code is, so I can try harder to provoke it? Is it outside of `Generic_GCC::GCCInstallationDetector`? `GCCInstallationDetector` is not used on the code path taken for `--target=powerpc[64][le]-unknown-eabi` (after my patch), as far as I can tell. It’s only used by `Generic_GCC` and subclasses, getting away from which is the whole point of my patch.
>
> Or are you suggesting the addition of --sysroot just to prevent potential future problems?

Sorry, I misremembered. baremetal doesn't use GCC detection.
If you use a Linux target triple, you may notice a lot of failed GCC directory `openat` syscalls: `strace -e file --status=failed /tmp/Rel/bin/clang --target=XXX -c -fdriver-only -xc /dev/null`

> I have run the check-clang tests and the patch didn’t break any of them, which makes me hopeful. Or do you think that this may break anyone’s usage? Should we additionally check for the presence of a --gcc-toolchain argument like in the RISC-V case? I am new here, so any guidance is appreciated.

This part of the summary/commit message should be removed before committing.

Specifying `--gcc-toolchain=` is for `Generic_GCC::GCCInstallationDetector::init`. `RISCVToolChain::RISCVToolChain` calls this function, other baremetal targets don't.
If we don't call `Generic_GCC::GCCInstallationDetector::init`, `--gcc-toolchain=` is not checked and will lead to an unused warning.


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

https://reviews.llvm.org/D154357



More information about the cfe-commits mailing list