blob: 0ea5143e0d60e2ff5035d0b1aec76830788dca2e [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001From 553d8e3b9073ff3e0a9d2fac9b1823fb17ad247c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Feb 2016 21:00:18 -0800
4Subject: [PATCH 49/51] Disable the weak reference logic in gthr.h for
5 os/generic
6
7It does not work unless work arounds are there in gthr-posix.h
8
9origin of patch
10http://port70.net/~nsz/musl/gcc-5.3.0/0004-gthr.patch
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14Upstream-Status: Pending
15
16 libgfortran/acinclude.m4 | 2 +-
17 libgfortran/configure | 2 +-
18 libstdc++-v3/config/os/generic/os_defines.h | 5 +++++
19 libstdc++-v3/configure.host | 3 +++
20 4 files changed, 10 insertions(+), 2 deletions(-)
21
22diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
23index ba890f9..30b8b1a6 100644
24--- a/libgfortran/acinclude.m4
25+++ b/libgfortran/acinclude.m4
26@@ -100,7 +100,7 @@ void foo (void);
27 [Define to 1 if the target supports #pragma weak])
28 fi
29 case "$host" in
30- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
31+ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
32 AC_DEFINE(GTHREAD_USE_WEAK, 0,
33 [Define to 0 if the target shouldn't use #pragma weak])
34 ;;
35diff --git a/libgfortran/configure b/libgfortran/configure
36index 5d47e65..cdf9695 100755
37--- a/libgfortran/configure
38+++ b/libgfortran/configure
39@@ -26456,7 +26456,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>confdefs.h
40
41 fi
42 case "$host" in
43- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
44+ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
45
46 $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
47
48diff --git a/libstdc++-v3/config/os/generic/os_defines.h b/libstdc++-v3/config/os/generic/os_defines.h
49index 45bf52a..103ec0e 100644
50--- a/libstdc++-v3/config/os/generic/os_defines.h
51+++ b/libstdc++-v3/config/os/generic/os_defines.h
52@@ -33,4 +33,9 @@
53 // System-specific #define, typedefs, corrections, etc, go here. This
54 // file will come before all others.
55
56+// Disable the weak reference logic in gthr.h for os/generic because it
57+// is broken on every platform unless there is implementation specific
58+// workaround in gthr-posix.h and at link-time for static linking.
59+#define _GLIBCXX_GTHREAD_USE_WEAK 0
60+
61 #endif
62diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
63index 1756444..2a87bb8 100644
64--- a/libstdc++-v3/configure.host
65+++ b/libstdc++-v3/configure.host
66@@ -273,6 +273,9 @@ case "${host_os}" in
67 freebsd*)
68 os_include_dir="os/bsd/freebsd"
69 ;;
70+ linux-musl*)
71+ os_include_dir="os/generic"
72+ ;;
73 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
74 # check for musl by target
75 case "${host_os}" in
76--
772.7.0
78