[PATCH] Define __ARM_DWARF_EH__ on Bitrig/ARM

Patrick Wildt mail at patrick-wildt.de
Thu Feb 19 04:50:55 PST 2015


Hi,

Equally to NetBSD, Bitrig will be using .eh_frame unwinding on ARM.

Add __ARM_DWARF_EH__ to signify the use of Itanium ABI for unwind
instructions.

Best regards,
Patrick

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index f9da2bf..a9c9d29 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -472,6 +472,17 @@ protected:
     Builder.defineMacro("__ELF__");
     if (Opts.POSIXThreads)
       Builder.defineMacro("_REENTRANT");
+
+    switch (Triple.getArch()) {
+    default:
+      break;
+    case llvm::Triple::arm:
+    case llvm::Triple::armeb:
+    case llvm::Triple::thumb:
+    case llvm::Triple::thumbeb:
+      Builder.defineMacro("__ARM_DWARF_EH__");
+      break;
+    }
   }
 public:
   BitrigTargetInfo(const llvm::Triple &Triple) : OSTargetInfo<Target>(Triple) {
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index 41fe812..da18f15 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -2165,6 +2165,9 @@
 // ARM-DARWIN-NO-EABI-NOT: #define __ARM_EABI__ 1
 // ARM-DARWIN-EABI: #define __ARM_EABI__ 1
 
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=armv7-bitrig-gnueabihf < /dev/null | FileCheck -check-prefix ARM-BITRIG %s
+// ARM-BITRIG:#define __ARM_DWARF_EH__ 1
+
 // Check that -mhwdiv works properly for targets which don't have the hwdiv feature enabled by default.
 
 // RUN: %clang -target arm -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-ARM %s




More information about the cfe-commits mailing list