mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-12 11:03:24 +00:00

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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332750 91177308-0d34-0410-b5e6-96231b3b80d8
35 lines
993 B
C++
35 lines
993 B
C++
//===- llvm/Support/Win32/Host.inc ------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements the Win32 Host support.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "WindowsSupport.h"
|
|
#include <cstdio>
|
|
#include <string>
|
|
|
|
using namespace llvm;
|
|
|
|
static std::string updateTripleOSVersion(std::string Triple) {
|
|
return Triple;
|
|
}
|
|
|
|
std::string sys::getDefaultTargetTriple() {
|
|
const char *Triple = LLVM_DEFAULT_TARGET_TRIPLE;
|
|
|
|
// Override the default target with an environment variable named by LLVM_TARGET_TRIPLE_ENV.
|
|
#if defined(LLVM_TARGET_TRIPLE_ENV)
|
|
if (const char *EnvTriple = std::getenv(LLVM_TARGET_TRIPLE_ENV))
|
|
Triple = EnvTriple;
|
|
#endif
|
|
|
|
return Triple;
|
|
}
|