[PATCH] D97993: [Driver] Suppress GCC detection under -B for non-Android

Dan Albert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 5 14:55:41 PST 2021


danalbert added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:1911
+  SmallVector<std::string, 8> Prefixes;
+  if (TargetTriple.isAndroid())
+    Prefixes.assign(D.PrefixDirs.begin(), D.PrefixDirs.end());
----------------
I'm not entirely sure what `D.PrefixDirs` represents so maybe Android doesn't need this either.

The behavior the NDK depends on is being able to find tools co-located with the Clang driver location. Aside from `as`, these are all LLVM tools (lld and co).

The sysroot is expected to be in `$CLANG/../sysroot`. All our headers, libraries (aside from libgcc/libatomic), and CRT objects are located there.

The clang driver install location is expected to also be a GCC install directory, so libgcc/libatomic are expected at `$CLANG/../lib/gcc/$TRIPLE/$GCC_VERSION`.

Typical usage for the NDK does not involve `-gcc-toolchain` or `-B` at all.

If I've understood correctly, your change can be applied to Android as well without breaking any of those behaviors. @srhines will need to comment on whether the Android platform build needs this, but aiui anyone depending on this behavior just needs to fix their build to use `-gcc-toolchain` where they were previously using `-B`.

Of course, I can't speak to what our users with custom build systems that don't follow our docs might be doing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97993



More information about the cfe-commits mailing list