[llvm] [LLVM][Triple] Drop unknown object types from normalized triples (PR #135571)

Usman Nadeem via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 14:23:39 PDT 2025


================
@@ -1265,6 +1266,14 @@ std::string Triple::normalize(StringRef Str, CanonicalForm Form) {
     }
   }
 
+  // Environment "unknown-elf" is just "elf".
----------------
UsmanNadeem wrote:

Your explanation makes sense to me but the problem is that goes against current toolchain expectations and will cause clang to not find libraries for some targets, e.g. some baremetal toolchains use triples like `aarch64-none-elf` and `riscv64-unknown-elf`.
These would normally be canonicalized to `aarch64-unknown-none-elf` and `riscv-unknown-unknown-elf`. Adding an extra `unknown` to account for the missing environment will break things. If you also look at some of the code in `Baremetal.cpp` they check for `Triple.getEnvironmentName() == "elf"`

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


More information about the llvm-commits mailing list