From 1ed1a594e9befc91ebf00d81b41a2fdfab862657 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 16 Jun 2010 19:01:17 +0000 Subject: [PATCH] Change the test for which ABI/CC to use on ARM to be base on the environment (the last argument of the triple). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106131 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetInfo.cpp | 7 ++++--- lib/Driver/Tools.cpp | 17 +++++------------ test/CodeGen/builtin-attributes.c | 2 +- test/CodeGenCXX/arm-cc.cpp | 2 +- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 608929270d..1de0ebc41c 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -1778,10 +1778,11 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI, ASTContext &Context, const llvm::Triple &Triple(Context.Target.getTriple()); llvm::CallingConv::ID DefaultCC; - if (Triple.getOS() == llvm::Triple::Darwin) - DefaultCC = llvm::CallingConv::ARM_APCS; - else + if (Triple.getEnvironmentName() == "gnueabi" || + Triple.getEnvironmentName() == "eabi") DefaultCC = llvm::CallingConv::ARM_AAPCS; + else + DefaultCC = llvm::CallingConv::ARM_APCS; switch (getABIKind()) { case APCS: diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 0a88d9f979..ae197fbeba 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -394,20 +394,13 @@ void Clang::AddARMTargetArgs(const ArgList &Args, ABIName = A->getValue(Args); } else { // Select the default based on the platform. - switch (getToolChain().getTriple().getOS()) { - // FIXME: Is this right for non-Darwin and non-Linux? - default: + llvm::StringRef env = getToolChain().getTriple().getEnvironmentName(); + if (env == "gnueabi") + ABIName = "aapcs-linux"; + else if (env == "eabi") ABIName = "aapcs"; - break; - - case llvm::Triple::Darwin: + else ABIName = "apcs-gnu"; - break; - - case llvm::Triple::Linux: - ABIName = "aapcs-linux"; - break; - } } CmdArgs.push_back("-target-abi"); CmdArgs.push_back(ABIName); diff --git a/test/CodeGen/builtin-attributes.c b/test/CodeGen/builtin-attributes.c index 6f13239bf6..afde3fab84 100644 --- a/test/CodeGen/builtin-attributes.c +++ b/test/CodeGen/builtin-attributes.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple arm-unknown-unknown -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm-unknown-linux-gnueabi -emit-llvm -o - %s | FileCheck %s // CHECK: declare i32 @printf(i8*, ...) void f0() { diff --git a/test/CodeGenCXX/arm-cc.cpp b/test/CodeGenCXX/arm-cc.cpp index a81c44d089..6027746b9a 100644 --- a/test/CodeGenCXX/arm-cc.cpp +++ b/test/CodeGenCXX/arm-cc.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple=arm-linux-gnueabi -target-abi aapcs -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=arm-unknown-linux-gnueabi -target-abi aapcs -emit-llvm -o - | FileCheck %s class SMLoc { const char *Ptr; -- 2.40.0