ath10k-ct-firmware: Add support for QCA9886/QCA9888 firmware.
[openwrt/openwrt.git] / package / libs / elfutils / patches / 100-musl-compat.patch
1 https://sourceware.org/bugzilla/show_bug.cgi?id=21002
2
3 --- a/lib/system.h
4 +++ b/lib/system.h
5 @@ -140,6 +140,19 @@ pread_retry (int fd, void *buf, size_t l
6 return recvd;
7 }
8
9 +#ifdef HAVE_ERROR_H
10 +#include "error.h"
11 +#else
12 +#include "err.h"
13 +#define error(status, errno, ...) \
14 + fflush(stdout); \
15 + warn(__VA_ARGS__); \
16 + if (status) exit(status)
17 +#endif
18 +
19 +#ifndef __GLIBC__
20 +#define canonicalize_file_name(name) realpath(name,NULL)
21 +#endif
22
23 /* We need define two variables, argp_program_version_hook and
24 argp_program_bug_address, in all programs. argp.h declares these
25 --- a/lib/color.c
26 +++ b/lib/color.c
27 @@ -32,12 +32,12 @@
28 #endif
29
30 #include <argp.h>
31 -#include <error.h>
32 #include <libintl.h>
33 #include <stdlib.h>
34 #include <string.h>
35 #include <unistd.h>
36 #include "libeu.h"
37 +#include "system.h"
38
39
40 /* Prototype for option handler. */
41 --- a/lib/xmalloc.c
42 +++ b/lib/xmalloc.c
43 @@ -30,7 +30,6 @@
44 # include <config.h>
45 #endif
46
47 -#include <error.h>
48 #include <libintl.h>
49 #include <stddef.h>
50 #include <stdlib.h>
51 --- a/src/addr2line.c
52 +++ b/src/addr2line.c
53 @@ -23,7 +23,6 @@
54 #include <argp.h>
55 #include <assert.h>
56 #include <errno.h>
57 -#include <error.h>
58 #include <fcntl.h>
59 #include <inttypes.h>
60 #include <libdwfl.h>
61 --- a/src/ar.c
62 +++ b/src/ar.c
63 @@ -22,7 +22,6 @@
64
65 #include <argp.h>
66 #include <assert.h>
67 -#include <error.h>
68 #include <fcntl.h>
69 #include <gelf.h>
70 #include <libintl.h>
71 --- a/src/arlib2.c
72 +++ b/src/arlib2.c
73 @@ -20,7 +20,6 @@
74 # include <config.h>
75 #endif
76
77 -#include <error.h>
78 #include <libintl.h>
79 #include <limits.h>
80 #include <string.h>
81 --- a/src/arlib.c
82 +++ b/src/arlib.c
83 @@ -21,7 +21,6 @@
84 #endif
85
86 #include <assert.h>
87 -#include <error.h>
88 #include <gelf.h>
89 #include <inttypes.h>
90 #include <libintl.h>
91 --- a/src/elfcmp.c
92 +++ b/src/elfcmp.c
93 @@ -23,7 +23,6 @@
94 #include <argp.h>
95 #include <assert.h>
96 #include <errno.h>
97 -#include <error.h>
98 #include <fcntl.h>
99 #include <locale.h>
100 #include <libintl.h>
101 --- a/src/elflint.c
102 +++ b/src/elflint.c
103 @@ -24,7 +24,6 @@
104 #include <assert.h>
105 #include <byteswap.h>
106 #include <endian.h>
107 -#include <error.h>
108 #include <fcntl.h>
109 #include <gelf.h>
110 #include <inttypes.h>
111 --- a/src/findtextrel.c
112 +++ b/src/findtextrel.c
113 @@ -23,7 +23,6 @@
114 #include <argp.h>
115 #include <assert.h>
116 #include <errno.h>
117 -#include <error.h>
118 #include <fcntl.h>
119 #include <gelf.h>
120 #include <libdw.h>
121 --- a/src/nm.c
122 +++ b/src/nm.c
123 @@ -26,7 +26,6 @@
124 #include <ctype.h>
125 #include <dwarf.h>
126 #include <errno.h>
127 -#include <error.h>
128 #include <fcntl.h>
129 #include <gelf.h>
130 #include <inttypes.h>
131 --- a/src/objdump.c
132 +++ b/src/objdump.c
133 @@ -21,7 +21,6 @@
134 #endif
135
136 #include <argp.h>
137 -#include <error.h>
138 #include <fcntl.h>
139 #include <inttypes.h>
140 #include <libintl.h>
141 --- a/src/ranlib.c
142 +++ b/src/ranlib.c
143 @@ -24,7 +24,6 @@
144 #include <argp.h>
145 #include <assert.h>
146 #include <errno.h>
147 -#include <error.h>
148 #include <fcntl.h>
149 #include <gelf.h>
150 #include <libintl.h>
151 --- a/src/readelf.c
152 +++ b/src/readelf.c
153 @@ -25,7 +25,6 @@
154 #include <ctype.h>
155 #include <dwarf.h>
156 #include <errno.h>
157 -#include <error.h>
158 #include <fcntl.h>
159 #include <gelf.h>
160 #include <inttypes.h>
161 --- a/src/size.c
162 +++ b/src/size.c
163 @@ -21,7 +21,6 @@
164 #endif
165
166 #include <argp.h>
167 -#include <error.h>
168 #include <fcntl.h>
169 #include <gelf.h>
170 #include <inttypes.h>
171 --- a/src/stack.c
172 +++ b/src/stack.c
173 @@ -18,7 +18,6 @@
174 #include <config.h>
175 #include <assert.h>
176 #include <argp.h>
177 -#include <error.h>
178 #include <stdlib.h>
179 #include <inttypes.h>
180 #include <stdio.h>
181 --- a/src/strings.c
182 +++ b/src/strings.c
183 @@ -25,7 +25,6 @@
184 #include <ctype.h>
185 #include <endian.h>
186 #include <errno.h>
187 -#include <error.h>
188 #include <fcntl.h>
189 #include <gelf.h>
190 #include <inttypes.h>
191 --- a/src/strip.c
192 +++ b/src/strip.c
193 @@ -24,7 +24,6 @@
194 #include <assert.h>
195 #include <byteswap.h>
196 #include <endian.h>
197 -#include <error.h>
198 #include <fcntl.h>
199 #include <gelf.h>
200 #include <libelf.h>
201 --- a/src/unstrip.c
202 +++ b/src/unstrip.c
203 @@ -31,7 +31,6 @@
204 #include <argp.h>
205 #include <assert.h>
206 #include <errno.h>
207 -#include <error.h>
208 #include <fcntl.h>
209 #include <fnmatch.h>
210 #include <libintl.h>
211 --- a/tests/addrscopes.c
212 +++ b/tests/addrscopes.c
213 @@ -25,7 +25,6 @@
214 #include <stdio_ext.h>
215 #include <locale.h>
216 #include <stdlib.h>
217 -#include <error.h>
218 #include <string.h>
219
220
221 --- a/tests/allregs.c
222 +++ b/tests/allregs.c
223 @@ -21,7 +21,6 @@
224 #include <stdio.h>
225 #include <stdlib.h>
226 #include <string.h>
227 -#include <error.h>
228 #include <locale.h>
229 #include <argp.h>
230 #include <assert.h>
231 --- a/tests/backtrace.c
232 +++ b/tests/backtrace.c
233 @@ -24,7 +24,6 @@
234 #include <dirent.h>
235 #include <stdlib.h>
236 #include <errno.h>
237 -#include <error.h>
238 #include <unistd.h>
239 #include <dwarf.h>
240 #ifdef __linux__
241 --- a/tests/backtrace-data.c
242 +++ b/tests/backtrace-data.c
243 @@ -27,7 +27,6 @@
244 #include <dirent.h>
245 #include <stdlib.h>
246 #include <errno.h>
247 -#include <error.h>
248 #include <unistd.h>
249 #include <dwarf.h>
250 #if defined(__x86_64__) && defined(__linux__)
251 --- a/tests/buildid.c
252 +++ b/tests/buildid.c
253 @@ -23,7 +23,6 @@
254 #include ELFUTILS_HEADER(elf)
255 #include ELFUTILS_HEADER(dwelf)
256 #include <stdio.h>
257 -#include <error.h>
258 #include <string.h>
259 #include <stdlib.h>
260 #include <sys/types.h>
261 --- a/tests/debugaltlink.c
262 +++ b/tests/debugaltlink.c
263 @@ -23,7 +23,6 @@
264 #include ELFUTILS_HEADER(dw)
265 #include ELFUTILS_HEADER(dwelf)
266 #include <stdio.h>
267 -#include <error.h>
268 #include <string.h>
269 #include <stdlib.h>
270 #include <sys/types.h>
271 --- a/tests/debuglink.c
272 +++ b/tests/debuglink.c
273 @@ -21,7 +21,6 @@
274 #include <errno.h>
275 #include ELFUTILS_HEADER(dwelf)
276 #include <stdio.h>
277 -#include <error.h>
278 #include <string.h>
279 #include <stdlib.h>
280 #include <sys/types.h>
281 --- a/tests/dwfl-addr-sect.c
282 +++ b/tests/dwfl-addr-sect.c
283 @@ -23,7 +23,6 @@
284 #include <stdio_ext.h>
285 #include <stdlib.h>
286 #include <string.h>
287 -#include <error.h>
288 #include <locale.h>
289 #include <argp.h>
290 #include ELFUTILS_HEADER(dwfl)
291 --- a/tests/dwfl-bug-addr-overflow.c
292 +++ b/tests/dwfl-bug-addr-overflow.c
293 @@ -20,7 +20,6 @@
294 #include <inttypes.h>
295 #include <stdio.h>
296 #include <stdio_ext.h>
297 -#include <error.h>
298 #include <locale.h>
299 #include ELFUTILS_HEADER(dwfl)
300
301 --- a/tests/dwfl-bug-fd-leak.c
302 +++ b/tests/dwfl-bug-fd-leak.c
303 @@ -24,7 +24,6 @@
304 #include <dirent.h>
305 #include <stdlib.h>
306 #include <errno.h>
307 -#include <error.h>
308 #include <unistd.h>
309 #include <dwarf.h>
310
311 --- a/tests/dwfl-bug-getmodules.c
312 +++ b/tests/dwfl-bug-getmodules.c
313 @@ -18,7 +18,6 @@
314 #include <config.h>
315 #include ELFUTILS_HEADER(dwfl)
316
317 -#include <error.h>
318
319 static const Dwfl_Callbacks callbacks =
320 {
321 --- a/tests/dwfllines.c
322 +++ b/tests/dwfllines.c
323 @@ -27,7 +27,6 @@
324 #include <stdio.h>
325 #include <stdlib.h>
326 #include <string.h>
327 -#include <error.h>
328
329 int
330 main (int argc, char *argv[])
331 --- a/tests/dwflmodtest.c
332 +++ b/tests/dwflmodtest.c
333 @@ -23,7 +23,6 @@
334 #include <stdio_ext.h>
335 #include <stdlib.h>
336 #include <string.h>
337 -#include <error.h>
338 #include <locale.h>
339 #include <argp.h>
340 #include ELFUTILS_HEADER(dwfl)
341 --- a/tests/dwfl-report-elf-align.c
342 +++ b/tests/dwfl-report-elf-align.c
343 @@ -20,7 +20,6 @@
344 #include <inttypes.h>
345 #include <stdio.h>
346 #include <stdio_ext.h>
347 -#include <error.h>
348 #include <locale.h>
349 #include <string.h>
350 #include <stdlib.h>
351 --- a/tests/dwflsyms.c
352 +++ b/tests/dwflsyms.c
353 @@ -25,7 +25,6 @@
354 #include <stdio.h>
355 #include <stdio_ext.h>
356 #include <stdlib.h>
357 -#include <error.h>
358 #include <string.h>
359
360 static const char *
361 --- a/tests/early-offscn.c
362 +++ b/tests/early-offscn.c
363 @@ -19,7 +19,6 @@
364 #endif
365
366 #include <errno.h>
367 -#include <error.h>
368 #include <fcntl.h>
369 #include <gelf.h>
370 #include <stdio.h>
371 --- a/tests/ecp.c
372 +++ b/tests/ecp.c
373 @@ -20,7 +20,6 @@
374 #endif
375
376 #include <errno.h>
377 -#include <error.h>
378 #include <fcntl.h>
379 #include <gelf.h>
380 #include <stdlib.h>
381 --- a/tests/find-prologues.c
382 +++ b/tests/find-prologues.c
383 @@ -25,7 +25,6 @@
384 #include <stdio_ext.h>
385 #include <locale.h>
386 #include <stdlib.h>
387 -#include <error.h>
388 #include <string.h>
389 #include <fnmatch.h>
390
391 --- a/tests/funcretval.c
392 +++ b/tests/funcretval.c
393 @@ -25,7 +25,6 @@
394 #include <stdio_ext.h>
395 #include <locale.h>
396 #include <stdlib.h>
397 -#include <error.h>
398 #include <string.h>
399 #include <fnmatch.h>
400
401 --- a/tests/funcscopes.c
402 +++ b/tests/funcscopes.c
403 @@ -25,7 +25,6 @@
404 #include <stdio_ext.h>
405 #include <locale.h>
406 #include <stdlib.h>
407 -#include <error.h>
408 #include <string.h>
409 #include <fnmatch.h>
410
411 --- a/tests/line2addr.c
412 +++ b/tests/line2addr.c
413 @@ -26,7 +26,6 @@
414 #include <locale.h>
415 #include <stdlib.h>
416 #include <string.h>
417 -#include <error.h>
418
419
420 static void
421 --- a/tests/low_high_pc.c
422 +++ b/tests/low_high_pc.c
423 @@ -25,7 +25,6 @@
424 #include <stdio_ext.h>
425 #include <locale.h>
426 #include <stdlib.h>
427 -#include <error.h>
428 #include <string.h>
429 #include <fnmatch.h>
430
431 --- a/tests/md5-sha1-test.c
432 +++ b/tests/md5-sha1-test.c
433 @@ -19,7 +19,6 @@
434 #endif
435
436 #include <string.h>
437 -#include <error.h>
438
439 #include "md5.h"
440 #include "sha1.h"
441 --- a/tests/rdwrmmap.c
442 +++ b/tests/rdwrmmap.c
443 @@ -19,7 +19,6 @@
444 #endif
445
446 #include <errno.h>
447 -#include <error.h>
448 #include <stdio.h>
449 #include <fcntl.h>
450 #include <unistd.h>
451 --- a/tests/saridx.c
452 +++ b/tests/saridx.c
453 @@ -17,7 +17,6 @@
454
455 #include <config.h>
456
457 -#include <error.h>
458 #include <fcntl.h>
459 #include <gelf.h>
460 #include <stdio.h>
461 --- a/tests/sectiondump.c
462 +++ b/tests/sectiondump.c
463 @@ -18,7 +18,6 @@
464 #include <config.h>
465
466 #include <errno.h>
467 -#include <error.h>
468 #include <fcntl.h>
469 #include <gelf.h>
470 #include <inttypes.h>
471 --- a/tests/varlocs.c
472 +++ b/tests/varlocs.c
473 @@ -25,7 +25,6 @@
474 #include <dwarf.h>
475 #include <stdio.h>
476 #include <stdlib.h>
477 -#include <error.h>
478 #include <string.h>
479 #include <sys/types.h>
480 #include <sys/stat.h>
481 --- a/libasm/asm_end.c
482 +++ b/libasm/asm_end.c
483 @@ -32,7 +32,6 @@
484 #endif
485
486 #include <assert.h>
487 -#include <error.h>
488 #include <libintl.h>
489 #include <stdio.h>
490 #include <stdlib.h>
491 --- a/libasm/asm_newscn.c
492 +++ b/libasm/asm_newscn.c
493 @@ -32,7 +32,6 @@
494 #endif
495
496 #include <assert.h>
497 -#include <error.h>
498 #include <libintl.h>
499 #include <stdlib.h>
500 #include <string.h>
501 --- a/libcpu/i386_gendis.c
502 +++ b/libcpu/i386_gendis.c
503 @@ -31,7 +31,6 @@
504 # include <config.h>
505 #endif
506
507 -#include <error.h>
508 #include <errno.h>
509 #include <stdio.h>
510 #include <stdlib.h>
511 --- a/libcpu/i386_lex.c
512 +++ b/libcpu/i386_lex.c
513 @@ -592,7 +592,6 @@ char *i386_text;
514 #endif
515
516 #include <ctype.h>
517 -#include <error.h>
518 #include <libintl.h>
519
520 #include <libeu.h>
521 --- a/libcpu/i386_lex.l
522 +++ b/libcpu/i386_lex.l
523 @@ -31,7 +31,6 @@
524 #endif
525
526 #include <ctype.h>
527 -#include <error.h>
528 #include <libintl.h>
529
530 #include <libeu.h>
531 --- a/libcpu/i386_parse.c
532 +++ b/libcpu/i386_parse.c
533 @@ -107,7 +107,6 @@
534 #include <assert.h>
535 #include <ctype.h>
536 #include <errno.h>
537 -#include <error.h>
538 #include <inttypes.h>
539 #include <libintl.h>
540 #include <math.h>
541 --- a/libdw/libdw_alloc.c
542 +++ b/libdw/libdw_alloc.c
543 @@ -31,7 +31,6 @@
544 # include <config.h>
545 #endif
546
547 -#include <error.h>
548 #include <errno.h>
549 #include <stdlib.h>
550 #include "libdwP.h"
551 @@ -74,5 +73,5 @@ __attribute ((noreturn, visibility ("hid
552 __libdw_oom (void)
553 {
554 while (1)
555 - error (EXIT_FAILURE, ENOMEM, "libdw");
556 + error (EXIT_FAILURE, errno, gettext ("cannot allocate memory"));
557 }
558 --- a/libebl/eblopenbackend.c
559 +++ b/libebl/eblopenbackend.c
560 @@ -32,7 +32,6 @@
561
562 #include <assert.h>
563 #include <dlfcn.h>
564 -#include <error.h>
565 #include <libelfP.h>
566 #include <dwarf.h>
567 #include <stdlib.h>
568 --- a/libdwfl/dwfl_error.c
569 +++ b/libdwfl/dwfl_error.c
570 @@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
571 const char *
572 dwfl_errmsg (int error)
573 {
574 + static __thread char s[64] = "";
575 if (error == 0 || error == -1)
576 {
577 int last_error = global_error;
578 @@ -154,7 +155,8 @@ dwfl_errmsg (int error)
579 switch (error &~ 0xffff)
580 {
581 case OTHER_ERROR (ERRNO):
582 - return strerror_r (error & 0xffff, "bad", 0);
583 + strerror_r (error & 0xffff, s, sizeof(s));
584 + return s;
585 case OTHER_ERROR (LIBELF):
586 return elf_errmsg (error & 0xffff);
587 case OTHER_ERROR (LIBDW):