r193328 - ARM-Darwin: Use the *-*-darwin-eabi triple for v6m & v7m archs
Tim Northover
tnorthover at apple.com
Thu Oct 24 03:48:50 PDT 2013
Author: tnorthover
Date: Thu Oct 24 05:48:50 2013
New Revision: 193328
URL: http://llvm.org/viewvc/llvm-project?rev=193328&view=rev
Log:
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.
Added:
cfe/trunk/test/Frontend/darwin-eabi.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/darwin-eabi.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=193328&r1=193327&r2=193328&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Oct 24 05:48:50 2013
@@ -149,7 +149,9 @@ static void getDarwinDefines(MacroBuilde
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
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=193328&r1=193327&r2=193328&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Oct 24 05:48:50 2013
@@ -167,10 +167,18 @@ std::string Darwin::ComputeEffectiveClan
if (!isTargetInitialized())
return Triple.getTriple();
- SmallString<16> Str;
- Str += isTargetIPhoneOS() ? "ios" : "macosx";
- Str += getTargetVersion().getAsString();
- Triple.setOSName(Str);
+ 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();
}
Modified: cfe/trunk/test/Driver/darwin-eabi.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-eabi.c?rev=193328&r1=193327&r2=193328&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-eabi.c (original)
+++ cfe/trunk/test/Driver/darwin-eabi.c Thu Oct 24 05:48:50 2013
@@ -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"
Added: cfe/trunk/test/Frontend/darwin-eabi.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/darwin-eabi.c?rev=193328&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/darwin-eabi.c (added)
+++ cfe/trunk/test/Frontend/darwin-eabi.c Thu Oct 24 05:48:50 2013
@@ -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__
More information about the cfe-commits
mailing list