r191406 - Provide inline definitions of _Unwind_GetIP etc. for ARM in unwind.h

Hans Wennborg hans at hanshq.net
Wed Sep 25 15:34:04 PDT 2013


Author: hans
Date: Wed Sep 25 17:34:03 2013
New Revision: 191406

URL: http://llvm.org/viewvc/llvm-project?rev=191406&view=rev
Log:
Provide inline definitions of _Unwind_GetIP etc. for ARM in unwind.h

These symbols were showing up as undefined when trying to link programs on
Android. We should match libgcc's behaviour and provide inline definitions
of these on ARM.

It seems unwind.h on ARM/Darwin doesn't provide inline definitions, so we
just declare them for that platform.

Modified:
    cfe/trunk/lib/Headers/unwind.h

Modified: cfe/trunk/lib/Headers/unwind.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=191406&r1=191405&r2=191406&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/unwind.h (original)
+++ cfe/trunk/lib/Headers/unwind.h Wed Sep 25 17:34:03 2013
@@ -127,7 +127,7 @@ typedef _Unwind_Personality_Fn __persona
 typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
                                                 void *);
 
-#ifdef __arm__
+#if defined(__arm__) && !defined(__APPLE__)
 
 typedef enum {
   _UVRSC_CORE = 0,        /* integer register */
@@ -156,14 +156,46 @@ _Unwind_VRS_Result _Unwind_VRS_Get(struc
   _Unwind_VRS_DataRepresentation __representation,
   void *__valuep);
 
-#endif
+_Unwind_VRS_Result _Unwind_VRS_Set(struct _Unwind_Context *__context,
+  _Unwind_VRS_RegClass __regclass,
+  uint32_t __regno,
+  _Unwind_VRS_DataRepresentation __representation,
+  void *__valuep);
 
+static __inline__
+_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *__context, int __index) {
+  _Unwind_Word __value;
+  _Unwind_VRS_Get(__context, _UVRSC_CORE, __index, _UVRSD_UINT32, &__value);
+  return __value;
+}
+
+static __inline__
+void _Unwind_SetGR(struct _Unwind_Context *__context, int __index,
+                   _Unwind_Word __value) {
+  _Unwind_VRS_Set(__context, _UVRSC_CORE, __index, _UVRSD_UINT32, &__value);
+}
+
+static __inline__
+_Unwind_Word _Unwind_GetIP(struct _Unwind_Context *__context) {
+  _Unwind_Word __ip = _Unwind_GetGR(__context, 15);
+  return __ip & ~(_Unwind_Word)(0x1); /* Remove thumb mode bit. */
+}
+
+static __inline__
+void _Unwind_SetIP(struct _Unwind_Context *__context, _Unwind_Word __value) {
+  _Unwind_Word __thumb_mode_bit = _Unwind_GetGR(__context, 15) & 0x1;
+  _Unwind_SetGR(__context, 15, __value | __thumb_mode_bit);
+}
+#else
 _Unwind_Word _Unwind_GetGR(struct _Unwind_Context *, int);
 void _Unwind_SetGR(struct _Unwind_Context *, int, _Unwind_Word);
 
 _Unwind_Word _Unwind_GetIP(struct _Unwind_Context *);
-_Unwind_Word _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
 void _Unwind_SetIP(struct _Unwind_Context *, _Unwind_Word);
+#endif
+
+
+_Unwind_Word _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
 
 _Unwind_Word _Unwind_GetCFA(struct _Unwind_Context *);
 





More information about the cfe-commits mailing list