add chaos_calmer branch
[15.05/openwrt.git] / package / libs / elfutils / patches / 100-musl-compat.patch
1 --- a/lib/system.h
2 +++ b/lib/system.h
3 @@ -68,6 +68,16 @@ extern int crc32_file (int fd, uint32_t
4  
5  #define gettext_noop(Str) Str
6  
7 +#ifndef TEMP_FAILURE_RETRY
8 +#define TEMP_FAILURE_RETRY(expression) \
9 +  (__extension__                                                             \
10 +    ({ long int __result;                                                    \
11 +       do __result = (long int) (expression);                                \
12 +       while (__result == -1L && errno == EINTR);                            \
13 +       __result; }))
14 +#endif
15 +
16 +#define error(status, errno, ...) err(status, __VA_ARGS__)
17  
18  static inline ssize_t __attribute__ ((unused))
19  pwrite_retry (int fd, const void *buf, size_t len, off_t off)
20 --- a/lib/color.c
21 +++ b/lib/color.c
22 @@ -32,7 +32,7 @@
23  #endif
24  
25  #include <argp.h>
26 -#include <error.h>
27 +#include <err.h>
28  #include <libintl.h>
29  #include <stdlib.h>
30  #include <string.h>
31 --- a/lib/xmalloc.c
32 +++ b/lib/xmalloc.c
33 @@ -30,7 +30,7 @@
34  # include <config.h>
35  #endif
36  
37 -#include <error.h>
38 +#include <err.h>
39  #include <libintl.h>
40  #include <stddef.h>
41  #include <stdlib.h>
42 --- a/src/addr2line.c
43 +++ b/src/addr2line.c
44 @@ -23,7 +23,7 @@
45  #include <argp.h>
46  #include <assert.h>
47  #include <errno.h>
48 -#include <error.h>
49 +#include <err.h>
50  #include <fcntl.h>
51  #include <inttypes.h>
52  #include <libdwfl.h>
53 --- a/src/ar.c
54 +++ b/src/ar.c
55 @@ -22,7 +22,7 @@
56  
57  #include <argp.h>
58  #include <assert.h>
59 -#include <error.h>
60 +#include <err.h>
61  #include <fcntl.h>
62  #include <gelf.h>
63  #include <libintl.h>
64 --- a/src/arlib2.c
65 +++ b/src/arlib2.c
66 @@ -20,7 +20,7 @@
67  # include <config.h>
68  #endif
69  
70 -#include <error.h>
71 +#include <err.h>
72  #include <libintl.h>
73  #include <limits.h>
74  #include <string.h>
75 --- a/src/arlib.c
76 +++ b/src/arlib.c
77 @@ -21,7 +21,7 @@
78  #endif
79  
80  #include <assert.h>
81 -#include <error.h>
82 +#include <err.h>
83  #include <gelf.h>
84  #include <libintl.h>
85  #include <stdio.h>
86 --- a/src/elfcmp.c
87 +++ b/src/elfcmp.c
88 @@ -23,7 +23,7 @@
89  #include <argp.h>
90  #include <assert.h>
91  #include <errno.h>
92 -#include <error.h>
93 +#include <err.h>
94  #include <fcntl.h>
95  #include <locale.h>
96  #include <libintl.h>
97 --- a/src/elflint.c
98 +++ b/src/elflint.c
99 @@ -24,7 +24,7 @@
100  #include <assert.h>
101  #include <byteswap.h>
102  #include <endian.h>
103 -#include <error.h>
104 +#include <err.h>
105  #include <fcntl.h>
106  #include <gelf.h>
107  #include <inttypes.h>
108 --- a/src/findtextrel.c
109 +++ b/src/findtextrel.c
110 @@ -23,7 +23,7 @@
111  #include <argp.h>
112  #include <assert.h>
113  #include <errno.h>
114 -#include <error.h>
115 +#include <err.h>
116  #include <fcntl.h>
117  #include <gelf.h>
118  #include <libdw.h>
119 --- a/src/i386_ld.c
120 +++ b/src/i386_ld.c
121 @@ -20,7 +20,7 @@
122  #endif
123  
124  #include <assert.h>
125 -#include <error.h>
126 +#include <err.h>
127  #include <libintl.h>
128  #include <stdlib.h>
129  #include <string.h>
130 --- a/src/ld.c
131 +++ b/src/ld.c
132 @@ -21,7 +21,7 @@
133  
134  #include <argp.h>
135  #include <assert.h>
136 -#include <error.h>
137 +#include <err.h>
138  #include <fcntl.h>
139  #include <libelf.h>
140  #include <libintl.h>
141 --- a/src/ldgeneric.c
142 +++ b/src/ldgeneric.c
143 @@ -23,7 +23,7 @@
144  #include <ctype.h>
145  #include <dlfcn.h>
146  #include <errno.h>
147 -#include <error.h>
148 +#include <err.h>
149  #include <fcntl.h>
150  #include <fnmatch.h>
151  #include <gelf.h>
152 --- a/src/ldlex.c
153 +++ b/src/ldlex.c
154 @@ -1099,7 +1099,7 @@ char *ldtext;
155  #include <assert.h>
156  #include <ctype.h>
157  #include <elf.h>
158 -#include <error.h>
159 +#include <err.h>
160  #include <inttypes.h>
161  #include <libintl.h>
162  #include <stdbool.h>
163 --- a/src/ldscript.c
164 +++ b/src/ldscript.c
165 @@ -95,7 +95,7 @@
166  #endif
167  
168  #include <assert.h>
169 -#include <error.h>
170 +#include <err.h>
171  #include <libintl.h>
172  #include <stdbool.h>
173  #include <stdint.h>
174 @@ -106,7 +106,7 @@
175  #include <system.h>
176  #include <ld.h>
177  
178 -/* The error handler.  */
179 +/* The err.handler.  */
180  static void yyerror (const char *s);
181  
182  /* Some helper functions we need to construct the data structures
183 --- a/src/nm.c
184 +++ b/src/nm.c
185 @@ -26,7 +26,7 @@
186  #include <ctype.h>
187  #include <dwarf.h>
188  #include <errno.h>
189 -#include <error.h>
190 +#include <err.h>
191  #include <fcntl.h>
192  #include <gelf.h>
193  #include <inttypes.h>
194 --- a/src/objdump.c
195 +++ b/src/objdump.c
196 @@ -21,7 +21,7 @@
197  #endif
198  
199  #include <argp.h>
200 -#include <error.h>
201 +#include <err.h>
202  #include <fcntl.h>
203  #include <inttypes.h>
204  #include <libintl.h>
205 --- a/src/ranlib.c
206 +++ b/src/ranlib.c
207 @@ -24,7 +24,7 @@
208  #include <argp.h>
209  #include <assert.h>
210  #include <errno.h>
211 -#include <error.h>
212 +#include <err.h>
213  #include <fcntl.h>
214  #include <gelf.h>
215  #include <libintl.h>
216 --- a/src/readelf.c
217 +++ b/src/readelf.c
218 @@ -25,7 +25,7 @@
219  #include <ctype.h>
220  #include <dwarf.h>
221  #include <errno.h>
222 -#include <error.h>
223 +#include <err.h>
224  #include <fcntl.h>
225  #include <gelf.h>
226  #include <inttypes.h>
227 --- a/src/size.c
228 +++ b/src/size.c
229 @@ -21,7 +21,7 @@
230  #endif
231  
232  #include <argp.h>
233 -#include <error.h>
234 +#include <err.h>
235  #include <fcntl.h>
236  #include <gelf.h>
237  #include <inttypes.h>
238 --- a/src/stack.c
239 +++ b/src/stack.c
240 @@ -18,7 +18,7 @@
241  #include <config.h>
242  #include <assert.h>
243  #include <argp.h>
244 -#include <error.h>
245 +#include <err.h>
246  #include <stdlib.h>
247  #include <inttypes.h>
248  #include <stdio.h>
249 --- a/src/strings.c
250 +++ b/src/strings.c
251 @@ -25,7 +25,7 @@
252  #include <ctype.h>
253  #include <endian.h>
254  #include <errno.h>
255 -#include <error.h>
256 +#include <err.h>
257  #include <fcntl.h>
258  #include <gelf.h>
259  #include <inttypes.h>
260 --- a/src/strip.c
261 +++ b/src/strip.c
262 @@ -24,7 +24,7 @@
263  #include <assert.h>
264  #include <byteswap.h>
265  #include <endian.h>
266 -#include <error.h>
267 +#include <err.h>
268  #include <fcntl.h>
269  #include <gelf.h>
270  #include <libelf.h>
271 --- a/src/unstrip.c
272 +++ b/src/unstrip.c
273 @@ -31,7 +31,7 @@
274  #include <argp.h>
275  #include <assert.h>
276  #include <errno.h>
277 -#include <error.h>
278 +#include <err.h>
279  #include <fcntl.h>
280  #include <fnmatch.h>
281  #include <libintl.h>
282 --- a/tests/addrscopes.c
283 +++ b/tests/addrscopes.c
284 @@ -25,7 +25,7 @@
285  #include <stdio_ext.h>
286  #include <locale.h>
287  #include <stdlib.h>
288 -#include <error.h>
289 +#include <err.h>
290  #include <string.h>
291  
292  
293 --- a/tests/allregs.c
294 +++ b/tests/allregs.c
295 @@ -21,7 +21,7 @@
296  #include <stdio.h>
297  #include <stdlib.h>
298  #include <string.h>
299 -#include <error.h>
300 +#include <err.h>
301  #include <locale.h>
302  #include <argp.h>
303  #include <assert.h>
304 --- a/tests/backtrace.c
305 +++ b/tests/backtrace.c
306 @@ -24,7 +24,7 @@
307  #include <dirent.h>
308  #include <stdlib.h>
309  #include <errno.h>
310 -#include <error.h>
311 +#include <err.h>
312  #include <unistd.h>
313  #include <dwarf.h>
314  #include <sys/resource.h>
315 --- a/tests/backtrace-data.c
316 +++ b/tests/backtrace-data.c
317 @@ -27,7 +27,7 @@
318  #include <dirent.h>
319  #include <stdlib.h>
320  #include <errno.h>
321 -#include <error.h>
322 +#include <err.h>
323  #include <unistd.h>
324  #include <dwarf.h>
325  #include <sys/resource.h>
326 --- a/tests/buildid.c
327 +++ b/tests/buildid.c
328 @@ -23,7 +23,7 @@
329  #include ELFUTILS_HEADER(elf)
330  #include ELFUTILS_HEADER(dwelf)
331  #include <stdio.h>
332 -#include <error.h>
333 +#include <err.h>
334  #include <string.h>
335  #include <stdlib.h>
336  #include <sys/types.h>
337 --- a/tests/debugaltlink.c
338 +++ b/tests/debugaltlink.c
339 @@ -23,7 +23,7 @@
340  #include ELFUTILS_HEADER(dw)
341  #include ELFUTILS_HEADER(dwelf)
342  #include <stdio.h>
343 -#include <error.h>
344 +#include <err.h>
345  #include <string.h>
346  #include <stdlib.h>
347  #include <sys/types.h>
348 --- a/tests/debuglink.c
349 +++ b/tests/debuglink.c
350 @@ -21,7 +21,7 @@
351  #include <errno.h>
352  #include ELFUTILS_HEADER(dwelf)
353  #include <stdio.h>
354 -#include <error.h>
355 +#include <err.h>
356  #include <string.h>
357  #include <stdlib.h>
358  #include <sys/types.h>
359 --- a/tests/dwfl-addr-sect.c
360 +++ b/tests/dwfl-addr-sect.c
361 @@ -23,7 +23,7 @@
362  #include <stdio_ext.h>
363  #include <stdlib.h>
364  #include <string.h>
365 -#include <error.h>
366 +#include <err.h>
367  #include <locale.h>
368  #include <argp.h>
369  #include ELFUTILS_HEADER(dwfl)
370 --- a/tests/dwfl-bug-addr-overflow.c
371 +++ b/tests/dwfl-bug-addr-overflow.c
372 @@ -20,7 +20,7 @@
373  #include <inttypes.h>
374  #include <stdio.h>
375  #include <stdio_ext.h>
376 -#include <error.h>
377 +#include <err.h>
378  #include <locale.h>
379  #include ELFUTILS_HEADER(dwfl)
380  
381 --- a/tests/dwfl-bug-fd-leak.c
382 +++ b/tests/dwfl-bug-fd-leak.c
383 @@ -24,7 +24,7 @@
384  #include <dirent.h>
385  #include <stdlib.h>
386  #include <errno.h>
387 -#include <error.h>
388 +#include <err.h>
389  #include <unistd.h>
390  #include <dwarf.h>
391  #include <sys/resource.h>
392 --- a/tests/dwfl-bug-getmodules.c
393 +++ b/tests/dwfl-bug-getmodules.c
394 @@ -18,7 +18,7 @@
395  #include <config.h>
396  #include ELFUTILS_HEADER(dwfl)
397  
398 -#include <error.h>
399 +#include <err.h>
400  
401  static const Dwfl_Callbacks callbacks =
402    {
403 --- a/tests/dwfllines.c
404 +++ b/tests/dwfllines.c
405 @@ -27,7 +27,7 @@
406  #include <stdio.h>
407  #include <stdlib.h>
408  #include <string.h>
409 -#include <error.h>
410 +#include <err.h>
411  
412  int
413  main (int argc, char *argv[])
414 --- a/tests/dwflmodtest.c
415 +++ b/tests/dwflmodtest.c
416 @@ -23,7 +23,7 @@
417  #include <stdio_ext.h>
418  #include <stdlib.h>
419  #include <string.h>
420 -#include <error.h>
421 +#include <err.h>
422  #include <locale.h>
423  #include <argp.h>
424  #include ELFUTILS_HEADER(dwfl)
425 --- a/tests/dwfl-report-elf-align.c
426 +++ b/tests/dwfl-report-elf-align.c
427 @@ -20,7 +20,7 @@
428  #include <inttypes.h>
429  #include <stdio.h>
430  #include <stdio_ext.h>
431 -#include <error.h>
432 +#include <err.h>
433  #include <locale.h>
434  #include <string.h>
435  #include <stdlib.h>
436 --- a/tests/dwflsyms.c
437 +++ b/tests/dwflsyms.c
438 @@ -25,7 +25,7 @@
439  #include <stdio.h>
440  #include <stdio_ext.h>
441  #include <stdlib.h>
442 -#include <error.h>
443 +#include <err.h>
444  #include <string.h>
445  
446  static const char *
447 --- a/tests/early-offscn.c
448 +++ b/tests/early-offscn.c
449 @@ -19,7 +19,7 @@
450  #endif
451  
452  #include <errno.h>
453 -#include <error.h>
454 +#include <err.h>
455  #include <fcntl.h>
456  #include <gelf.h>
457  #include <stdio.h>
458 --- a/tests/ecp.c
459 +++ b/tests/ecp.c
460 @@ -16,7 +16,7 @@
461     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
462  
463  #include <errno.h>
464 -#include <error.h>
465 +#include <err.h>
466  #include <fcntl.h>
467  #include <gelf.h>
468  #include <stdlib.h>
469 --- a/tests/find-prologues.c
470 +++ b/tests/find-prologues.c
471 @@ -25,7 +25,7 @@
472  #include <stdio_ext.h>
473  #include <locale.h>
474  #include <stdlib.h>
475 -#include <error.h>
476 +#include <err.h>
477  #include <string.h>
478  #include <fnmatch.h>
479  
480 --- a/tests/funcretval.c
481 +++ b/tests/funcretval.c
482 @@ -25,7 +25,7 @@
483  #include <stdio_ext.h>
484  #include <locale.h>
485  #include <stdlib.h>
486 -#include <error.h>
487 +#include <err.h>
488  #include <string.h>
489  #include <fnmatch.h>
490  
491 --- a/tests/funcscopes.c
492 +++ b/tests/funcscopes.c
493 @@ -25,7 +25,7 @@
494  #include <stdio_ext.h>
495  #include <locale.h>
496  #include <stdlib.h>
497 -#include <error.h>
498 +#include <err.h>
499  #include <string.h>
500  #include <fnmatch.h>
501  
502 --- a/tests/line2addr.c
503 +++ b/tests/line2addr.c
504 @@ -26,7 +26,7 @@
505  #include <locale.h>
506  #include <stdlib.h>
507  #include <string.h>
508 -#include <error.h>
509 +#include <err.h>
510  
511  
512  static void
513 --- a/tests/low_high_pc.c
514 +++ b/tests/low_high_pc.c
515 @@ -25,7 +25,7 @@
516  #include <stdio_ext.h>
517  #include <locale.h>
518  #include <stdlib.h>
519 -#include <error.h>
520 +#include <err.h>
521  #include <string.h>
522  #include <fnmatch.h>
523  
524 --- a/tests/md5-sha1-test.c
525 +++ b/tests/md5-sha1-test.c
526 @@ -19,7 +19,7 @@
527  #endif
528  
529  #include <string.h>
530 -#include <error.h>
531 +#include <err.h>
532  
533  #include "md5.h"
534  #include "sha1.h"
535 --- a/tests/rdwrmmap.c
536 +++ b/tests/rdwrmmap.c
537 @@ -15,7 +15,7 @@
538     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
539  
540  #include <errno.h>
541 -#include <error.h>
542 +#include <err.h>
543  #include <stdio.h>
544  #include <fcntl.h>
545  #include <unistd.h>
546 --- a/tests/saridx.c
547 +++ b/tests/saridx.c
548 @@ -17,7 +17,7 @@
549  
550  #include <config.h>
551  
552 -#include <error.h>
553 +#include <err.h>
554  #include <fcntl.h>
555  #include <gelf.h>
556  #include <stdio.h>
557 --- a/tests/sectiondump.c
558 +++ b/tests/sectiondump.c
559 @@ -18,7 +18,7 @@
560  #include <config.h>
561  
562  #include <errno.h>
563 -#include <error.h>
564 +#include <err.h>
565  #include <fcntl.h>
566  #include <gelf.h>
567  #include <inttypes.h>
568 --- a/tests/varlocs.c
569 +++ b/tests/varlocs.c
570 @@ -25,7 +25,7 @@
571  #include <dwarf.h>
572  #include <stdio.h>
573  #include <stdlib.h>
574 -#include <error.h>
575 +#include <err.h>
576  #include <string.h>
577  #include <sys/types.h>
578  #include <sys/stat.h>
579 --- a/libelf/libelf.h
580 +++ b/libelf/libelf.h
581 @@ -29,6 +29,7 @@
582  #ifndef _LIBELF_H
583  #define _LIBELF_H 1
584  
585 +#include <fcntl.h>
586  #include <sys/types.h>
587  
588  /* Get the ELF types.  */
589 --- a/libasm/asm_end.c
590 +++ b/libasm/asm_end.c
591 @@ -32,7 +32,7 @@
592  #endif
593  
594  #include <assert.h>
595 -#include <error.h>
596 +#include <err.h>
597  #include <libintl.h>
598  #include <stdio.h>
599  #include <stdlib.h>
600 --- a/libasm/asm_newscn.c
601 +++ b/libasm/asm_newscn.c
602 @@ -32,7 +32,7 @@
603  #endif
604  
605  #include <assert.h>
606 -#include <error.h>
607 +#include <err.h>
608  #include <libintl.h>
609  #include <stdlib.h>
610  #include <string.h>
611 --- a/libcpu/i386_gendis.c
612 +++ b/libcpu/i386_gendis.c
613 @@ -31,7 +31,7 @@
614  # include <config.h>
615  #endif
616  
617 -#include <error.h>
618 +#include <err.h>
619  #include <errno.h>
620  #include <stdio.h>
621  #include <stdlib.h>
622 --- a/libcpu/i386_lex.c
623 +++ b/libcpu/i386_lex.c
624 @@ -571,7 +571,7 @@ char *i386_text;
625  #endif
626  
627  #include <ctype.h>
628 -#include <error.h>
629 +#include <err.h>
630  #include <libintl.h>
631  
632  #include <system.h>
633 --- a/libcpu/i386_lex.l
634 +++ b/libcpu/i386_lex.l
635 @@ -31,7 +31,7 @@
636  #endif
637  
638  #include <ctype.h>
639 -#include <error.h>
640 +#include <err.h>
641  #include <libintl.h>
642  
643  #include <system.h>
644 --- a/libcpu/i386_parse.c
645 +++ b/libcpu/i386_parse.c
646 @@ -107,7 +107,7 @@
647  #include <assert.h>
648  #include <ctype.h>
649  #include <errno.h>
650 -#include <error.h>
651 +#include <err.h>
652  #include <inttypes.h>
653  #include <libintl.h>
654  #include <math.h>
655 --- a/libdw/libdw_alloc.c
656 +++ b/libdw/libdw_alloc.c
657 @@ -31,7 +31,7 @@
658  # include <config.h>
659  #endif
660  
661 -#include <error.h>
662 +#include <err.h>
663  #include <errno.h>
664  #include <stdlib.h>
665  #include <sys/param.h>
666 @@ -74,5 +74,5 @@ __attribute ((noreturn, visibility ("hid
667  __libdw_oom (void)
668  {
669    while (1)
670 -    error (EXIT_FAILURE, ENOMEM, "libdw");
671 +    err (EXIT_FAILURE, "libdw: out of memory");
672  }
673 --- a/libebl/eblopenbackend.c
674 +++ b/libebl/eblopenbackend.c
675 @@ -32,7 +32,7 @@
676  
677  #include <assert.h>
678  #include <dlfcn.h>
679 -#include <error.h>
680 +#include <err.h>
681  #include <libelfP.h>
682  #include <dwarf.h>
683  #include <stdlib.h>
684 --- a/src/ldlex.l
685 +++ b/src/ldlex.l
686 @@ -23,7 +23,7 @@
687  #include <assert.h>
688  #include <ctype.h>
689  #include <elf.h>
690 -#include <error.h>
691 +#include <err.h>
692  #include <inttypes.h>
693  #include <libintl.h>
694  #include <stdbool.h>
695 --- a/libebl/eblwstrtab.c
696 +++ b/libebl/eblwstrtab.c
697 @@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep,
698  
699    /* Process the current node.  */
700    nodep->offset = *offsetp;
701 -  *freep = wmempcpy (*freep, nodep->string, nodep->len);
702 +  *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
703    *offsetp += nodep->len * sizeof (wchar_t);
704  
705    for (subs = nodep->next; subs != NULL; subs = subs->next)
706 --- a/libdwfl/dwfl_error.c
707 +++ b/libdwfl/dwfl_error.c
708 @@ -128,6 +128,7 @@ const char *
709  dwfl_errmsg (error)
710       int error;
711  {
712 +  static __thread char s[64] = "";
713    if (error == 0 || error == -1)
714      {
715        int last_error = global_error;
716 @@ -142,7 +143,8 @@ dwfl_errmsg (error)
717    switch (error &~ 0xffff)
718      {
719      case OTHER_ERROR (ERRNO):
720 -      return strerror_r (error & 0xffff, "bad", 0);
721 +      strerror_r (error & 0xffff, s, sizeof(s));
722 +      return s;
723      case OTHER_ERROR (LIBELF):
724        return elf_errmsg (error & 0xffff);
725      case OTHER_ERROR (LIBDW):
726 --- a/libdwfl/libdwfl.h
727 +++ b/libdwfl/libdwfl.h
728 @@ -31,6 +31,27 @@
729  
730  #include "libdw.h"
731  #include <stdio.h>
732 +#include <unistd.h>
733 +#include <alloca.h>
734 +#include <string.h>
735 +
736 +#ifndef TEMP_FAILURE_RETRY
737 +#define TEMP_FAILURE_RETRY(expression) \
738 +  (__extension__                                                              \
739 +    ({ long int __result;                                                     \
740 +       do __result = (long int) (expression);                                 \
741 +       while (__result == -1L && errno == EINTR);                             \
742 +       __result; }))
743 +#endif
744 +
745 +#ifndef strndupa
746 +#define strndupa(s, n) \
747 +       (__extension__ ({const char *__in = (s); \
748 +                        size_t __len = strnlen (__in, (n)) + 1; \
749 +                        char *__out = (char *) alloca (__len); \
750 +                        __out[__len-1] = '\0'; \
751 +                        (char *) memcpy (__out, __in, __len-1);}))
752 +#endif
753  
754  /* Handle for a session using the library.  */
755  typedef struct Dwfl Dwfl;
756 --- a/libdwfl/find-debuginfo.c
757 +++ b/libdwfl/find-debuginfo.c
758 @@ -338,7 +338,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul
759        /* If FILE_NAME is a symlink, the debug file might be associated
760          with the symlink target name instead.  */
761  
762 -      char *canon = canonicalize_file_name (file_name);
763 +      char *canon = realpath (file_name, NULL);
764        if (canon != NULL && strcmp (file_name, canon))
765         fd = find_debuginfo_in_path (mod, canon,
766                                      debuglink_file, debuglink_crc,
767 --- a/libdwfl/dwfl_build_id_find_elf.c
768 +++ b/libdwfl/dwfl_build_id_find_elf.c
769 @@ -80,7 +80,7 @@ __libdwfl_open_by_build_id (Dwfl_Module
770         {
771           if (*file_name != NULL)
772             free (*file_name);
773 -         *file_name = canonicalize_file_name (name);
774 +         *file_name = realpath (name, NULL);
775           if (*file_name == NULL)
776             {
777               *file_name = name;
778 --- a/libelf/elf_getarsym.c
779 +++ b/libelf/elf_getarsym.c
780 @@ -284,7 +284,7 @@ elf_getarsym (elf, ptr)
781                 arsym[cnt].as_off = file_data->u32[cnt];
782  
783               arsym[cnt].as_hash = _dl_elf_hash (str_data);
784 -             str_data = rawmemchr (str_data, '\0') + 1;
785 +             str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
786             }
787  
788           /* At the end a special entry.  */