]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: unwind-arm.h: Make _Unwind_GetIP...
authorAndreas Tobler <andreast@gcc.gnu.org>
Fri, 19 May 2017 18:39:54 +0000 (20:39 +0200)
committerAndreas Tobler <andreast@gcc.gnu.org>
Fri, 19 May 2017 18:39:54 +0000 (20:39 +0200)
2017-05-19  Andreas Tobler  <andreast@gcc.gnu.org>

    Backport from mainline
    2017-05-17  Andreas Tobler  <andreast@gcc.gnu.org>

    * config/arm/unwind-arm.h: Make _Unwind_GetIP, _Unwind_GetIPInfo and
    _Unwind_SetIP available as functions for arm*-*-freebsd*.
    * config/arm/unwind-arm.c: Implement the above.

From-SVN: r248301

libgcc/ChangeLog
libgcc/config/arm/unwind-arm.c
libgcc/config/arm/unwind-arm.h

index f161d8fb2f2106da8fc135e270c7f2cce824bdf8..2a13b0d11e27ff87461ad9433e6e1ef08625d9d4 100644 (file)
@@ -1,3 +1,12 @@
+2017-05-19  Andreas Tobler  <andreast@gcc.gnu.org>
+
+       Backport from mainline
+       2017-05-17  Andreas Tobler  <andreast@gcc.gnu.org>
+
+       * config/arm/unwind-arm.h: Make _Unwind_GetIP, _Unwind_GetIPInfo and
+       _Unwind_SetIP available as functions for arm*-*-freebsd*.
+       * config/arm/unwind-arm.c: Implement the above.
+
 2017-05-15  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        * config/sparc/lb1spc.S [__ELF__ && __linux__]: Emit .note.GNU-stack
index 91b878acd29fa17610b5bb475e13d9ecf327d3a6..d0cf9214fa6b981d8f6339b41d9fba977553c6d4 100644 (file)
@@ -509,3 +509,25 @@ __aeabi_unwind_cpp_pr2 (_Unwind_State state,
 {
   return __gnu_unwind_pr_common (state, ucbp, context, 2);
 }
+
+#ifdef __FreeBSD__
+/* FreeBSD expects these to be functions */
+inline _Unwind_Ptr
+_Unwind_GetIP (struct _Unwind_Context *context)
+{
+  return _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1;
+}
+
+inline _Unwind_Ptr
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
+{
+  *ip_before_insn = 0;
+  return _Unwind_GetIP (context);
+}
+
+inline void
+_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
+{
+  _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1));
+}
+#endif
index f1f789c70e5c02bddb87866022d0abc0e3037039..ccf839d7927a8cc911336b335c73707352b33c0f 100644 (file)
@@ -72,12 +72,19 @@ extern "C" {
     {
       return _URC_FAILURE;
     }
+#ifndef __FreeBSD__
   /* Return the address of the instruction, not the actual IP value.  */
 #define _Unwind_GetIP(context) \
   (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
 
 #define _Unwind_SetIP(context, val) \
   _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1))
+#else
+  #undef _Unwind_GetIPInfo
+  _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
+  _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
+  void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
+#endif
 
 #ifdef __cplusplus
 }   /* extern "C" */