[Hexagon] Define __ELF__ by default.
authorSid Manning <sidneym@quicinc.com>
Fri, 21 Feb 2020 19:41:22 +0000 (13:41 -0600)
committerSid Manning <sidneym@quicinc.com>
Fri, 21 Feb 2020 22:10:31 +0000 (16:10 -0600)
Differential Revision: https://reviews.llvm.org/D74972

clang/lib/Basic/Targets/Hexagon.cpp
clang/test/Preprocessor/hexagon-predefines.c
compiler-rt/lib/builtins/CMakeLists.txt

index fcf9e9cff31da6da635eee3db7477639518ac109..205601c359d04b54a31df113fd0e77e3b63bc14d 100644 (file)
@@ -24,6 +24,8 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
   Builder.defineMacro("__qdsp6__", "1");
   Builder.defineMacro("__hexagon__", "1");
 
+  Builder.defineMacro("__ELF__");
+
   // The macro __HVXDBL__ is deprecated.
   bool DefineHvxDbl = false;
 
index fd33a66671702023345588e9b91560a767e9ab7f..5be8b96e290dc4f07007ffef39ed7ea0c35bb56b 100644 (file)
@@ -96,3 +96,8 @@
 // CHECK-V67HVX-128B: #define __HVX_LENGTH__ 128
 // CHECK-V67HVX-128B: #define __HVX__ 1
 // CHECK-V67HVX-128B: #define __hexagon__ 1
+
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv67 \
+// RUN: -target-feature +hvxv67 -target-feature +hvx-length128b %s | FileCheck \
+// RUN: %s -check-prefix CHECK-ELF
+// CHECK-ELF: #define __ELF__ 1
index 125a3a1b14762cd5e9462966b5e53dda5f45206c..21cac1c2353989789f843678b3fea679e023cf38 100644 (file)
@@ -492,7 +492,6 @@ set(armv7m_SOURCES ${arm_SOURCES})
 set(armv7em_SOURCES ${arm_SOURCES})
 
 # hexagon arch
-set(hexagon_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES})
 set(hexagon_SOURCES
   hexagon/common_entry_exit_abi1.S
   hexagon/common_entry_exit_abi2.S
@@ -524,6 +523,8 @@ set(hexagon_SOURCES
   hexagon/udivsi3.S
   hexagon/umoddi3.S
   hexagon/umodsi3.S
+  ${GENERIC_SOURCES}
+  ${GENERIC_TF_SOURCES}
 )