From 0f40628d7db93efde48cc048e7c9068e1aa84a17 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 24 Dec 2022 19:34:19 -0600 Subject: system/gcc: Make ARMv7 unwind macros functions This workaround is already needed upstream for FreeBSD. Let's go ahead and use the same workaround for musl. We also ensure they are not declared `inline` so that they are available as library functions. We also have a hack in place for the stage1 Ada driver due to their own hack pulling in the Arm unwind functions directly without linking. Fixes: #866 (and probably more as we continue building packages) --- system/gcc/206-arm-unwind-functionise.patch | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 system/gcc/206-arm-unwind-functionise.patch (limited to 'system/gcc/206-arm-unwind-functionise.patch') diff --git a/system/gcc/206-arm-unwind-functionise.patch b/system/gcc/206-arm-unwind-functionise.patch new file mode 100644 index 000000000..0cee39e54 --- /dev/null +++ b/system/gcc/206-arm-unwind-functionise.patch @@ -0,0 +1,53 @@ +--- gcc-8.5.0/libgcc/config/arm/unwind-arm.c.old 2021-05-14 03:42:10.000000000 -0500 ++++ gcc-8.5.0/libgcc/config/arm/unwind-arm.c 2022-12-24 20:04:04.085095067 -0600 +@@ -510,22 +510,22 @@ + return __gnu_unwind_pr_common (state, ucbp, context, 2); + } + +-#ifdef __FreeBSD__ +-/* FreeBSD expects these to be functions */ +-inline _Unwind_Ptr ++#if !defined(IN_STAGE1_ADA) && (defined(__FreeBSD__) || defined(linux)) ++/* Some packages expect these to be functions */ ++_Unwind_Ptr + _Unwind_GetIP (struct _Unwind_Context *context) + { + return _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1; + } + +-inline _Unwind_Ptr ++_Unwind_Ptr + _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn) + { + *ip_before_insn = 0; + return _Unwind_GetIP (context); + } + +-inline void ++void + _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) + { + _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)); +--- gcc-8.5.0/libgcc/config/arm/unwind-arm.h.old 2021-05-14 03:42:10.000000000 -0500 ++++ gcc-8.5.0/libgcc/config/arm/unwind-arm.h 2022-12-24 20:03:41.415095129 -0600 +@@ -72,7 +72,7 @@ + { + return _URC_FAILURE; + } +-#ifndef __FreeBSD__ ++#if defined(IN_STAGE1_ADA) || (!defined(__FreeBSD__) && !defined(linux)) + /* Return the address of the instruction, not the actual IP value. */ + #define _Unwind_GetIP(context) \ + (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1) +--- gcc-8.5.0/gcc/ada/raise-gcc.c.old 2021-05-14 03:42:08.000000000 -0500 ++++ gcc-8.5.0/gcc/ada/raise-gcc.c 2022-12-24 22:43:03.605084414 -0600 +@@ -91,7 +91,9 @@ + This is a hack ???, the real fix is to link gnat1/gnatbind with the + runtime of the build compiler. */ + # ifdef EH_MECHANISM_arm ++# define IN_STAGE1_ADA /* even worse hack */ + # include "config/arm/unwind-arm.h" ++# undef IN_STAGE1_ADA + # else + # include "unwind-generic.h" + # endif -- cgit v1.2.3-70-g09d2