summaryrefslogtreecommitdiff
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
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)
-rw-r--r--system/gcc/206-arm-unwind-functionise.patch53
-rw-r--r--system/gcc/APKBUILD8
2 files changed, 58 insertions, 3 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
diff --git a/system/gcc/APKBUILD b/system/gcc/APKBUILD
index b8dfbd37f..ff4649fb9 100644
--- a/system/gcc/APKBUILD
+++ b/system/gcc/APKBUILD
@@ -6,7 +6,7 @@ pkgver=8.5.0
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname="$pkgname$_target"
-pkgrel=1
+pkgrel=2
pkgdesc="The GNU Compiler Collection"
url="https://gcc.gnu.org"
arch="all"
@@ -159,6 +159,7 @@ source="https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz
201-ada.patch
202-ibm-ldbl.patch
205-nopie.patch
+ 206-arm-unwind-functionise.patch
libgcc-always-build-gcceh.a.patch
gcc-4.9-musl-fortify.patch
@@ -560,8 +561,8 @@ d35a3ac7e13a4446921a90e1ff3eec1079840c845f9d523c868e24ae21f94cf69ba041de5341ebef
a3702c1f642412413d0ffc69f6439a3e101b2b56c16610f94c66556c88e52d01b0b6d1e57bfc5a972668f976c02fbf2fc22bcf707b000867e44744d9eb7b7566 201-ada.patch
152639228a189b211df660b5b7543e3744cf136e80fed7f1ac37a3bc1b692fba3431a0d62337e769ee8f323188acdf11092cb1b2ef5c75fafee9628d13bc4163 202-ibm-ldbl.patch
98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch
+9fc745619d2628ec21eed1c8de78780ca8960a0ca41f725991202b212bdeb31eb803d9ea2ad18e0278620c2422a99f253f4d2a20d3a354bf88b87a55fc966d9d 206-arm-unwind-functionise.patch
d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch
-fa59b0fb081d97f8f63506b8793699588a95c602b5d468140eb1e80456597e52e1cc45dc0b234ac8e60e2b0cd606d94d111c8b0ae64c0a2be1bc1b8a184ceb93 libgo-musl-1.2.3.patch
600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch
dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch
fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch
@@ -581,4 +582,5 @@ b32d496a3a04c2357200b75dbf7f667fb57bf5af4f0c68926bc58f6600e4f23caa48aad2eaf073f1
4db4a00dff1d3cb3ecbc713659316782ac839478ff1fd7166cfa64a2c7cee0ba2a0d3fa23cb858af7d8f59a6ac2bdf40e63a45c307b89eefe2a4e888707f615b 340-gccgo-time64-stat.patch
1860593584f629d24d5b6db14b0a3412e9f93449b663aaa4981301a0923db0159314905e694f27366fbfef72dce06636ab6df86862b7e9e9564847e03bee82c1 add-classic_table-support.patch
67a75a94fdba69de96b98dbc2978a50cb197857c464b81f7c956176da7066b3be937e40cb15e0870fc1e7382d662c5101bcd18cf457fc4112de41802042b51c4 gcc-5.4.0-locale.patch
-65a4d8bf9cefcbc79e86015ef4376b2794492d6cae77065359b35bb4ed630dde6256982cd5e43ed837cbbdab366ea376da9f1c83f80ddf6dc53ab017b378c3cd backport-r267157-posix-conformant-snprintf.patch"
+65a4d8bf9cefcbc79e86015ef4376b2794492d6cae77065359b35bb4ed630dde6256982cd5e43ed837cbbdab366ea376da9f1c83f80ddf6dc53ab017b378c3cd backport-r267157-posix-conformant-snprintf.patch
+fa59b0fb081d97f8f63506b8793699588a95c602b5d468140eb1e80456597e52e1cc45dc0b234ac8e60e2b0cd606d94d111c8b0ae64c0a2be1bc1b8a184ceb93 libgo-musl-1.2.3.patch"