etc: Enable a tty for a serial port by default.
[dragora.git] / patches / binutils / 2.38 / binutils-do-not-use-debuginfod.patch
blobbe1f43afaf81121d1a58e76170b609783e083946
1 diff -rup binutils.orig/binutils/NEWS binutils-2.38/binutils/NEWS
2 --- binutils.orig/binutils/NEWS 2022-03-10 09:13:18.284641005 +0000
3 +++ binutils-2.38/binutils/NEWS 2022-03-10 09:13:26.007586352 +0000
4 @@ -1,5 +1,8 @@
5 -*- text -*-
7 +* Add an option to objdump and readelf to prevent attempts to access debuginfod
8 + servers when following links.
10 Changes in 2.38:
12 * elfedit: Add --output-abiversion option to update ABIVERSION.
13 diff -rup binutils.orig/binutils/doc/binutils.texi binutils-2.38/binutils/doc/binutils.texi
14 --- binutils.orig/binutils/doc/binutils.texi 2022-03-10 09:13:18.285640998 +0000
15 +++ binutils-2.38/binutils/doc/binutils.texi 2022-03-10 09:13:26.009586338 +0000
16 @@ -2246,6 +2246,8 @@ objdump [@option{-a}|@option{--archive-h
17 @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
18 [@option{-WK}|@option{--dwarf=follow-links}]
19 [@option{-WN}|@option{--dwarf=no-follow-links}]
20 + [@option{-wD}|@option{--dwarf=use-debuginfod}]
21 + [@option{-wE}|@option{--dwarf=do-not-use-debuginfod}]
22 [@option{-L}|@option{--process-links}]
23 [@option{--ctf=}@var{section}]
24 [@option{-G}|@option{--stabs}]
25 @@ -4879,6 +4881,8 @@ readelf [@option{-a}|@option{--all}]
26 @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
27 [@option{-wK}|@option{--debug-dump=follow-links}]
28 [@option{-wN}|@option{--debug-dump=no-follow-links}]
29 + [@option{-wD}|@option{--debug-dump=use-debuginfod}]
30 + [@option{-wE}|@option{--debug-dump=do-not-use-debuginfod}]
31 [@option{-P}|@option{--process-links}]
32 [@option{--dwarf-depth=@var{n}}]
33 [@option{--dwarf-start=@var{n}}]
34 @@ -5504,7 +5508,8 @@ deduced from the input file
35 @cindex separate debug files
37 debuginfod is a web service that indexes ELF/DWARF debugging resources
38 -by build-id and serves them over HTTP.
39 +by build-id and serves them over HTTP. For more information see:
40 +@emph{https://sourceware.org/elfutils/Debuginfod.html}
42 Binutils can be built with the debuginfod client library
43 @code{libdebuginfod} using the @option{--with-debuginfod} configure option.
44 @@ -5516,6 +5521,10 @@ separate debug files when the files are
45 debuginfod is packaged with elfutils, starting with version 0.178.
46 You can get the latest version from `https://sourceware.org/elfutils/'.
48 +The DWARF info dumping tools (@command{readelf} and @command{objdump})
49 +have options to control when they should access the debuginfod
50 +servers. By default this access is enabled.
52 @node Reporting Bugs
53 @chapter Reporting Bugs
54 @cindex bugs
55 Only in binutils-2.38/binutils/doc: binutils.texi.orig
56 diff -rup binutils.orig/binutils/doc/debug.options.texi binutils-2.38/binutils/doc/debug.options.texi
57 --- binutils.orig/binutils/doc/debug.options.texi 2022-03-10 09:13:18.285640998 +0000
58 +++ binutils-2.38/binutils/doc/debug.options.texi 2022-03-10 09:13:26.009586338 +0000
59 @@ -68,10 +68,27 @@ chosen when configuring the binutils via
60 @option{--enable-follow-debug-links=no} options. If these are not
61 used then the default is to enable the following of debug links.
63 +Note - if support for the debuginfod protocol was enabled when the
64 +binutils were built then this option will also include an attempt to
65 +contact any debuginfod servers mentioned in the @var{DEBUGINFOD_URLS}
66 +environment variable. This could take some time to resolve. This
67 +behaviour can be disabled via the @option{=do-not-use-debuginfod} debug
68 +option.
70 @item N
71 @itemx =no-follow-links
72 Disables the following of links to separate debug info files.
74 +@item D
75 +@itemx =use-debuginfod
76 +Enables contacting debuginfod servers if there is a need to follow
77 +debug links. This is the default behaviour.
79 +@item E
80 +@itemx =do-not-use-debuginfod
81 +Disables contacting debuginfod servers when there is a need to follow
82 +debug links.
84 @item l
85 @itemx =rawline
86 Displays the contents of the @samp{.debug_line} section in a raw
87 diff -rup binutils.orig/binutils/dwarf.c binutils-2.38/binutils/dwarf.c
88 --- binutils.orig/binutils/dwarf.c 2022-03-10 09:13:18.283641012 +0000
89 +++ binutils-2.38/binutils/dwarf.c 2022-03-10 09:13:26.010586331 +0000
90 @@ -109,6 +109,9 @@ int do_debug_cu_index;
91 int do_wide;
92 int do_debug_links;
93 int do_follow_links = DEFAULT_FOR_FOLLOW_LINKS;
94 +#ifdef HAVE_LIBDEBUGINFOD
95 +int use_debuginfod = 1;
96 +#endif
97 bool do_checks;
99 int dwarf_cutoff_level = -1;
100 @@ -11038,7 +11041,7 @@ debuginfod_fetch_separate_debug_info (st
102 return false;
104 -#endif
105 +#endif /* HAVE_LIBDEBUGINFOD */
107 static void *
108 load_separate_debug_info (const char * main_filename,
109 @@ -11157,9 +11160,10 @@ load_separate_debug_info (const char *
111 char * tmp_filename;
113 - if (debuginfod_fetch_separate_debug_info (xlink,
114 - & tmp_filename,
115 - file))
116 + if (use_debuginfod
117 + && debuginfod_fetch_separate_debug_info (xlink,
118 + & tmp_filename,
119 + file))
121 /* File successfully downloaded from server, replace
122 debug_filename with the file's path. */
123 @@ -11207,13 +11211,15 @@ load_separate_debug_info (const char *
124 warn (_("tried: %s\n"), debug_filename);
126 #if HAVE_LIBDEBUGINFOD
128 - char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
129 - if (urls == NULL)
130 - urls = "";
131 + if (use_debuginfod)
133 + char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
135 - warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
137 + if (urls == NULL)
138 + urls = "";
140 + warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
142 #endif
145 @@ -11707,6 +11713,9 @@ dwarf_select_sections_by_names (const ch
146 { "aranges", & do_debug_aranges, 1 },
147 { "cu_index", & do_debug_cu_index, 1 },
148 { "decodedline", & do_debug_lines, FLAG_DEBUG_LINES_DECODED },
149 +#ifdef HAVE_LIBDEBUGINFOD
150 + { "do-not-use-debuginfod", & use_debuginfod, 0 },
151 +#endif
152 { "follow-links", & do_follow_links, 1 },
153 { "frames", & do_debug_frames, 1 },
154 { "frames-interp", & do_debug_frames_interp, 1 },
155 @@ -11730,6 +11739,9 @@ dwarf_select_sections_by_names (const ch
156 { "trace_abbrev", & do_trace_abbrevs, 1 },
157 { "trace_aranges", & do_trace_aranges, 1 },
158 { "trace_info", & do_trace_info, 1 },
159 +#ifdef HAVE_LIBDEBUGINFOD
160 + { "use-debuginfod", & use_debuginfod, 1 },
161 +#endif
162 { NULL, NULL, 0 }
165 @@ -11783,6 +11795,10 @@ dwarf_select_sections_by_letters (const
166 case 'A': do_debug_addr = 1; break;
167 case 'a': do_debug_abbrevs = 1; break;
168 case 'c': do_debug_cu_index = 1; break;
169 +#ifdef HAVE_LIBDEBUGINFOD
170 + case 'D': use_debuginfod = 1; break;
171 + case 'E': use_debuginfod = 0; break;
172 +#endif
173 case 'F': do_debug_frames_interp = 1; /* Fall through. */
174 case 'f': do_debug_frames = 1; break;
175 case 'g': do_gdb_index = 1; break;
176 diff -rup binutils.orig/binutils/dwarf.h binutils-2.38/binutils/dwarf.h
177 --- binutils.orig/binutils/dwarf.h 2022-03-10 09:13:18.284641005 +0000
178 +++ binutils-2.38/binutils/dwarf.h 2022-03-10 09:13:26.010586331 +0000
179 @@ -224,6 +224,9 @@ extern int do_debug_cu_index;
180 extern int do_wide;
181 extern int do_debug_links;
182 extern int do_follow_links;
183 +#ifdef HAVE_LIBDEBUGINFOD
184 +extern int use_debuginfod;
185 +#endif
186 extern bool do_checks;
188 extern int dwarf_cutoff_level;
189 diff -rup binutils.orig/binutils/objdump.c binutils-2.38/binutils/objdump.c
190 --- binutils.orig/binutils/objdump.c 2022-03-10 09:13:18.283641012 +0000
191 +++ binutils-2.38/binutils/objdump.c 2022-03-10 09:13:26.011586324 +0000
192 @@ -281,6 +281,14 @@ usage (FILE *stream, int status)
193 Do not follow links to separate debug info files\n\
194 (default)\n"));
195 #endif
196 +#if HAVE_LIBDEBUGINFOD
197 + fprintf (stream, _("\
198 + -WD --dwarf=use-debuginfod\n\
199 + When following links, also query debuginfod servers (default)\n"));
200 + fprintf (stream, _("\
201 + -WE --dwarf=do-not-use-debuginfod\n\
202 + When following links, do not query debuginfod servers\n"));
203 +#endif
204 fprintf (stream, _("\
205 -L, --process-links Display the contents of non-debug sections in\n\
206 separate debuginfo files. (Implies -WK)\n"));
207 Only in binutils-2.38/binutils/: objdump.c.orig
208 diff -rup binutils.orig/binutils/readelf.c binutils-2.38/binutils/readelf.c
209 --- binutils.orig/binutils/readelf.c 2022-03-10 09:13:18.302640878 +0000
210 +++ binutils-2.38/binutils/readelf.c 2022-03-10 09:13:26.012586316 +0000
211 @@ -5126,6 +5126,14 @@ usage (FILE * stream)
212 Do not follow links to separate debug info files\n\
213 (default)\n"));
214 #endif
215 +#if HAVE_LIBDEBUGINFOD
216 + fprintf (stream, _("\
217 + -wD --debug-dump=use-debuginfod\n\
218 + When following links, also query debuginfod servers (default)\n"));
219 + fprintf (stream, _("\
220 + -wE --debug-dump=do-not-use-debuginfod\n\
221 + When following links, do not query debuginfod servers\n"));
222 +#endif
223 fprintf (stream, _("\
224 --dwarf-depth=N Do not display DIEs at depth N or greater\n"));
225 fprintf (stream, _("\
226 Only in binutils-2.38/binutils/: readelf.c.orig
227 diff -rup binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp
228 --- binutils.orig/binutils/testsuite/binutils-all/debuginfod.exp 2022-03-10 09:13:18.291640956 +0000
229 +++ binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp 2022-03-10 09:13:26.012586316 +0000
230 @@ -185,8 +185,14 @@ proc test_fetch_debugaltlink { prog prog
233 if { [regexp ".*DEBUGINFOD.*" $conf_objdump] } {
234 - test_fetch_debuglink $OBJDUMP "-W"
235 + test_fetch_debuglink $OBJDUMP "-W -WD"
236 test_fetch_debugaltlink $OBJDUMP "-Wk"
238 + set test "disabling debuginfod access"
239 + setup_xfail *-*-*
240 + test_fetch_debuglink $OBJDUMP "-W -WE"
241 + set test "debuginfod"
243 } else {
244 untested "$test (objdump not configured with debuginfod)"
246 @@ -194,6 +200,12 @@ if { [regexp ".*DEBUGINFOD.*" $conf_objd
247 if { [regexp ".*DEBUGINFOD.*" $conf_readelf] } {
248 test_fetch_debuglink $READELF "-w"
249 test_fetch_debugaltlink $READELF "-wk"
251 + set test "disabling debuginfod access"
252 + setup_xfail *-*-*
253 + test_fetch_debuglink $READELF "-w -wE"
254 + set test "debuginfod"
256 } else {
257 untested "$test (readelf not configured with debuginfod)"