ARM-Darwin: Use the *-*-darwin-eabi triple for v6m & v7m archs

These arch arguments are used for embedded targets (obviously) which need a
different calling convention to iOS.

llvm-svn: 193328
This commit is contained in:
Tim Northover 2013-10-24 10:48:50 +00:00
parent 94ecbd2e6c
commit 901dee4d28
4 changed files with 27 additions and 5 deletions

View File

@ -149,7 +149,9 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
Str[4] = '0' + (Rev % 10);
Str[5] = '\0';
Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__", Str);
} else {
} else if (Triple.getArchName() != "thumbv6m" &&
Triple.getArchName() != "thumbv7m" &&
Triple.getArchName() != "thumbv7em") {
// Note that the Driver allows versions which aren't representable in the
// define (because we only get a single digit for the minor and micro
// revision numbers). So, we limit them to the maximum representable

View File

@ -167,10 +167,18 @@ std::string Darwin::ComputeEffectiveClangTriple(const ArgList &Args,
if (!isTargetInitialized())
return Triple.getTriple();
if (Triple.getArchName() == "thumbv6m" ||
Triple.getArchName() == "thumbv7m" ||
Triple.getArchName() == "thumbv7em") {
// OS is ios or macosx unless it's the v6m or v7m.
Triple.setOS(llvm::Triple::Darwin);
Triple.setEnvironment(llvm::Triple::EABI);
} else {
SmallString<16> Str;
Str += isTargetIPhoneOS() ? "ios" : "macosx";
Str += getTargetVersion().getAsString();
Triple.setOSName(Str);
}
return Triple.getTriple();
}

View File

@ -1,6 +1,12 @@
// RUN: %clang -arch armv7 -target thumbv7-apple-darwin-eabi -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-AAPCS
// RUN: %clang -arch armv7s -target thumbv7-apple-ios -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// RUN: %clang -arch armv7s -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// RUN: %clang -arch armv6m -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-DARWIN-EABI
// RUN: %clang -arch armv7m -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-DARWIN-EABI
// RUN: %clang -arch armv7em -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-DARWIN-EABI
// CHECK-DARWIN-EABI: "-triple" "{{thumbv[67]e?m}}-apple-darwin-eabi"
// CHECK-IOS: "-triple" "thumbv7" "thumbv7-apple-ios
// CHECK-AAPCS: "-target-abi" "aapcs"
// CHECK-APCS: "-target-abi" "apcs-gnu"

View File

@ -0,0 +1,6 @@
// RUN: %clang -target x86_64-apple-darwin -arch armv6m -dM -E %s | FileCheck %s
// RUN: %clang -target x86_64-apple-darwin -arch armv7m -dM -E %s | FileCheck %s
// RUN: %clang -target x86_64-apple-darwin -arch armv7em -dM -E %s | FileCheck %s
// CHECK-NOT: __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
// CHECK-NOT: __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__