Author: rsingh Date: Fri Mar 31 10:28:06 2017 New Revision: 299225 URL: http://llvm.org/viewvc/llvm-project?rev=299225&view=rev Log: [libunwind] Clean up macro usage.
Convention in libunwind is to use !defined(FOOT) not !FOO. Differential Revision: https://reviews.llvm.org/D31078 Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/include/libunwind.h libunwind/trunk/include/unwind.h libunwind/trunk/src/AddressSpace.hpp libunwind/trunk/src/Unwind-EHABI.cpp libunwind/trunk/src/Unwind-EHABI.h libunwind/trunk/src/Unwind-sjlj.c libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/UnwindLevel1-gcc-ext.c libunwind/trunk/src/UnwindLevel1.c libunwind/trunk/src/Unwind_AppleExtras.cpp libunwind/trunk/src/config.h libunwind/trunk/src/libunwind.cpp libunwind/trunk/src/libunwind_ext.h Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Fri Mar 31 10:28:06 2017 @@ -12,14 +12,12 @@ #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ !defined(__ARM_DWARF_EH__) -#define _LIBUNWIND_ARM_EHABI 1 -#else -#define _LIBUNWIND_ARM_EHABI 0 +#define _LIBUNWIND_ARM_EHABI #endif #if defined(_LIBUNWIND_IS_NATIVE_ONLY) # if defined(__i386__) -# define _LIBUNWIND_TARGET_I386 1 +# define _LIBUNWIND_TARGET_I386 # define _LIBUNWIND_CONTEXT_SIZE 8 # define _LIBUNWIND_CURSOR_SIZE 19 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 9 @@ -57,7 +55,7 @@ # error "Unsupported architecture." # endif #else // !_LIBUNWIND_IS_NATIVE_ONLY -# define _LIBUNWIND_TARGET_I386 1 +# define _LIBUNWIND_TARGET_I386 # define _LIBUNWIND_TARGET_X86_64 1 # define _LIBUNWIND_TARGET_PPC 1 # define _LIBUNWIND_TARGET_AARCH64 1 Modified: libunwind/trunk/include/libunwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/include/libunwind.h (original) +++ libunwind/trunk/include/libunwind.h Fri Mar 31 10:28:06 2017 @@ -72,7 +72,7 @@ typedef struct unw_cursor_t unw_cursor_t typedef struct unw_addr_space *unw_addr_space_t; typedef int unw_regnum_t; -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) typedef uint32_t unw_word_t; typedef uint64_t unw_fpreg_t; #else Modified: libunwind/trunk/include/unwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/unwind.h?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/include/unwind.h (original) +++ libunwind/trunk/include/unwind.h Fri Mar 31 10:28:06 2017 @@ -36,7 +36,7 @@ typedef enum { _URC_HANDLER_FOUND = 6, _URC_INSTALL_CONTEXT = 7, _URC_CONTINUE_UNWIND = 8, -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) _URC_FAILURE = 9 #endif } _Unwind_Reason_Code; @@ -51,7 +51,7 @@ typedef enum { typedef struct _Unwind_Context _Unwind_Context; // opaque -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) typedef uint32_t _Unwind_State; static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0; @@ -168,7 +168,7 @@ extern void _Unwind_Resume(_Unwind_Excep #endif extern void _Unwind_DeleteException(_Unwind_Exception *exception_object); -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) typedef enum { _UVRSC_CORE = 0, /* integer register */ _UVRSC_VFP = 1, /* vfp */ @@ -208,7 +208,7 @@ _Unwind_VRS_Pop(_Unwind_Context *context _Unwind_VRS_DataRepresentation representation); #endif -#if !_LIBUNWIND_ARM_EHABI +#if !defined(_LIBUNWIND_ARM_EHABI) extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index); extern void _Unwind_SetGR(struct _Unwind_Context *context, int index, @@ -216,7 +216,7 @@ extern void _Unwind_SetGR(struct _Unwind extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context); extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value); -#else // _LIBUNWIND_ARM_EHABI +#else // defined(_LIBUNWIND_ARM_EHABI) #if defined(_LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE) #define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern @@ -255,7 +255,7 @@ void _Unwind_SetIP(struct _Unwind_Contex uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1); _Unwind_SetGR(context, 15, value | thumb_bit); } -#endif // _LIBUNWIND_ARM_EHABI +#endif // defined(_LIBUNWIND_ARM_EHABI) extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context); extern uintptr_t Modified: libunwind/trunk/src/AddressSpace.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/AddressSpace.hpp (original) +++ libunwind/trunk/src/AddressSpace.hpp Fri Mar 31 10:28:06 2017 @@ -39,24 +39,24 @@ namespace libunwind { /// Used by findUnwindSections() to return info about needed sections. struct UnwindInfoSections { -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND || _LIBUNWIND_SUPPORT_DWARF_INDEX || \ - _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) || defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) || \ + defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) // No dso_base for ARM EHABI. uintptr_t dso_base; #endif -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) uintptr_t dwarf_section; uintptr_t dwarf_section_length; #endif -#if _LIBUNWIND_SUPPORT_DWARF_INDEX +#if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) uintptr_t dwarf_index_section; uintptr_t dwarf_index_section_length; #endif -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) uintptr_t compact_unwind_section; uintptr_t compact_unwind_section_length; #endif -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) uintptr_t arm_section; uintptr_t arm_section_length; #endif @@ -313,14 +313,14 @@ LocalAddressSpace::getEncodedP(pint_t &a } #endif -#elif _LIBUNWIND_ARM_EHABI && defined(_LIBUNWIND_IS_BAREMETAL) +#elif defined(_LIBUNWIND_ARM_EHABI) && defined(_LIBUNWIND_IS_BAREMETAL) // When statically linked on bare-metal, the symbols for the EH table are looked // up without going through the dynamic loader. extern char __exidx_start; extern char __exidx_end; -#elif _LIBUNWIND_ARM_EHABI || _LIBUNWIND_SUPPORT_DWARF_UNWIND +#elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // ELF-based systems may use dl_iterate_phdr() to access sections // containing unwinding information. The ElfW() macro for pointer-size @@ -340,7 +340,7 @@ inline bool LocalAddressSpace::findUnwin dyld_unwind_sections dyldInfo; if (_dyld_find_unwind_sections((void *)targetAddr, &dyldInfo)) { info.dso_base = (uintptr_t)dyldInfo.mh; - #if _LIBUNWIND_SUPPORT_DWARF_UNWIND + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) info.dwarf_section = (uintptr_t)dyldInfo.dwarf_section; info.dwarf_section_length = dyldInfo.dwarf_section_length; #endif @@ -348,7 +348,7 @@ inline bool LocalAddressSpace::findUnwin info.compact_unwind_section_length = dyldInfo.compact_unwind_section_length; return true; } -#elif _LIBUNWIND_ARM_EHABI && defined(_LIBUNWIND_IS_BAREMETAL) +#elif defined(_LIBUNWIND_ARM_EHABI) && defined(_LIBUNWIND_IS_BAREMETAL) // Bare metal is statically linked, so no need to ask the dynamic loader info.arm_section = (uintptr_t)(&__exidx_start); info.arm_section_length = (uintptr_t)(&__exidx_end - &__exidx_start); @@ -356,7 +356,7 @@ inline bool LocalAddressSpace::findUnwin info.arm_section, info.arm_section_length); if (info.arm_section && info.arm_section_length) return true; -#elif _LIBUNWIND_ARM_EHABI || _LIBUNWIND_SUPPORT_DWARF_UNWIND +#elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) struct dl_iterate_cb_data { LocalAddressSpace *addressSpace; UnwindInfoSections *sects; @@ -384,8 +384,8 @@ inline bool LocalAddressSpace::findUnwin typedef ElfW(Phdr) Elf_Phdr; #endif - #if _LIBUNWIND_SUPPORT_DWARF_UNWIND - #if !_LIBUNWIND_SUPPORT_DWARF_INDEX + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) + #if !defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) #error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires _LIBUNWIND_SUPPORT_DWARF_INDEX on this platform." #endif size_t object_length; @@ -418,7 +418,7 @@ inline bool LocalAddressSpace::findUnwin } else { return false; } - #else // _LIBUNWIND_ARM_EHABI + #else // defined(_LIBUNWIND_ARM_EHABI) for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) { const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i]; if (phdr->p_type == PT_LOAD) { Modified: libunwind/trunk/src/Unwind-EHABI.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-EHABI.cpp?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/Unwind-EHABI.cpp (original) +++ libunwind/trunk/src/Unwind-EHABI.cpp Fri Mar 31 10:28:06 2017 @@ -12,7 +12,7 @@ #include "Unwind-EHABI.h" -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) #include <stdbool.h> #include <stdint.h> @@ -987,4 +987,4 @@ __gnu_unwind_frame(_Unwind_Exception *ex return _URC_OK; } -#endif // _LIBUNWIND_ARM_EHABI +#endif // defined(_LIBUNWIND_ARM_EHABI) Modified: libunwind/trunk/src/Unwind-EHABI.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-EHABI.h?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/Unwind-EHABI.h (original) +++ libunwind/trunk/src/Unwind-EHABI.h Fri Mar 31 10:28:06 2017 @@ -13,7 +13,7 @@ #include <__libunwind_config.h> -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) #include <stdint.h> #include <unwind.h> @@ -46,6 +46,6 @@ extern _Unwind_Reason_Code __aeabi_unwin } // extern "C" #endif -#endif // _LIBUNWIND_ARM_EHABI +#endif // defined(_LIBUNWIND_ARM_EHABI) #endif // __UNWIND_EHABI_H__ Modified: libunwind/trunk/src/Unwind-sjlj.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/Unwind-sjlj.c (original) +++ libunwind/trunk/src/Unwind-sjlj.c Fri Mar 31 10:28:06 2017 @@ -32,7 +32,7 @@ // function also sets the personality and lsda fields of the block. // -#if _LIBUNWIND_BUILD_SJLJ_APIS +#if defined(_LIBUNWIND_BUILD_SJLJ_APIS) struct _Unwind_FunctionContext { // next function in stack of handlers @@ -465,4 +465,4 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetC return 0; } -#endif // _LIBUNWIND_BUILD_SJLJ_APIS +#endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS) Modified: libunwind/trunk/src/UnwindCursor.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/UnwindCursor.hpp (original) +++ libunwind/trunk/src/UnwindCursor.hpp Fri Mar 31 10:28:06 2017 @@ -38,7 +38,7 @@ namespace libunwind { -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) /// Cache of recently found FDEs. template <typename A> class _LIBUNWIND_HIDDEN DwarfFDECache { @@ -180,12 +180,12 @@ void DwarfFDECache<A>::iterateCacheEntri } _LIBUNWIND_LOG_NON_ZERO(::pthread_rwlock_unlock(&_lock)); } -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) #define arrayoffsetof(type, index, field) ((size_t)(&((type *)0)[index].field)) -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) template <typename A> class UnwindSectionHeader { public: UnwindSectionHeader(A &addressSpace, typename A::pint_t addr) @@ -373,7 +373,7 @@ private: A &_addressSpace; typename A::pint_t _addr; }; -#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) class _LIBUNWIND_HIDDEN AbstractUnwindCursor { public: @@ -446,7 +446,7 @@ public: private: -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) bool getInfoFromEHABISection(pint_t pc, const UnwindInfoSections §s); int stepWithEHABI() { @@ -464,7 +464,7 @@ private: } #endif -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) bool getInfoFromDwarfSection(pint_t pc, const UnwindInfoSections §s, uint32_t fdeSectionOffsetHint=0); int stepWithDwarfFDE() { @@ -475,11 +475,11 @@ private: } #endif -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) bool getInfoFromCompactEncodingSection(pint_t pc, const UnwindInfoSections §s); int stepWithCompactEncoding() { - #if _LIBUNWIND_SUPPORT_DWARF_UNWIND + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) if ( compactSaysUseDwarf() ) return stepWithDwarfFDE(); #endif @@ -557,9 +557,9 @@ private: return false; } #endif -#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) compact_unwind_encoding_t dwarfEncoding() const { R dummy; return dwarfEncoding(dummy); @@ -594,7 +594,7 @@ private: return 0; } #endif -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) A &_addressSpace; @@ -672,7 +672,7 @@ template <typename A, typename R> bool U return _isSignalFrame; } -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) struct EHABIIndexEntry { uint32_t functionOffset; uint32_t data; @@ -868,7 +868,7 @@ bool UnwindCursor<A, R>::getInfoFromEHAB } #endif -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) template <typename A, typename R> bool UnwindCursor<A, R>::getInfoFromDwarfSection(pint_t pc, const UnwindInfoSections §s, @@ -884,7 +884,7 @@ bool UnwindCursor<A, R>::getInfoFromDwar sects.dwarf_section + fdeSectionOffsetHint, &fdeInfo, &cieInfo); } -#if _LIBUNWIND_SUPPORT_DWARF_INDEX +#if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) if (!foundFDE && (sects.dwarf_index_section != 0)) { foundFDE = EHHeaderParser<A>::findFDE( _addressSpace, pc, sects.dwarf_index_section, @@ -927,7 +927,7 @@ bool UnwindCursor<A, R>::getInfoFromDwar // Add to cache (to make next lookup faster) if we had no hint // and there was no index. if (!foundInCache && (fdeSectionOffsetHint == 0)) { - #if _LIBUNWIND_SUPPORT_DWARF_INDEX + #if defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) if (sects.dwarf_index_section == 0) #endif DwarfFDECache<A>::add(sects.dso_base, fdeInfo.pcStart, fdeInfo.pcEnd, @@ -939,10 +939,10 @@ bool UnwindCursor<A, R>::getInfoFromDwar //_LIBUNWIND_DEBUG_LOG("can't find/use FDE for pc=0x%llX", (uint64_t)pc); return false; } -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) template <typename A, typename R> bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(pint_t pc, const UnwindInfoSections §s) { @@ -1196,13 +1196,13 @@ bool UnwindCursor<A, R>::getInfoFromComp _info.extra = sects.dso_base; return true; } -#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) template <typename A, typename R> void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) { pint_t pc = (pint_t)this->getReg(UNW_REG_IP); -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) // Remove the thumb bit so the IP represents the actual instruction address. // This matches the behaviour of _Unwind_GetIP on arm. pc &= (pint_t)~0x1; @@ -1219,11 +1219,11 @@ void UnwindCursor<A, R>::setInfoBasedOnI // Ask address space object to find unwind sections for this pc. UnwindInfoSections sects; if (_addressSpace.findUnwindSections(pc, sects)) { -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) // If there is a compact unwind encoding table, look there first. if (sects.compact_unwind_section != 0) { if (this->getInfoFromCompactEncodingSection(pc, sects)) { - #if _LIBUNWIND_SUPPORT_DWARF_UNWIND + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // Found info in table, done unless encoding says to use dwarf. uint32_t dwarfOffset; if ((sects.dwarf_section != 0) && compactSaysUseDwarf(&dwarfOffset)) { @@ -1240,9 +1240,9 @@ void UnwindCursor<A, R>::setInfoBasedOnI return; } } -#endif // _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // If there is dwarf unwind info, look there next. if (sects.dwarf_section != 0) { if (this->getInfoFromDwarfSection(pc, sects)) { @@ -1252,14 +1252,14 @@ void UnwindCursor<A, R>::setInfoBasedOnI } #endif -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) // If there is ARM EHABI unwind info, look there next. if (sects.arm_section != 0 && this->getInfoFromEHABISection(pc, sects)) return; #endif } -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // There is no static unwind info for this pc. Look to see if an FDE was // dynamically registered for it. pint_t cachedFDE = DwarfFDECache<A>::findFDE(0, pc); @@ -1318,7 +1318,7 @@ void UnwindCursor<A, R>::setInfoBasedOnI } } } -#endif // #if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) // no unwind info, flag that we can't reliably unwind _unwindInfoMissing = true; @@ -1332,11 +1332,11 @@ int UnwindCursor<A, R>::step() { // Use unwinding info to modify register set as if function returned. int result; -#if _LIBUNWIND_SUPPORT_COMPACT_UNWIND +#if defined(_LIBUNWIND_SUPPORT_COMPACT_UNWIND) result = this->stepWithCompactEncoding(); -#elif _LIBUNWIND_SUPPORT_DWARF_UNWIND +#elif defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) result = this->stepWithDwarfFDE(); -#elif _LIBUNWIND_ARM_EHABI +#elif defined(_LIBUNWIND_ARM_EHABI) result = this->stepWithEHABI(); #else #error Need _LIBUNWIND_SUPPORT_COMPACT_UNWIND or \ Modified: libunwind/trunk/src/UnwindLevel1-gcc-ext.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindLevel1-gcc-ext.c?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/UnwindLevel1-gcc-ext.c (original) +++ libunwind/trunk/src/UnwindLevel1-gcc-ext.c Fri Mar 31 10:28:06 2017 @@ -23,12 +23,12 @@ #include "Unwind-EHABI.h" #include "unwind.h" -#if _LIBUNWIND_BUILD_ZERO_COST_APIS +#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) /// Called by __cxa_rethrow(). _LIBUNWIND_EXPORT _Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) { -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld", (void *)exception_object, (long)exception_object->unwinder_cache.reserved1); @@ -38,7 +38,7 @@ _Unwind_Resume_or_Rethrow(_Unwind_Except (long)exception_object->private_1); #endif -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) // _Unwind_RaiseException on EHABI will always set the reserved1 field to 0, // which is in the same position as private_1 below. return _Unwind_RaiseException(exception_object); @@ -111,7 +111,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callb _LIBUNWIND_TRACE_API("_Unwind_Backtrace(callback=%p)", (void *)(uintptr_t)callback); -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) // Create a mock exception object for force unwinding. _Unwind_Exception ex; memset(&ex, '\0', sizeof(ex)); @@ -122,7 +122,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callb while (true) { _Unwind_Reason_Code result; -#if !_LIBUNWIND_ARM_EHABI +#if !defined(_LIBUNWIND_ARM_EHABI) // ask libunwind to get next frame (skip over first frame which is // _Unwind_Backtrace()) if (unw_step(&cursor) <= 0) { @@ -154,7 +154,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callb _URC_CONTINUE_UNWIND) { return _URC_END_OF_STACK; } -#endif // _LIBUNWIND_ARM_EHABI +#endif // defined(_LIBUNWIND_ARM_EHABI) // debugging if (_LIBUNWIND_TRACING_UNWINDING) { @@ -222,7 +222,7 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetI return _Unwind_GetIP(context); } -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) /// Called by programs with dynamic code generators that want /// to register a dynamically generated FDE. @@ -252,7 +252,7 @@ _LIBUNWIND_EXPORT void __deregister_fram // applications working. We also add the not in 10.6 symbol so that nwe // application won't be able to use them. -#if _LIBUNWIND_SUPPORT_FRAME_APIS +#if defined(_LIBUNWIND_SUPPORT_FRAME_APIS) _LIBUNWIND_EXPORT void __register_frame_info_bases(const void *fde, void *ob, void *tb, void *db) { (void)fde; @@ -309,8 +309,8 @@ _LIBUNWIND_EXPORT void *__deregister_fra // do nothing, this function never worked in Mac OS X return NULL; } -#endif // _LIBUNWIND_SUPPORT_FRAME_APIS +#endif // defined(_LIBUNWIND_SUPPORT_FRAME_APIS) -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) -#endif // _LIBUNWIND_BUILD_ZERO_COST_APIS +#endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) Modified: libunwind/trunk/src/UnwindLevel1.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindLevel1.c?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/UnwindLevel1.c (original) +++ libunwind/trunk/src/UnwindLevel1.c Fri Mar 31 10:28:06 2017 @@ -30,7 +30,7 @@ #include "unwind.h" #include "config.h" -#if !_LIBUNWIND_ARM_EHABI +#if !defined(_LIBUNWIND_ARM_EHABI) static _Unwind_Reason_Code unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { @@ -503,4 +503,4 @@ _LIBUNWIND_EXPORT void _Unwind_SetIP(str unw_set_reg(cursor, UNW_REG_IP, value); } -#endif // !_LIBUNWIND_ARM_EHABI +#endif // !defined(_LIBUNWIND_ARM_EHABI) Modified: libunwind/trunk/src/Unwind_AppleExtras.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind_AppleExtras.cpp?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/Unwind_AppleExtras.cpp (original) +++ libunwind/trunk/src/Unwind_AppleExtras.cpp Fri Mar 31 10:28:06 2017 @@ -77,7 +77,7 @@ struct libgcc_object_info { #endif -#if _LIBUNWIND_BUILD_ZERO_COST_APIS +#if defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) // // symbols in libSystem.dylib in 10.6 and later, but are in libgcc_s.dylib in @@ -116,12 +116,12 @@ NEVER_HERE(__register_frame_table) NEVER_HERE(__deregister_frame_info) NEVER_HERE(__deregister_frame_info_bases) -#endif // _LIBUNWIND_BUILD_ZERO_COST_APIS +#endif // defined(_LIBUNWIND_BUILD_ZERO_COST_APIS) -#if _LIBUNWIND_BUILD_SJLJ_APIS +#if defined(_LIBUNWIND_BUILD_SJLJ_APIS) // // symbols in libSystem.dylib in iOS 5.0 and later, but are in libgcc_s.dylib in // earlier versions @@ -141,7 +141,7 @@ NOT_HERE_BEFORE_5_0(_Unwind_SjLj_RaiseEx NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Resume_or_Rethrow) NOT_HERE_BEFORE_5_0(_Unwind_SjLj_Unregister) -#endif // _LIBUNWIND_BUILD_SJLJ_APIS +#endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS) namespace libunwind { @@ -184,7 +184,7 @@ bool checkKeyMgrRegisteredFDEs(uintptr_t } -#if !defined(FOR_DYLD) && _LIBUNWIND_BUILD_SJLJ_APIS +#if !defined(FOR_DYLD) && defined(_LIBUNWIND_BUILD_SJLJ_APIS) #ifndef _LIBUNWIND_HAS_NO_THREADS #include <System/pthread_machdep.h> Modified: libunwind/trunk/src/config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/config.h (original) +++ libunwind/trunk/src/config.h Fri Mar 31 10:28:06 2017 @@ -32,23 +32,15 @@ // Platform specific configuration defines. #ifdef __APPLE__ #if defined(FOR_DYLD) - #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1 - #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0 - #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0 + #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND #else - #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1 + #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 - #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0 #endif #else #if defined(__ARM_DWARF_EH__) || !defined(__arm__) - #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0 #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1 #define _LIBUNWIND_SUPPORT_DWARF_INDEX 1 - #else - #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 0 - #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 0 - #define _LIBUNWIND_SUPPORT_DWARF_INDEX 0 #endif #endif @@ -57,15 +49,11 @@ #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden"))) #if (defined(__APPLE__) && defined(__arm__)) || defined(__USING_SJLJ_EXCEPTIONS__) -#define _LIBUNWIND_BUILD_SJLJ_APIS 1 -#else -#define _LIBUNWIND_BUILD_SJLJ_APIS 0 +#define _LIBUNWIND_BUILD_SJLJ_APIS #endif #if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) -#define _LIBUNWIND_SUPPORT_FRAME_APIS 1 -#else -#define _LIBUNWIND_SUPPORT_FRAME_APIS 0 +#define _LIBUNWIND_SUPPORT_FRAME_APIS #endif #if defined(__i386__) || defined(__x86_64__) || \ @@ -73,9 +61,7 @@ (!defined(__APPLE__) && defined(__arm__)) || \ (defined(__arm64__) || defined(__aarch64__)) || \ (defined(__APPLE__) && defined(__mips__)) -#define _LIBUNWIND_BUILD_ZERO_COST_APIS 1 -#else -#define _LIBUNWIND_BUILD_ZERO_COST_APIS 0 +#define _LIBUNWIND_BUILD_ZERO_COST_APIS #endif #if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL) Modified: libunwind/trunk/src/libunwind.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/libunwind.cpp?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/libunwind.cpp (original) +++ libunwind/trunk/src/libunwind.cpp Fri Mar 31 10:28:06 2017 @@ -54,7 +54,7 @@ _LIBUNWIND_EXPORT int unw_init_local(unw # define REGISTER_KIND Registers_ppc #elif defined(__aarch64__) # define REGISTER_KIND Registers_arm64 -#elif _LIBUNWIND_ARM_EHABI +#elif defined(_LIBUNWIND_ARM_EHABI) # define REGISTER_KIND Registers_arm #elif defined(__or1k__) # define REGISTER_KIND Registers_or1k @@ -207,7 +207,7 @@ _LIBUNWIND_EXPORT int unw_get_fpreg(unw_ /// Set value of specified float register at cursor position in stack frame. _LIBUNWIND_EXPORT int unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum, unw_fpreg_t value) { -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) _LIBUNWIND_TRACE_API("unw_set_fpreg(cursor=%p, regNum=%d, value=%llX)", static_cast<void *>(cursor), regNum, value); #else @@ -306,7 +306,7 @@ _LIBUNWIND_EXPORT void unw_save_vfp_as_X #endif -#if _LIBUNWIND_SUPPORT_DWARF_UNWIND +#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) /// SPI: walks cached DWARF entries _LIBUNWIND_EXPORT void unw_iterate_dwarf_unwind_cache(void (*func)( unw_word_t ip_start, unw_word_t ip_end, unw_word_t fde, unw_word_t mh)) { @@ -340,7 +340,7 @@ void _unw_remove_dynamic_fde(unw_word_t // fde is own mh_group DwarfFDECache<LocalAddressSpace>::removeAllIn((LocalAddressSpace::pint_t)fde); } -#endif // _LIBUNWIND_SUPPORT_DWARF_UNWIND +#endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) Modified: libunwind/trunk/src/libunwind_ext.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/libunwind_ext.h?rev=299225&r1=299224&r2=299225&view=diff ============================================================================== --- libunwind/trunk/src/libunwind_ext.h (original) +++ libunwind/trunk/src/libunwind_ext.h Fri Mar 31 10:28:06 2017 @@ -33,7 +33,7 @@ extern void unw_iterate_dwarf_unwind_cac extern void _unw_add_dynamic_fde(unw_word_t fde); extern void _unw_remove_dynamic_fde(unw_word_t fde); -#if _LIBUNWIND_ARM_EHABI +#if defined(_LIBUNWIND_ARM_EHABI) extern const uint32_t* decode_eht_entry(const uint32_t*, size_t*, size_t*); extern _Unwind_Reason_Code _Unwind_VRS_Interpret(_Unwind_Context *context, const uint32_t *data, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits