[PATCH] D47153: [Support] Avoid normalization in sys::getDefaultTargetTriple

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 10:50:22 PDT 2018


phosek created this revision.
phosek added reviewers: rnk, thakis.
Herald added subscribers: llvm-commits, delcypher, hiraditya, mgorny.

The return value of sys::getDefaultTargetTriple, which is derived from
-DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target,
and in the future also to control the search path directly; as such it
should be used textually, without interpretation by LLVM.

Normalization of this value may lead to unexpected results, for example
if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu,
normalization will transform that value to x86_64--linux-gnu. Driver will
use that value to search for tools prefixed with x86_64--linux-gnu- which
may be confusing. This is also inconsistent with the behavior of the
--target flag which is taken as-is without any normalization and overrides
the value of LLVM_DEFAULT_TARGET_TRIPLE.

Users of sys::getDefaultTargetTriple already perform their own
normalization as needed, so this change shouldn't impact existing logic.


Repository:
  rL LLVM

https://reviews.llvm.org/D47153

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/cmake/modules/GetHostTriple.cmake
  llvm/lib/Support/Unix/Host.inc
  llvm/lib/Support/Windows/Host.inc
  llvm/utils/lit/lit/llvm/config.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47153.147818.patch
Type: text/x-patch
Size: 4264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180521/4cd36c34/attachment.bin>


More information about the llvm-commits mailing list