Skip to content

Commit

Permalink
Merge pull request #663 from starg2/fix-mcf-sjlj
Browse files Browse the repository at this point in the history
Avoid infinite recursion in libgcc for mcf thread model + sjlj exception handling
  • Loading branch information
niXman committed Nov 16, 2023
2 parents 132ead1 + cb76aab commit 8119d49
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
22 changes: 22 additions & 0 deletions patches/gcc/gcc-13-mcf-sjlj-avoid-infinite-recursion.patch
@@ -0,0 +1,22 @@
--- a/libgcc/unwind-sjlj.c
+++ b/libgcc/unwind-sjlj.c
@@ -111,8 +111,19 @@
fc_key_init_once (void)
{
static __gthread_once_t once = __GTHREAD_ONCE_INIT;
+#ifdef __USING_MCFGTHREAD__
+ if (_MCF_once_wait (&once, NULL) == 1)
+ {
+ fc_key_init ();
+ _MCF_once_release (&once);
+ }
+
+ if (use_fc_key < 0)
+ use_fc_key = 0;
+#else
if (__gthread_once (&once, fc_key_init) != 0 || use_fc_key < 0)
use_fc_key = 0;
+#endif
}
#endif

1 change: 1 addition & 0 deletions scripts/gcc-13-branch.sh
Expand Up @@ -58,6 +58,7 @@ PKG_PATCHES=(
gcc/0020-libgomp-Don-t-hard-code-MS-printf-attributes.patch
gcc/gcc-10-libgcc-ldflags.patch
gcc/gcc-12-replace-abort-with-fancy_abort.patch
gcc/gcc-13-mcf-sjlj-avoid-infinite-recursion.patch
)

#
Expand Down
3 changes: 2 additions & 1 deletion scripts/gcc-13.1.0.sh
Expand Up @@ -57,7 +57,8 @@ PKG_PATCHES=(
gcc/gcc-libgomp-ftime64.patch
gcc/0020-libgomp-Don-t-hard-code-MS-printf-attributes.patch
gcc/gcc-10-libgcc-ldflags.patch
gcc/gcc-12-replace-abort-with-fancy_abort.patch
gcc/gcc-12-replace-abort-with-fancy_abort.patch
gcc/gcc-13-mcf-sjlj-avoid-infinite-recursion.patch
)

#
Expand Down
1 change: 1 addition & 0 deletions scripts/gcc-13.2.0.sh
Expand Up @@ -58,6 +58,7 @@ PKG_PATCHES=(
gcc/0020-libgomp-Don-t-hard-code-MS-printf-attributes.patch
gcc/gcc-10-libgcc-ldflags.patch
gcc/gcc-12-replace-abort-with-fancy_abort.patch
gcc/gcc-13-mcf-sjlj-avoid-infinite-recursion.patch
)

#
Expand Down
1 change: 1 addition & 0 deletions scripts/gcc-trunk.sh
Expand Up @@ -58,6 +58,7 @@ PKG_PATCHES=(
gcc/0020-libgomp-Don-t-hard-code-MS-printf-attributes.patch
gcc/gcc-10-libgcc-ldflags.patch
gcc/gcc-12-replace-abort-with-fancy_abort.patch
gcc/gcc-13-mcf-sjlj-avoid-infinite-recursion.patch
)

#
Expand Down

0 comments on commit 8119d49

Please sign in to comment.