From 573a66c3dcf03cde1ff86499a9c7b3666c9fb32b Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sun, 1 Feb 2015 09:50:33 +0000 Subject: [PATCH] FreeBSD expects _Unwind_GetGR, _Unwind_SetGR, and _Unwind_SetIP to be symbols and not macros. Make this so. This fixes a few ports that try to link against these functions but fail as they previously didn't exist. --- contrib/gcc/config/arm/unwind-arm.c | 8 ++++++++ contrib/gcc/config/arm/unwind-arm.h | 27 ++++++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/contrib/gcc/config/arm/unwind-arm.c b/contrib/gcc/config/arm/unwind-arm.c index 47354b44abb6..fff5fdf288a8 100644 --- a/contrib/gcc/config/arm/unwind-arm.c +++ b/contrib/gcc/config/arm/unwind-arm.c @@ -25,6 +25,7 @@ along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define __ARM_STATIC_INLINE #include "unwind.h" /* We add a prototype for abort here to avoid creating a dependency on @@ -1089,4 +1090,11 @@ _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn) *ip_before_insn = 0; return _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1; } + +void +_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) +{ + _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)); +} + #endif diff --git a/contrib/gcc/config/arm/unwind-arm.h b/contrib/gcc/config/arm/unwind-arm.h index ab8531d14fe7..b1f47b81ee19 100644 --- a/contrib/gcc/config/arm/unwind-arm.h +++ b/contrib/gcc/config/arm/unwind-arm.h @@ -34,6 +34,10 @@ #define __ARM_EABI_UNWINDER__ 1 +#ifndef __ARM_STATIC_INLINE +#define __ARM_STATIC_INLINE static inline +#endif + #ifdef __cplusplus extern "C" { #endif @@ -245,7 +249,7 @@ extern "C" { return tmp; } - static inline _Unwind_Word + __ARM_STATIC_INLINE _Unwind_Word _Unwind_GetGR (_Unwind_Context *context, int regno) { _uw val; @@ -253,6 +257,12 @@ extern "C" { return val; } + __ARM_STATIC_INLINE void + _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val) + { + _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); + } + #ifndef __FreeBSD__ /* Return the address of the instruction, not the actual IP value. */ #define _Unwind_GetIP(context) \ @@ -260,21 +270,16 @@ extern "C" { #define _Unwind_GetIPInfo(context, ip_before_insn) \ (*ip_before_insn = 0, _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1) -#else - _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); - _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *); -#endif - - static inline void - _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val) - { - _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); - } /* The dwarf unwinder doesn't understand arm/thumb state. We assume the landing pad uses the same instruction set as the call site. */ #define _Unwind_SetIP(context, val) \ _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)) +#else + _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" */