]> granicus.if.org Git - clang/commitdiff
[AArch64] Define __ELF__ for aarch64-none-elf and other similar triples.
authorEli Friedman <efriedma@codeaurora.org>
Wed, 17 Oct 2018 21:07:11 +0000 (21:07 +0000)
committerEli Friedman <efriedma@codeaurora.org>
Wed, 17 Oct 2018 21:07:11 +0000 (21:07 +0000)
"aarch64-none-elf" is commonly used for AArch64 baremetal toolchains.

Differential Revision: https://reviews.llvm.org/D53348

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344710 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets/AArch64.cpp
test/Preprocessor/init.c

index 3444591ac593341b4df3211406ff57777a5fa214..b3a01ae25944fdf388f9cb6de309b1843606d0b1 100644 (file)
@@ -122,10 +122,9 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
                                          MacroBuilder &Builder) const {
   // Target identification.
   Builder.defineMacro("__aarch64__");
-  // For bare-metal none-eabi.
+  // For bare-metal.
   if (getTriple().getOS() == llvm::Triple::UnknownOS &&
-      (getTriple().getEnvironment() == llvm::Triple::EABI ||
-       getTriple().getEnvironment() == llvm::Triple::EABIHF))
+      getTriple().isOSBinFormatELF())
     Builder.defineMacro("__ELF__");
 
   // Target properties.
index fe53e815a3e1bf6d8c04266bcb65f8073977ca98..f5f46e23ecaa260b2dbdb721d7c46e20cb7676ee 100644 (file)
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-eabihf < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-none-eabi < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-none-eabihf < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-none-elf < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s
 // ARM-NONE-EABI: #define __ELF__ 1
 
 // No MachO targets use the full EABI, even if AAPCS is used.