summaryrefslogtreecommitdiff
path: root/etc/patches/gcc-4.7.4/musl-support/0005-libstdc-workaround-for-musl.patch
blob: 0b862e09fd357722a601ca8156cb7aa33840b9ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 6f30aa9b58c145331da46adad18dc38926252547 Mon Sep 17 00:00:00 2001
From: Oliver Reiche <oliver.reiche@huawei.com>
Date: Thu, 29 Jun 2023 17:02:18 +0200
Subject: [PATCH 5/7] libstdc++ workaround for musl

Backport from GCC 6.1.0
  Git commit: 85da5c3024f731e719c4093314da8edcd1056527
  Subversion revision: r222329

Original description:
  * config/os/generic/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK): Define.
  * configure.host (os_include_dir): Set to "os/generic" for linux-musl*.

Co-authored-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
---
 libstdc++-v3/config/os/generic/os_defines.h | 5 +++++
 libstdc++-v3/configure.host                 | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/libstdc++-v3/config/os/generic/os_defines.h b/libstdc++-v3/config/os/generic/os_defines.h
index 3199bf30b..b8d7c1636 100644
--- a/libstdc++-v3/config/os/generic/os_defines.h
+++ b/libstdc++-v3/config/os/generic/os_defines.h
@@ -33,4 +33,9 @@
 // System-specific #define, typedefs, corrections, etc, go here.  This
 // file will come before all others.
 
+// Disable the weak reference logic in gthr.h for os/generic because it
+// is broken on every platform unless there is implementation specific
+// workaround in gthr-posix.h and at link-time for static linking.
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+
 #endif
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index b0e2cd9ea..df7977151 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -242,6 +242,9 @@ case "${host_os}" in
   freebsd*)
     os_include_dir="os/bsd/freebsd"
     ;;
+  linux-musl*)
+    os_include_dir="os/generic"
+    ;;
   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
     if [ "$uclibc" = "yes" ]; then
       os_include_dir="os/uclibc"
-- 
2.30.2