aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-12-12 18:34:35 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-12-12 18:34:35 +0000
commita629190326089f0b3df5a74272a72db95d988ed8 (patch)
tree5173a2637df52f725ad85def3e9c9d8ed5166817
parent268ee7016a2811803989487c0ad3799486092c63 (diff)
Force i[0-9]86 to i386 when using LLVM_HOSTTRIPLE.
Only use major part of OS version when on darwin and modifying OS part of target triple. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60957 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Driver/clang.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index c9022e4b57..cb85eaee0f 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -790,13 +790,20 @@ static std::string CreateTargetTriple() {
if (Triple.empty()) {
Triple = LLVM_HOSTTRIPLE;
+ // Force i<N>86 to i386 when using LLVM_HOSTTRIPLE.
+ if (Triple[0] == 'i' && isdigit(Triple[1]) &&
+ Triple[2] == '8' && Triple[3] == '6')
+ Triple[1] = '3';
+
// On darwin, we want to update the version to match that of the
// host.
std::string::size_type DarwinDashIdx = Triple.find("-darwin");
if (DarwinDashIdx != std::string::npos) {
Triple.resize(DarwinDashIdx + strlen("-darwin"));
- Triple += llvm::sys::osVersion();
+ // Only add the major part of the os version.
+ std::string Version = llvm::sys::osVersion();
+ Triple += Version.substr(0, Version.find('.'));
}
}