AArch64_be specific clang target settings

llvm-svn: 203918
This commit is contained in:
Christian Pirker 2014-03-14 12:15:45 +00:00
parent f5164229f3
commit a74c7914ad
4 changed files with 36 additions and 3 deletions

View File

@ -1298,6 +1298,9 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
static const char *const AArch64LibDirs[] = { "/lib" };
static const char *const AArch64Triples[] = { "aarch64-none-linux-gnu",
"aarch64-linux-gnu" };
static const char *const AArch64beLibDirs[] = { "/lib" };
static const char *const AArch64beTriples[] = { "aarch64_be-none-linux-gnu",
"aarch64_be-linux-gnu" };
static const char *const ARMLibDirs[] = { "/lib" };
static const char *const ARMTriples[] = { "arm-linux-gnueabi",
@ -1366,7 +1369,6 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
switch (TargetTriple.getArch()) {
case llvm::Triple::aarch64:
case llvm::Triple::aarch64_be:
LibDirs.append(AArch64LibDirs,
AArch64LibDirs + llvm::array_lengthof(AArch64LibDirs));
TripleAliases.append(AArch64Triples,
@ -1376,6 +1378,16 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
BiarchTripleAliases.append(
AArch64Triples, AArch64Triples + llvm::array_lengthof(AArch64Triples));
break;
case llvm::Triple::aarch64_be:
LibDirs.append(AArch64beLibDirs,
AArch64beLibDirs + llvm::array_lengthof(AArch64beLibDirs));
TripleAliases.append(AArch64beTriples,
AArch64beTriples + llvm::array_lengthof(AArch64beTriples));
BiarchLibDirs.append(AArch64beLibDirs,
AArch64beLibDirs + llvm::array_lengthof(AArch64beLibDirs));
BiarchTripleAliases.append(
AArch64beTriples, AArch64beTriples + llvm::array_lengthof(AArch64beTriples));
break;
case llvm::Triple::arm:
case llvm::Triple::thumb:
LibDirs.append(ARMLibDirs, ARMLibDirs + llvm::array_lengthof(ARMLibDirs));
@ -2788,10 +2800,13 @@ static std::string getMultiarchTriple(const llvm::Triple &TargetTriple,
return "x86_64-linux-gnu";
return TargetTriple.str();
case llvm::Triple::aarch64:
case llvm::Triple::aarch64_be:
if (llvm::sys::fs::exists(SysRoot + "/lib/aarch64-linux-gnu"))
return "aarch64-linux-gnu";
return TargetTriple.str();
case llvm::Triple::aarch64_be:
if (llvm::sys::fs::exists(SysRoot + "/lib/aarch64_be-linux-gnu"))
return "aarch64_be-linux-gnu";
return TargetTriple.str();
case llvm::Triple::mips:
if (llvm::sys::fs::exists(SysRoot + "/lib/mips-linux-gnu"))
return "mips-linux-gnu";

View File

@ -6668,6 +6668,8 @@ static StringRef getLinuxDynamicLinker(const ArgList &Args,
return "/lib/ld-linux.so.2";
else if (ToolChain.getArch() == llvm::Triple::aarch64)
return "/lib/ld-linux-aarch64.so.1";
else if (ToolChain.getArch() == llvm::Triple::aarch64_be)
return "/lib/ld-linux-aarch64_be.so.1";
else if (ToolChain.getArch() == llvm::Triple::arm ||
ToolChain.getArch() == llvm::Triple::thumb) {
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
@ -6760,6 +6762,8 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("elf_i386");
else if (ToolChain.getArch() == llvm::Triple::aarch64)
CmdArgs.push_back("aarch64linux");
else if (ToolChain.getArch() == llvm::Triple::aarch64_be)
CmdArgs.push_back("aarch64_be_linux");
else if (ToolChain.getArch() == llvm::Triple::arm
|| ToolChain.getArch() == llvm::Triple::thumb)
CmdArgs.push_back("armelf_linux_eabi");

View File

@ -1,7 +1,11 @@
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -w -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -w -o - %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-LE %s
// RUN: %clang_cc1 -triple aarch64_be-none-linux-gnu -emit-llvm -w -o - %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-BE %s
// char by definition has size 1
// CHECK-LE: target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
// CHECK-BE: target datalayout = "E-m:e-i64:64-i128:128-n32:64-S128"
int check_short() {
return sizeof(short);
// CHECK: ret i32 2

View File

@ -8,3 +8,13 @@
// RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
// CA57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a57"
// RUN: %clang -target aarch64_be -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s
// GENERIC-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic"
// RUN: %clang -target aarch64_be -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s
// CA53-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a53"
// RUN: %clang -target aarch64_be -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s
// CA57-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a57"