summaryrefslogtreecommitdiff
path: root/system/gcc/206-arm-unwind-functionise.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2022-12-24 19:34:19 -0600
committerZach van Rijn <me@zv.io>2022-12-25 11:03:04 -0600
commit0f40628d7db93efde48cc048e7c9068e1aa84a17 (patch)
treeda9ed174753540d99474992d161973366c715368 /system/gcc/206-arm-unwind-functionise.patch
parentaa018289d6e1d34615c39e039db72df95a1c798a (diff)
downloadpackages-0f40628d7db93efde48cc048e7c9068e1aa84a17.tar.gz
packages-0f40628d7db93efde48cc048e7c9068e1aa84a17.tar.bz2
packages-0f40628d7db93efde48cc048e7c9068e1aa84a17.tar.xz
packages-0f40628d7db93efde48cc048e7c9068e1aa84a17.zip
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)
Diffstat (limited to 'system/gcc/206-arm-unwind-functionise.patch')
-rw-r--r--system/gcc/206-arm-unwind-functionise.patch53
1 files changed, 53 insertions, 0 deletions
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