Add basic aarch64-none-elf bare metal driver.

Differential Revision: https://reviews.llvm.org/D111134
This commit is contained in:
Kristof Beyls 2021-10-05 09:24:10 +01:00
parent 86a5c32616
commit 3b93dc6880
3 changed files with 27 additions and 2 deletions

View File

@ -125,6 +125,20 @@ static bool isARMBareMetal(const llvm::Triple &Triple) {
return true;
}
/// Is the triple aarch64-none-elf?
static bool isAArch64BareMetal(const llvm::Triple &Triple) {
if (Triple.getArch() != llvm::Triple::aarch64)
return false;
if (Triple.getVendor() != llvm::Triple::UnknownVendor)
return false;
if (Triple.getOS() != llvm::Triple::UnknownOS)
return false;
return Triple.getEnvironmentName() == "elf";
}
static bool isRISCVBareMetal(const llvm::Triple &Triple) {
if (Triple.getArch() != llvm::Triple::riscv32 &&
Triple.getArch() != llvm::Triple::riscv64)
@ -151,7 +165,8 @@ void BareMetal::findMultilibs(const Driver &D, const llvm::Triple &Triple,
}
bool BareMetal::handlesTarget(const llvm::Triple &Triple) {
return isARMBareMetal(Triple) || isRISCVBareMetal(Triple);
return isARMBareMetal(Triple) || isAArch64BareMetal(Triple) ||
isRISCVBareMetal(Triple);
}
Tool *BareMetal::buildLinker() const {

View File

@ -102,6 +102,16 @@
// RUN: | FileCheck %s --check-prefix=CHECK-SYSROOT-INC
// CHECK-SYSROOT-INC-NOT: "-internal-isystem" "include"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target aarch64-none-elf \
// RUN: | FileCheck --check-prefix=CHECK-AARCH64-NO-HOST-INC %s
// Verify that the bare metal driver does not include any host system paths:
// CHECK-AARCH64-NO-HOST-INC: InstalledDir: [[INSTALLEDDIR:.+]]
// CHECK-AARCH64-NO-HOST-INC: "-resource-dir" "[[RESOURCE:[^"]+]]"
// CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[INSTALLEDDIR]]/../lib/clang-runtimes/aarch64-none-elf/include/c++/v1"
// CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[RESOURCE]]/include"
// CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[INSTALLEDDIR]]/../lib/clang-runtimes/aarch64-none-elf/include"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target riscv64-unknown-elf \
// RUN: -L some/directory/user/asked/for \

View File

@ -1,4 +1,4 @@
// RUN: %clang -### %s -target aarch64-none-elf \
// RUN: %clang -### %s -target x86-none-elf \
// RUN: --coverage -e _start -fuse-ld=lld --ld-path=ld -nostartfiles \
// RUN: -nostdlib -r -rdynamic -specs=nosys.specs -static -static-pie \
// RUN: 2>&1 | FileCheck --check-prefix=FORWARD %s