From: Tim Northover Date: Thu, 24 Oct 2013 10:48:50 +0000 (+0000) Subject: ARM-Darwin: Use the *-*-darwin-eabi triple for v6m & v7m archs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66b5dac8b70229dfe7c7cc882de21b1265a6cdea;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193328 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 843cc1bbf8..4deaa640f8 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -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 diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index ec0d8f387c..d45966c459 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -167,10 +167,18 @@ std::string Darwin::ComputeEffectiveClangTriple(const ArgList &Args, 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(); } diff --git a/test/Driver/darwin-eabi.c b/test/Driver/darwin-eabi.c index 744e536a13..1288fa4060 100644 --- a/test/Driver/darwin-eabi.c +++ b/test/Driver/darwin-eabi.c @@ -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" diff --git a/test/Frontend/darwin-eabi.c b/test/Frontend/darwin-eabi.c new file mode 100644 index 0000000000..dc0504bd3c --- /dev/null +++ b/test/Frontend/darwin-eabi.c @@ -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__