[clang] [Driver] Have getTargetSubDirPath better match get_compiler_rt_target (PR #100091)

Rainer Orth via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 07:54:26 PDT 2024


================
@@ -766,9 +766,19 @@ ToolChain::getTargetSubDirPath(StringRef BaseDir) const {
     return {};
   };
 
-  if (auto Path = getPathForTriple(getTriple()))
+  llvm::Triple Triple = getTriple();
+
+  // Try triple as is.
+  if (auto Path = getPathForTriple(Triple))
     return *Path;
 
+  // Match transformations in CompilerRTUtils.cmake:get_compiler_rt_target.
----------------
rorth wrote:

How would this change cause harm?  If a target uses e.g. an `x86_64-*` or `sparcv9-*` triple, it matches `compiler-rt` out of the box and this change doesn't make a difference.  If on the other hand a target uses the equivalent `amd64-*` or `sparc64-*` forms, they **need** to be transformed to the form that `compiler-rt` uses unconditionally, otherwise `clang` won't find the runtime libs.  This is what this patch does: bring `clang` and `compiler-rt` a little bit more in sync, nothing more, nothing less.  Where do you see any disruption in that?  Fixing tons of link failures in the testsuite isn't my definition of disruption, actually.

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


More information about the cfe-commits mailing list