From 512a33ebc086de94839fc3cc479d65c06d67370d Mon Sep 17 00:00:00 2001 From: Renato Golin Date: Fri, 27 Feb 2015 16:35:48 +0000 Subject: [PATCH] Add __ARM_DWARF_EH__ to signify the use of Itanium ABI for unwind instructions. Equally to NetBSD, Bitrig will be using .eh_frame unwinding on ARM. Patch by Patrick Wildt. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230763 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/Targets.cpp | 16 ++++++++++++++-- test/Preprocessor/init.c | 7 +++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 15a0a90674..6173b7b11f 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -471,6 +471,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(Triple) { @@ -3827,8 +3838,9 @@ class ARMTargetInfo : public TargetInfo { DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64; const llvm::Triple &T = getTriple(); - // size_t is unsigned long on MachO-derived environments and NetBSD. - if (T.isOSBinFormatMachO() || T.getOS() == llvm::Triple::NetBSD) + // size_t is unsigned long on MachO-derived environments, NetBSD and Bitrig. + if (T.isOSBinFormatMachO() || T.getOS() == llvm::Triple::NetBSD || + T.getOS() == llvm::Triple::Bitrig) SizeType = UnsignedLong; else SizeType = UnsignedInt; diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 5dc592126f..2bbdb9c8d1 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -2165,6 +2165,13 @@ // 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 +// ARM-BITRIG:#define __SIZEOF_SIZE_T__ 4 +// ARM-BITRIG:#define __SIZE_MAX__ 4294967295U +// ARM-BITRIG:#define __SIZE_TYPE__ long unsigned int +// ARM-BITRIG:#define __SIZE_WIDTH__ 32 + // 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 -- 2.40.0