[PATCH] D19225: [ARM] predefines __ELF__ macro for arm-none-eabi
Weiming Zhao via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 18 09:05:21 PDT 2016
weimingz created this revision.
weimingz added reviewers: rengolin, silviu.baranga.
weimingz added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.
redefines __ELF__ macro for arm-none-eabi
http://reviews.llvm.org/D19225
Files:
lib/Basic/Targets.cpp
test/Preprocessor/init.c
Index: test/Preprocessor/init.c
===================================================================
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -2162,6 +2162,9 @@
// ARM-NETBSD:#define __arm 1
// ARM-NETBSD:#define __arm__ 1
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-eabi < /dev/null | FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s
+// ARM-NONE-EABI: #define __ELF__ 1
+
// RUN: %clang -target arm-apple-darwin-eabi -arch armv7s -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARM-DARWIN-NO-EABI %s
// RUN: %clang -target arm-apple-darwin-eabi -arch armv6m -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARM-DARWIN-EABI %s
// RUN: %clang -target arm-apple-darwin-eabi -arch armv7m -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=ARM-DARWIN-EABI %s
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4817,6 +4817,10 @@
// Target identification.
Builder.defineMacro("__arm");
Builder.defineMacro("__arm__");
+ // For bare-metal none-eabi.
+ if (getTriple().getOS() == llvm::Triple::UnknownOS &&
+ getTriple().getEnvironment() == llvm::Triple::EABI)
+ Builder.defineMacro("__ELF__");
// Target properties.
Builder.defineMacro("__REGISTER_PREFIX__", "");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19225.54070.patch
Type: text/x-patch
Size: 1404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160418/7125e759/attachment.bin>
More information about the cfe-commits
mailing list