Mercurial > mxe-octave
comparison src/gdb-1-gnulib.patch @ 5732:055dec6c319b
Allow other packages to use newer Windows API functions.
* src/mingw-w64.mk, src/build-gcc.mk: Since we now require version 6.1 or newer
of the Windows API (Windows 7 or newer) for Octave 7, allow other packages to
use these functions, too, by setting a default Windows API version.
* src/gdb-1-gnulib.patch: Cherrypick patch from upstream to fix compiling for
newer Windows API.
* dist-files.mk: Add new patch to list.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 11 Apr 2021 12:39:19 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
5731:6c9c51be6829 | 5732:055dec6c319b |
---|---|
1 From 361cb219351d8b7e39e1962fe77f40aa80657b27 Mon Sep 17 00:00:00 2001 | |
2 From: Andrew Burgess <andrew.burgess@embecosm.com> | |
3 Date: Tue, 6 Oct 2020 10:09:06 +0100 | |
4 Subject: [PATCH] gnulib: Ensure all libraries are used when building | |
5 gdb/gdbserver | |
6 | |
7 An issue was reported here related to building GDB on MinGW: | |
8 | |
9 https://sourceware.org/pipermail/gdb/2020-September/048927.html | |
10 | |
11 It was suggested here: | |
12 | |
13 https://sourceware.org/pipermail/gdb/2020-September/048931.html | |
14 | |
15 that the solution might be to make use of $(LIB_GETRANDOM), a variable | |
16 defined in the gnulib makefile, when linking GDB. | |
17 | |
18 In fact I think the issue is bigger than just LIB_GETRANDOM. When | |
19 using the script binutils-gdb/gnulib/update-gnulib.sh to reimport | |
20 gnulib there is a lot of output from gnulib's gnulib-tool. Part of | |
21 that output is this: | |
22 | |
23 You may need to use the following makefile variables when linking. | |
24 Use them in <program>_LDADD when linking a program, or | |
25 in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library. | |
26 $(FREXPL_LIBM) | |
27 $(FREXP_LIBM) | |
28 $(INET_NTOP_LIB) | |
29 $(LIBTHREAD) | |
30 $(LIB_GETLOGIN) | |
31 $(LIB_GETRANDOM) | |
32 $(LIB_HARD_LOCALE) | |
33 $(LIB_MBRTOWC) | |
34 $(LIB_SETLOCALE_NULL) | |
35 $(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise | |
36 | |
37 What I think this is telling us is that we should be including the | |
38 value of all these variables on the link line for gdb and gdbserver. | |
39 | |
40 The problem though is that these variables are define in gnulib's | |
41 makefile, but are not (necessarily) defined in GDB's makefile. | |
42 | |
43 One solution would be to recreate the checks that gnulib performs in | |
44 order to recreate these variables in both gdb's and gdbserver's | |
45 makefile. Though this shouldn't be too hard, most (if not all) of | |
46 these checks are in the form macros defined in m4 files in the gnulib | |
47 tree, so we could just reference these as needed. However, in this | |
48 commit I propose a different solution. | |
49 | |
50 Currently, in the top level makefile, we give gdb and gdbserver a | |
51 dependency on gnulib. Once gnulib has finished building gdb and | |
52 gdbserver can start, these projects then have a hard coded (relative) | |
53 path to the compiled gnulib library in their makefiles. | |
54 | |
55 In this commit I extend the gnulib configure script to install a new | |
56 makefile fragment in the gnulib build directory. This new file will | |
57 have the usual variable substitutions applied to it, and so can | |
58 include the complete list (see above) of all the extra libraries that | |
59 are needed when linking against gnulib. | |
60 | |
61 In fact the new makefile fragment defines three variables, these are: | |
62 | |
63 LIBGNU: The path to the archive containing gnulib. Can be used as a | |
64 dependency as when this file changes gdb/gdbserver should be | |
65 relinked. | |
66 | |
67 LIBGNU_EXTRA_LIBS: A list of linker -l.... flags that should be | |
68 included in the link line of gdb/gdbserver. These are | |
69 libraries that $(LIBGNU) depends on. This list is taken from | |
70 the output of gnulib-tool, which is run by our | |
71 gnulib/update-gnulib.sh script. | |
72 | |
73 INCGNU: A list of -I.... include paths that should be passed to the | |
74 compiler, these are where the gnulib headers can be found. | |
75 | |
76 Now both gdb and gdbserver can include the makefile fragment and make | |
77 use of these variables. | |
78 | |
79 The makefile fragment relies on the variable GNULIB_BUILDDIR being | |
80 defined. This is checked for in the fragment, and was already defined | |
81 in the makefiles of gdb and gdbserver. | |
82 | |
83 gdb/ChangeLog: | |
84 | |
85 * Makefile.in: Include Makefile.gnulib.inc. Don't define LIBGNU | |
86 or INCGNU. Make use of LIBGNU_EXTRA_LIBS when linking. | |
87 | |
88 gdbserver/ChangeLog: | |
89 | |
90 * Makefile.in: Include Makefile.gnulib.inc. Don't define LIBGNU | |
91 or INCGNU. Make use of LIBGNU_EXTRA_LIBS when linking. | |
92 | |
93 gnulib/ChangeLog: | |
94 | |
95 * Makefile.gnulib.inc.in: New file. | |
96 * Makefile.in: Regenerate. | |
97 * configure: Regenerate. | |
98 * configure.ac: Install the new file. | |
99 --- | |
100 gdb/ChangeLog | 5 ++++ | |
101 gdb/Makefile.in | 5 ++-- | |
102 gdbserver/ChangeLog | 5 ++++ | |
103 gdbserver/Makefile.in | 11 ++++----- | |
104 gnulib/ChangeLog | 7 ++++++ | |
105 gnulib/Makefile.gnulib.inc.in | 44 +++++++++++++++++++++++++++++++++++ | |
106 gnulib/Makefile.in | 4 +++- | |
107 gnulib/configure | 4 ++++ | |
108 gnulib/configure.ac | 2 ++ | |
109 9 files changed, 77 insertions(+), 10 deletions(-) | |
110 create mode 100644 gnulib/Makefile.gnulib.inc.in | |
111 | |
112 diff --git a/gdb/Makefile.in b/gdb/Makefile.in | |
113 index 80b788cdff9..5f92e8781e7 100644 | |
114 --- a/gdb/Makefile.in | |
115 +++ b/gdb/Makefile.in | |
116 @@ -243,8 +243,7 @@ GDBFLAGS = | |
117 | |
118 # Helper code from gnulib. | |
119 GNULIB_BUILDDIR = ../gnulib | |
120 -LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a | |
121 -INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import | |
122 +include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc | |
123 | |
124 SUPPORT = ../gdbsupport | |
125 LIBSUPPORT = $(SUPPORT)/libgdbsupport.a | |
126 @@ -632,7 +631,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) \ | |
127 $(XM_CLIBS) $(GDBTKLIBS) \ | |
128 @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \ | |
129 $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \ | |
130 - $(WIN32LIBS) $(LIBGNU) $(LIBICONV) \ | |
131 + $(WIN32LIBS) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) $(LIBICONV) \ | |
132 $(LIBMPFR) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \ | |
133 $(DEBUGINFOD_LIBS) | |
134 CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(CTF_DEPS) \ | |
135 diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in | |
136 index c8cfed4819b..1969ed0ec37 100644 | |
137 --- a/gdbserver/Makefile.in | |
138 +++ b/gdbserver/Makefile.in | |
139 @@ -114,8 +114,7 @@ ustinc = @ustinc@ | |
140 | |
141 # gnulib | |
142 GNULIB_BUILDDIR = ../gnulib | |
143 -LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a | |
144 -INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import | |
145 +include $(GNULIB_BUILDDIR)/Makefile.gnulib.inc | |
146 | |
147 # Where is the INTL library? Typically in ../intl. | |
148 INTL = @LIBINTL@ | |
149 @@ -360,8 +359,8 @@ gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY) \ | |
150 $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ | |
151 $(CXXFLAGS) \ | |
152 -o gdbserver$(EXEEXT) $(OBS) $(GDBSUPPORT) $(LIBGNU) \ | |
153 - $(LIBIBERTY) $(INTL) $(GDBSERVER_LIBS) $(XM_CLIBS) \ | |
154 - $(WIN32APILIBS) | |
155 + $(LIBGNU_EXTRA_LIBS) $(LIBIBERTY) $(INTL) \ | |
156 + $(GDBSERVER_LIBS) $(XM_CLIBS) $(WIN32APILIBS) | |
157 | |
158 gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY) \ | |
159 $(INTL_DEPS) $(GDBSUPPORT) | |
160 @@ -369,8 +368,8 @@ gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY) \ | |
161 $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ | |
162 $(CXXFLAGS) \ | |
163 -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) \ | |
164 - $(GDBSUPPORT) $(LIBGNU) $(LIBIBERTY) $(INTL) \ | |
165 - $(WIN32APILIBS) | |
166 + $(GDBSUPPORT) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) \ | |
167 + $(LIBIBERTY) $(INTL) $(WIN32APILIBS) | |
168 | |
169 IPA_OBJS = \ | |
170 alloc-ipa.o \ | |
171 diff --git a/gnulib/Makefile.gnulib.inc.in b/gnulib/Makefile.gnulib.inc.in | |
172 new file mode 100644 | |
173 index 00000000000..f3fd72b5781 | |
174 --- /dev/null | |
175 +++ b/gnulib/Makefile.gnulib.inc.in | |
176 @@ -0,0 +1,44 @@ | |
177 +# Copyright (C) 2020 Free Software Foundation, Inc. | |
178 + | |
179 +# This program is free software; you can redistribute it and/or modify | |
180 +# it under the terms of the GNU General Public License as published by | |
181 +# the Free Software Foundation; either version 3 of the License, or | |
182 +# (at your option) any later version. | |
183 +# | |
184 +# This program is distributed in the hope that it will be useful, | |
185 +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
186 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
187 +# GNU General Public License for more details. | |
188 +# | |
189 +# You should have received a copy of the GNU General Public License | |
190 +# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
191 + | |
192 +# A makefile snippet that lists all of the libraries that should be | |
193 +# pulled in when linking against gnulib. Both GDB and GDBSERVER will | |
194 +# include this snippet. | |
195 +# | |
196 +# The defined variables are: | |
197 +# | |
198 +# LIBGNU: The path to the archive containing gnulib. Can be used as a | |
199 +# dependency as when this file changes gdb/gdbserver should be | |
200 +# relinked. | |
201 +# | |
202 +# LIBGNU_EXTRA_LIBS: A list of linker -l.... flags that should be | |
203 +# included in the link line of gdb/gdbserver. These are | |
204 +# libraries that $(LIBGNU) depends on. This list is taken from | |
205 +# the output of gnulib-tool, which is run by our | |
206 +# gnulib/update-gnulib.sh script. | |
207 +# | |
208 +# INCGNU: A list of -I.... include paths that should be passed to the | |
209 +# compiler, these are where the gnulib headers can be found. | |
210 + | |
211 +ifndef GNULIB_BUILDDIR | |
212 +$(error missing GNULIB_BUILDDIR) | |
213 +endif | |
214 + | |
215 +LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a | |
216 +LIBGNU_EXTRA_LIBS = @FREXPL_LIBM@ @FREXP_LIBM@ @INET_NTOP_LIB@ \ | |
217 + @LIBTHREAD@ @LIB_GETLOGIN@ @LIB_GETRANDOM@ \ | |
218 + @LIB_HARD_LOCALE@ @LIB_MBRTOWC@ \ | |
219 + @LIB_SETLOCALE_NULL@ @LIBINTL@ | |
220 +INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import | |
221 diff --git a/gnulib/Makefile.in b/gnulib/Makefile.in | |
222 index bdd3c3f3fbc..c1c21680944 100644 | |
223 --- a/gnulib/Makefile.in | |
224 +++ b/gnulib/Makefile.in | |
225 @@ -277,7 +277,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ | |
226 configure.lineno config.status.lineno | |
227 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs | |
228 CONFIG_HEADER = config.h | |
229 -CONFIG_CLEAN_FILES = | |
230 +CONFIG_CLEAN_FILES = Makefile.gnulib.inc | |
231 CONFIG_CLEAN_VPATH_FILES = | |
232 AM_V_P = $(am__v_P_@AM_V@) | |
233 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) | |
234 @@ -1642,6 +1642,8 @@ $(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) | |
235 | |
236 distclean-hdr: | |
237 -rm -f config.h stamp-h1 | |
238 +Makefile.gnulib.inc: $(top_builddir)/config.status $(srcdir)/Makefile.gnulib.inc.in | |
239 + cd $(top_builddir) && $(SHELL) ./config.status $@ | |
240 | |
241 # This directory's subdirectories are mostly independent; you can cd | |
242 # into them and run 'make' without going through this Makefile. | |
243 diff --git a/gnulib/configure b/gnulib/configure | |
244 index 5c6add6e371..6c58a46e42e 100644 | |
245 --- a/gnulib/configure | |
246 +++ b/gnulib/configure | |
247 @@ -30802,6 +30802,9 @@ fi | |
248 # Checks for libraries. # | |
249 # ---------------------- # | |
250 | |
251 +ac_config_files="$ac_config_files Makefile.gnulib.inc" | |
252 + | |
253 + | |
254 ac_config_files="$ac_config_files Makefile import/Makefile" | |
255 | |
256 ac_config_commands="$ac_config_commands default" | |
257 @@ -31634,6 +31637,7 @@ do | |
258 case $ac_config_target in | |
259 "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; | |
260 "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; | |
261 + "Makefile.gnulib.inc") CONFIG_FILES="$CONFIG_FILES Makefile.gnulib.inc" ;; | |
262 "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; | |
263 "import/Makefile") CONFIG_FILES="$CONFIG_FILES import/Makefile" ;; | |
264 "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; | |
265 diff --git a/gnulib/configure.ac b/gnulib/configure.ac | |
266 index acc1b1a322e..052b8bd8dc5 100644 | |
267 --- a/gnulib/configure.ac | |
268 +++ b/gnulib/configure.ac | |
269 @@ -56,6 +56,8 @@ AC_CHECK_TOOL(AR, ar) | |
270 # Checks for libraries. # | |
271 # ---------------------- # | |
272 | |
273 +AC_CONFIG_FILES(Makefile.gnulib.inc) | |
274 + | |
275 AC_OUTPUT(Makefile import/Makefile, | |
276 [ | |
277 case x$CONFIG_HEADERS in | |
278 -- | |
279 2.27.0 | |
280 | |
281 |