From 24b61ac832c79fc1cd2c04437dadca171cda63ed Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 18 May 2018 18:33:07 +0000 Subject: [Support] Avoid normalization in sys::getDefaultTargetTriple 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. Differential Revision: https://reviews.llvm.org/D46910 llvm-svn: 332750 --- llvm/lib/Support/Unix/Host.inc | 2 +- llvm/lib/Support/Windows/Host.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support') diff --git a/llvm/lib/Support/Unix/Host.inc b/llvm/lib/Support/Unix/Host.inc index 5580e63893c..b65f84bf444 100644 --- a/llvm/lib/Support/Unix/Host.inc +++ b/llvm/lib/Support/Unix/Host.inc @@ -64,5 +64,5 @@ std::string sys::getDefaultTargetTriple() { TargetTripleString = EnvTriple; #endif - return Triple::normalize(TargetTripleString); + return TargetTripleString; } diff --git a/llvm/lib/Support/Windows/Host.inc b/llvm/lib/Support/Windows/Host.inc index 90a6fb31670..58c4dc5d678 100644 --- a/llvm/lib/Support/Windows/Host.inc +++ b/llvm/lib/Support/Windows/Host.inc @@ -30,5 +30,5 @@ std::string sys::getDefaultTargetTriple() { Triple = EnvTriple; #endif - return Triple::normalize(Triple); + return Triple; } -- cgit v1.2.3