sidneym created this revision.
sidneym added reviewers: kparzysz, bcain.
Herald added subscribers: Sanitizers, cfe-commits, mgorny.
Herald added projects: clang, Sanitizers, LLVM.

__ELF__ is not enabled by default.  Correcting an issue in compiler-rt's cmake 
revealed that __ELF__ was not defined.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74972

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


Index: compiler-rt/lib/builtins/CMakeLists.txt
===================================================================
--- compiler-rt/lib/builtins/CMakeLists.txt
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -492,7 +492,6 @@
 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 @@
   hexagon/udivsi3.S
   hexagon/umoddi3.S
   hexagon/umodsi3.S
+  ${GENERIC_SOURCES}
+  ${GENERIC_TF_SOURCES}
 )
 
 
Index: clang/test/Preprocessor/hexagon-predefines.c
===================================================================
--- clang/test/Preprocessor/hexagon-predefines.c
+++ clang/test/Preprocessor/hexagon-predefines.c
@@ -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: clang/lib/Basic/Targets/Hexagon.cpp
===================================================================
--- clang/lib/Basic/Targets/Hexagon.cpp
+++ clang/lib/Basic/Targets/Hexagon.cpp
@@ -24,6 +24,8 @@
   Builder.defineMacro("__qdsp6__", "1");
   Builder.defineMacro("__hexagon__", "1");
 
+  Builder.defineMacro("__ELF__");
+
   // The macro __HVXDBL__ is deprecated.
   bool DefineHvxDbl = false;
 


Index: compiler-rt/lib/builtins/CMakeLists.txt
===================================================================
--- compiler-rt/lib/builtins/CMakeLists.txt
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -492,7 +492,6 @@
 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 @@
   hexagon/udivsi3.S
   hexagon/umoddi3.S
   hexagon/umodsi3.S
+  ${GENERIC_SOURCES}
+  ${GENERIC_TF_SOURCES}
 )
 
 
Index: clang/test/Preprocessor/hexagon-predefines.c
===================================================================
--- clang/test/Preprocessor/hexagon-predefines.c
+++ clang/test/Preprocessor/hexagon-predefines.c
@@ -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: clang/lib/Basic/Targets/Hexagon.cpp
===================================================================
--- clang/lib/Basic/Targets/Hexagon.cpp
+++ clang/lib/Basic/Targets/Hexagon.cpp
@@ -24,6 +24,8 @@
   Builder.defineMacro("__qdsp6__", "1");
   Builder.defineMacro("__hexagon__", "1");
 
+  Builder.defineMacro("__ELF__");
+
   // The macro __HVXDBL__ is deprecated.
   bool DefineHvxDbl = false;
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D74972: [hexagon] Defi... Sid Manning via Phabricator via cfe-commits

Reply via email to