[libcxxabi] r219629 - Correctly export _Unwind_[GS]et(GR|IP) for EHABI.

Dan Albert danalbert at google.com
Mon Oct 13 14:01:30 PDT 2014


Author: danalbert
Date: Mon Oct 13 16:01:30 2014
New Revision: 219629

URL: http://llvm.org/viewvc/llvm-project?rev=219629&view=rev
Log:
Correctly export _Unwind_[GS]et(GR|IP) for EHABI.

These need to have normal linkage instead of being static inline as
many libraries expect to be able to declare these and have the linker
find them rather than needing to include the header.

http://mentorembedded.github.io/cxx-abi/abi-eh.html

Also clean up some warnings while I'm here.

Reviewers: jroelofs, kledzik

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5754

Modified:
    libcxxabi/trunk/include/unwind.h
    libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp
    libcxxabi/trunk/src/Unwind/UnwindCursor.hpp
    libcxxabi/trunk/src/Unwind/UnwindLevel1-gcc-ext.c

Modified: libcxxabi/trunk/include/unwind.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/unwind.h?rev=219629&r1=219628&r2=219629&view=diff
==============================================================================
--- libcxxabi/trunk/include/unwind.h (original)
+++ libcxxabi/trunk/include/unwind.h Mon Oct 13 16:01:30 2014
@@ -206,37 +206,13 @@ extern _Unwind_VRS_Result
 _Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
                 uint32_t discriminator,
                 _Unwind_VRS_DataRepresentation representation);
+#endif
 
-static inline uintptr_t _Unwind_GetGR(struct _Unwind_Context* context,
-                                      int index) {
-  uintptr_t value = 0;
-  _Unwind_VRS_Get(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);
-  return value;
-}
-
-static inline void _Unwind_SetGR(struct _Unwind_Context* context, int index,
-                                 uintptr_t new_value) {
-  _Unwind_VRS_Set(context, _UVRSC_CORE, (uint32_t)index,
-                  _UVRSD_UINT32, &new_value);
-}
-
-static inline uintptr_t _Unwind_GetIP(struct _Unwind_Context* context) {
-  // remove the thumb-bit before returning
-  return (_Unwind_GetGR(context, 15) & (~(uintptr_t)0x1));
-}
-
-static inline void _Unwind_SetIP(struct _Unwind_Context* context,
-                                 uintptr_t new_value) {
-  uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1);
-  _Unwind_SetGR(context, 15, new_value | thumb_bit);
-}
-#else
 extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index);
 extern void _Unwind_SetGR(struct _Unwind_Context *context, int index,
                           uintptr_t new_value);
 extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context);
 extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value);
-#endif
 
 extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context);
 extern uintptr_t

Modified: libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp?rev=219629&r1=219628&r2=219629&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp (original)
+++ libcxxabi/trunk/src/Unwind/Unwind-EHABI.cpp Mon Oct 13 16:01:30 2014
@@ -206,6 +206,28 @@ uint32_t RegisterRange(uint8_t start, ui
 
 } // end anonymous namespace
 
+uintptr_t _Unwind_GetGR(struct _Unwind_Context* context, int index) {
+  uintptr_t value = 0;
+  _Unwind_VRS_Get(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value);
+  return value;
+}
+
+void _Unwind_SetGR(struct _Unwind_Context* context, int index, uintptr_t
+    new_value) {
+  _Unwind_VRS_Set(context, _UVRSC_CORE, (uint32_t)index,
+                  _UVRSD_UINT32, &new_value);
+}
+
+uintptr_t _Unwind_GetIP(struct _Unwind_Context* context) {
+  // remove the thumb-bit before returning
+  return (_Unwind_GetGR(context, 15) & (~(uintptr_t)0x1));
+}
+
+void _Unwind_SetIP(struct _Unwind_Context* context, uintptr_t new_value) {
+  uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1);
+  _Unwind_SetGR(context, 15, new_value | thumb_bit);
+}
+
 /**
  * Decodes an EHT entry.
  *

Modified: libcxxabi/trunk/src/Unwind/UnwindCursor.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindCursor.hpp?rev=219629&r1=219628&r2=219629&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindCursor.hpp (original)
+++ libcxxabi/trunk/src/Unwind/UnwindCursor.hpp Mon Oct 13 16:01:30 2014
@@ -638,7 +638,7 @@ struct EHABISectionIterator {
   }
 
   EHABISectionIterator(A& addressSpace, const UnwindInfoSections& sects, size_t i)
-      : _addressSpace(&addressSpace), _sects(&sects), _i(i) {}
+      : _i(i), _addressSpace(&addressSpace), _sects(&sects) {}
 
   _Self& operator++() { ++_i; return *this; }
   _Self& operator+=(size_t a) { _i += a; return *this; }

Modified: libcxxabi/trunk/src/Unwind/UnwindLevel1-gcc-ext.c
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindLevel1-gcc-ext.c?rev=219629&r1=219628&r2=219629&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindLevel1-gcc-ext.c (original)
+++ libcxxabi/trunk/src/Unwind/UnwindLevel1-gcc-ext.c Mon Oct 13 16:01:30 2014
@@ -130,7 +130,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callb
     struct _Unwind_Context *context = (struct _Unwind_Context *)&cursor;
     size_t off;
     size_t len;
-    uint32_t* unwindInfo = (uint32_t *) frameInfo.unwind_info;
+    const uint32_t* unwindInfo = (uint32_t *) frameInfo.unwind_info;
     unwindInfo = decode_eht_entry(unwindInfo, &off, &len);
     if (unwindInfo == NULL) {
       return _URC_FAILURE;





More information about the cfe-commits mailing list