forked from msys2/MSYS2-packages
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy path0006-PR-build-21187-Static-linking-of-libstdc-and-libgcc-.patch
More file actions
192 lines (165 loc) · 6.1 KB
/
Copy path0006-PR-build-21187-Static-linking-of-libstdc-and-libgcc-.patch
File metadata and controls
192 lines (165 loc) · 6.1 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
From 6cd50b7d67ebc00af0740dde69c69d7056154c80 Mon Sep 17 00:00:00 2001
From: Nitish K Mishra <nitismis@in.ibm.com>
Date: Thu, 12 Oct 2017 14:20:31 +0100
Subject: [PATCH 6/6] [PR build/21187] Static linking of libstdc++ and libgcc
with GDB leads to broken exception handling on AIX platform
See https://sourceware.org/bugzilla/show_bug.cgi?id=21187
See also https://sourceware.org/ml/gdb/2017-01/msg00044.html et seq.
As pointed out in that thread, this is papering over the cracks: We don't
seem to know why exceptions aren't being propagated correctly, or why using
a shared library fixes it.
(Doing that also prevents building a standlone GDB binary for Windows (which
can be easily distributed)
Other solutions suggested therein: build x86 readline with -fexceptions?
This problem also affects MinGW and Cygwin x86.
See also https://sourceware.org/bugzilla/show_bug.cgi?id=21078
ChangeLog:
2016-03-01 Nitish K Mishra <nitismis@in.ibm.com>
* configure.ac: Include one more option "--disable-staticlib"
to link libstdc++ and libgcc dynamically.
---
ChangeLog | 5 +++++
configure | 26 +++++++++++++++++++++++---
configure.ac | 21 ++++++++++++++++++---
3 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bfe7adf0ae..8c73b1d0e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-01 Nitish K Mishra <nitismis@in.ibm.com>
+
+ * configure.ac: Include one more option "--disable-staticlib"
+ to link libstdc++ and libgcc dynamically.
+
2017-01-01 Joel Brobecker <brobecker@adacore.com>
Update copyright year range in all GDB files.
diff --git a/configure b/configure
index a5f4fc5aa7..6f57d5c041 100755
--- a/configure
+++ b/configure
@@ -760,6 +760,7 @@ enable_libquadmath_support
enable_libada
enable_libssp
enable_libstdcxx
+enable_staticlib
enable_liboffloadmic
enable_static_libjava
enable_bootstrap
@@ -1487,6 +1488,8 @@ Optional Features:
--enable-libada build libada directory
--enable-libssp build libssp directory
--disable-libstdcxx do not build libstdc++-v3 directory
+ --disable-staticlib do not link libstdc++ and libgcc library statically,
+ default is static linking
--enable-liboffloadmic=ARG
build liboffloadmic [ARG={no,host,target}]
--enable-static-libjava[=ARG]
@@ -3110,6 +3113,15 @@ if test "${ENABLE_LIBSTDCXX}" = "no" ; then
noconfigdirs="$noconfigdirs target-libstdc++-v3"
fi
+# Check whether --enable-staticlib was given.
+if test "${enable_staticlib+set}" = set; then :
+ enableval=$enable_staticlib; ENABLE_STATICLIB=$enableval
+else
+ ENABLE_STATICLIB=yes
+fi
+
+
+
# If this is accelerator compiler and its target is intelmic we enable
# target liboffloadmic by default. If this is compiler with offloading
# for intelmic we enable host liboffloadmic by default. Otherwise
@@ -5109,9 +5121,10 @@ if test -z "$LD"; then
fi
fi
-# Check whether -static-libstdc++ -static-libgcc is supported.
+# If ENABLE_STATICLIB is set for configuration, check whether -static-libstdc++ -static-libgcc is supported
have_static_libs=no
-if test "$GCC" = yes; then
+if test "$ENABLE_STATICLIB" = yes; then
+ if test "$GCC" = yes; then
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
@@ -5149,6 +5162,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
LDFLAGS="$saved_LDFLAGS"
+ fi
fi
@@ -5903,6 +5917,9 @@ else
# trust that they are doing what they want.
if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
stage1_ldflags="-static-libstdc++ -static-libgcc"
+ else
+ # If static lib is disabled.
+ stage1_ldflags=""
fi
fi
@@ -5937,8 +5954,11 @@ else
# In stages 2 and 3, default to linking libstdc++ and libgcc
# statically. But if the user explicitly specified the libraries to
# use, trust that they are doing what they want.
- if test "$poststage1_libs" = ""; then
+ if test "$poststage1_libs" = "" -a "$have_static_libs" = yes; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
+ else
+ # If static library linking is disabled.
+ poststage1_ldflags=""
fi
fi
diff --git a/configure.ac b/configure.ac
index a27985c0a7..e90b8e166e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -471,6 +471,13 @@ ENABLE_LIBSTDCXX=default)
noconfigdirs="$noconfigdirs target-libstdc++-v3"
fi]
+AC_ARG_ENABLE(staticlib,
+AS_HELP_STRING([--disable-staticlib],
+ [do not link libstdc++ and libgcc library statically, default is static linking]),
+ENABLE_STATICLIB=$enableval,
+ENABLE_STATICLIB=yes)
+
+
# If this is accelerator compiler and its target is intelmic we enable
# target liboffloadmic by default. If this is compiler with offloading
# for intelmic we enable host liboffloadmic by default. Otherwise
@@ -1406,9 +1413,10 @@ if test -z "$LD"; then
fi
fi
-# Check whether -static-libstdc++ -static-libgcc is supported.
+# If ENABLE_STATICLIB is set for configuration, check whether -static-libstdc++ -static-libgcc is supported
have_static_libs=no
-if test "$GCC" = yes; then
+if test "$ENABLE_STATICLIB" = yes; then
+ if test "$GCC" = yes; then
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
@@ -1424,6 +1432,7 @@ int main() {}],
AC_LANG_POP(C++)
LDFLAGS="$saved_LDFLAGS"
+ fi
fi
ACX_PROG_GNAT
@@ -1741,6 +1750,9 @@ AC_ARG_WITH(stage1-ldflags,
# trust that they are doing what they want.
if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
stage1_ldflags="-static-libstdc++ -static-libgcc"
+ else
+ # If static lib is disabled.
+ stage1_ldflags=""
fi])
AC_SUBST(stage1_ldflags)
@@ -1768,8 +1780,11 @@ AC_ARG_WITH(boot-ldflags,
# In stages 2 and 3, default to linking libstdc++ and libgcc
# statically. But if the user explicitly specified the libraries to
# use, trust that they are doing what they want.
- if test "$poststage1_libs" = ""; then
+ if test "$poststage1_libs" = "" -a "$have_static_libs" = yes; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
+ else
+ # If static library linking is disabled.
+ poststage1_ldflags=""
fi])
AC_SUBST(poststage1_ldflags)
--
2.14.2