1
0
mirror of https://github.com/pmmp/musl-cross-make.git synced 2024-11-24 10:46:11 +00:00
musl-cross-make/patches/gcc-9.2.0/0014-fix-gthr-weak-refs-for-libgcc.patch
Rich Felker 9e06392a64 add gcc 9.2.0 hash and patches
patches from Szabolcs Nagy's patchset, carried forward from 8.x with
minimal changes, with #0014 added from recent additions not reflected.
2019-11-10 20:13:42 -05:00

52 lines
1.6 KiB
Diff

From 51a354a0fb54165d505bfed9819c0440027312d9 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 22 Sep 2019 23:04:48 +0000
Subject: [PATCH] fix gthr weak refs for libgcc
ideally gthr-posix.h should be fixed not to use weak refs for
single thread detection by default since that's unsafe.
currently we have to opt out explicitly from the unsafe behaviour
in the configure machinery of each target lib that uses gthr and
musl missed libgcc previously.
related bugs and discussions
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87189
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91737
https://sourceware.org/bugzilla/show_bug.cgi?id=5784
https://sourceware.org/ml/libc-alpha/2012-09/msg00192.html
https://sourceware.org/ml/libc-alpha/2019-08/msg00438.html
---
libgcc/config.host | 7 +++++++
libgcc/config/t-gthr-noweak | 2 ++
2 files changed, 9 insertions(+)
create mode 100644 libgcc/config/t-gthr-noweak
diff --git a/libgcc/config.host b/libgcc/config.host
index 122113fc519..fe1b9ab93d5 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1500,3 +1500,10 @@ aarch64*-*-*)
tm_file="${tm_file} aarch64/value-unwind.h"
;;
esac
+
+case ${host} in
+*-*-musl*)
+ # The gthr weak references are unsafe with static linking
+ tmake_file="$tmake_file t-gthr-noweak"
+ ;;
+esac
diff --git a/libgcc/config/t-gthr-noweak b/libgcc/config/t-gthr-noweak
new file mode 100644
index 00000000000..45a21e9361d
--- /dev/null
+++ b/libgcc/config/t-gthr-noweak
@@ -0,0 +1,2 @@
+# Don't use weak references for single-thread detection
+HOST_LIBGCC2_CFLAGS += -DGTHREAD_USE_WEAK=0
--
2.17.1