[clang] [Driver] Add the --gcc-triple option (PR #73214)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 1 21:39:30 PST 2023


================
@@ -2130,6 +2130,15 @@ void Generic_GCC::GCCInstallationDetector::init(
     return;
   }
 
+  // If --gcc-triple is specified use this instead of trying to
+  // auto-detect a triple.
+  if (const Arg *A =
+          Args.getLastArg(clang::driver::options::OPT_gcc_triple_EQ)) {
+    StringRef GCCTriple = A->getValue();
+    CandidateTripleAliases.clear();
+    CandidateTripleAliases.push_back(GCCTriple);
+  }
+
   // Compute the set of prefixes for our search.
----------------
MaskRay wrote:

When `--gcc-triple=` is specified, should `--gcc-toolchain=` or configure-time `GCC_INSTALL_PREFIX` be ignored? (Shall we continue the effort to deprecate `GCC_INSTALL_PREFIX` even if `DEFAULT_SYSROOT` is to be retained as we don't have a replacement yet? https://reviews.llvm.org/D158218)

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


More information about the cfe-commits mailing list