diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index b00a190b6c7323c2689518e330986c90b7f28fab..1d05cef858c0f6a698c8c97c58507f9c873ca88a 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/libgcc/config/arm/unwind-arm.c b/libgcc/config/arm/unwind-arm.c index a3d7391fc03b2152164a3f00e15562e70c42f65e..c6bfe130b20d93bc5f3f7467d1df0766606d47c8 100644 --- a/libgcc/config/arm/unwind-arm.c +++ b/libgcc/config/arm/unwind-arm.c @@ -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 diff --git a/libgcc/config/arm/unwind-arm.h b/libgcc/config/arm/unwind-arm.h index 9ceec5472abd5df071adea61bacf1465a6639b85..037be34cb1764ffd0dbe1474f326fdc2748bc05c 100644 --- a/libgcc/config/arm/unwind-arm.h +++ b/libgcc/config/arm/unwind-arm.h @@ -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" */