blob: c8d1c899013e037c0bbcd63af3163385575950a5 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001From 4b0fe80b3951f044c1c1b14d1d7f5f0b8ab67507 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2015 06:35:34 +0000
4Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
5 compiling it on musl
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9Upstream-Status: Pending
10
11 Makefile.am | 2 +-
12 lib/color.c | 2 +-
13 lib/crc32_file.c | 4 +++-
14 lib/fixedsizehash.h | 4 ++--
15 lib/system.h | 11 +++++++++++
16 lib/xmalloc.c | 2 +-
17 libasm/asm_end.c | 2 +-
18 libasm/asm_newscn.c | 2 +-
19 libcpu/i386_gendis.c | 2 +-
20 libcpu/i386_lex.c | 2 +-
21 libcpu/i386_parse.c | 2 +-
22 libdw/Makefile.am | 2 +-
23 libdw/libdw_alloc.c | 3 ++-
24 libdwfl/Makefile.am | 2 ++
25 libdwfl/dwfl_build_id_find_elf.c | 3 ++-
26 libdwfl/dwfl_error.c | 4 +++-
27 libdwfl/dwfl_module_getdwarf.c | 1 +
28 libdwfl/find-debuginfo.c | 2 +-
29 libdwfl/libdwfl_crc32_file.c | 10 ++++++++++
30 libdwfl/linux-kernel-modules.c | 1 +
31 libebl/eblopenbackend.c | 2 +-
32 libebl/eblwstrtab.c | 2 +-
33 libelf/elf.h | 9 ++++++---
34 libelf/libelf.h | 1 +
35 libelf/libelfP.h | 1 +
36 src/addr2line.c | 2 +-
37 src/ar.c | 2 +-
38 src/arlib.c | 2 +-
39 src/arlib2.c | 2 +-
40 src/elfcmp.c | 2 +-
41 src/elflint.c | 2 +-
42 src/findtextrel.c | 2 +-
43 src/i386_ld.c | 2 +-
44 src/ld.c | 2 +-
45 src/ldgeneric.c | 2 +-
46 src/ldlex.c | 2 +-
47 src/ldscript.c | 2 +-
48 src/nm.c | 2 +-
49 src/objdump.c | 2 +-
50 src/ranlib.c | 2 +-
51 src/readelf.c | 2 +-
52 src/size.c | 2 +-
53 src/stack.c | 2 +-
54 src/strings.c | 2 +-
55 src/strip.c | 2 +-
56 src/unstrip.c | 2 +-
57 tests/addrscopes.c | 2 +-
58 tests/allregs.c | 2 +-
59 tests/backtrace-data.c | 2 +-
60 tests/backtrace-dwarf.c | 2 +-
61 tests/backtrace.c | 2 +-
62 tests/buildid.c | 2 +-
63 tests/debugaltlink.c | 2 +-
64 tests/debuglink.c | 2 +-
65 tests/deleted.c | 2 +-
66 tests/dwfl-addr-sect.c | 2 +-
67 tests/dwfl-bug-addr-overflow.c | 2 +-
68 tests/dwfl-bug-fd-leak.c | 2 +-
69 tests/dwfl-bug-getmodules.c | 2 +-
70 tests/dwfl-report-elf-align.c | 2 +-
71 tests/dwfllines.c | 2 +-
72 tests/dwflmodtest.c | 2 +-
73 tests/dwflsyms.c | 2 +-
74 tests/early-offscn.c | 2 +-
75 tests/ecp.c | 2 +-
76 tests/find-prologues.c | 2 +-
77 tests/funcretval.c | 2 +-
78 tests/funcscopes.c | 2 +-
79 tests/getsrc_die.c | 2 +-
80 tests/line2addr.c | 2 +-
81 tests/low_high_pc.c | 2 +-
82 tests/md5-sha1-test.c | 2 +-
83 tests/rdwrmmap.c | 2 +-
84 tests/saridx.c | 2 +-
85 tests/sectiondump.c | 2 +-
86 tests/varlocs.c | 2 +-
87 tests/vdsosyms.c | 2 +-
88 77 files changed, 109 insertions(+), 73 deletions(-)
89
90Index: elfutils-0.164/Makefile.am
91===================================================================
92--- elfutils-0.164.orig/Makefile.am
93+++ elfutils-0.164/Makefile.am
94@@ -24,7 +24,7 @@ pkginclude_HEADERS = version.h
95
96 # Add doc back when we have some real content.
97 SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
98- backends src po tests
99+ backends po tests
100
101 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
102 COPYING COPYING-GPLV2 COPYING-LGPLV3
103Index: elfutils-0.164/lib/color.c
104===================================================================
105--- elfutils-0.164.orig/lib/color.c
106+++ elfutils-0.164/lib/color.c
107@@ -32,7 +32,7 @@
108 #endif
109
110 #include <argp.h>
111-#include <error.h>
112+#include <err.h>
113 #include <libintl.h>
114 #include <stdlib.h>
115 #include <string.h>
116Index: elfutils-0.164/lib/crc32_file.c
117===================================================================
118--- elfutils-0.164.orig/lib/crc32_file.c
119+++ elfutils-0.164/lib/crc32_file.c
120@@ -30,12 +30,14 @@
121 # include <config.h>
122 #endif
123
124-#include "system.h"
125 #include <errno.h>
126 #include <unistd.h>
127+#include <stdint.h>
128 #include <sys/stat.h>
129 #include <sys/mman.h>
130
131+#include "system.h"
132+
133 int
134 crc32_file (int fd, uint32_t *resp)
135 {
136Index: elfutils-0.164/lib/fixedsizehash.h
137===================================================================
138--- elfutils-0.164.orig/lib/fixedsizehash.h
139+++ elfutils-0.164/lib/fixedsizehash.h
140@@ -30,12 +30,12 @@
141 #include <errno.h>
142 #include <stdlib.h>
143 #include <string.h>
144-#include <sys/cdefs.h>
145 #include <sys/param.h>
146
147 #include <system.h>
148
149-#define CONCAT(t1,t2) __CONCAT (t1,t2)
150+#define CONCAT1(x,y) x##y
151+#define CONCAT(x,y) CONCAT1(x,y)
152
153 /* Before including this file the following macros must be defined:
154
155Index: elfutils-0.164/lib/system.h
156===================================================================
157--- elfutils-0.164.orig/lib/system.h
158+++ elfutils-0.164/lib/system.h
159@@ -49,6 +49,16 @@
160 #else
161 # error "Unknown byte order"
162 #endif
163+#ifndef TEMP_FAILURE_RETRY
164+#define TEMP_FAILURE_RETRY(expression) \
165+ (__extension__ \
166+ ({ long int __result; \
167+ do __result = (long int) (expression); \
168+ while (__result == -1L && errno == EINTR); \
169+ __result; }))
170+#endif
171+
172+#define error(status, errno, ...) err(status, __VA_ARGS__)
173
174 extern void *xmalloc (size_t) __attribute__ ((__malloc__));
175 extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
176Index: elfutils-0.164/lib/xmalloc.c
177===================================================================
178--- elfutils-0.164.orig/lib/xmalloc.c
179+++ elfutils-0.164/lib/xmalloc.c
180@@ -30,7 +30,7 @@
181 # include <config.h>
182 #endif
183
184-#include <error.h>
185+#include <err.h>
186 #include <libintl.h>
187 #include <stddef.h>
188 #include <stdlib.h>
189Index: elfutils-0.164/libasm/asm_end.c
190===================================================================
191--- elfutils-0.164.orig/libasm/asm_end.c
192+++ elfutils-0.164/libasm/asm_end.c
193@@ -32,7 +32,7 @@
194 #endif
195
196 #include <assert.h>
197-#include <error.h>
198+#include <err.h>
199 #include <libintl.h>
200 #include <stdio.h>
201 #include <stdlib.h>
202Index: elfutils-0.164/libasm/asm_newscn.c
203===================================================================
204--- elfutils-0.164.orig/libasm/asm_newscn.c
205+++ elfutils-0.164/libasm/asm_newscn.c
206@@ -32,7 +32,7 @@
207 #endif
208
209 #include <assert.h>
210-#include <error.h>
211+#include <err.h>
212 #include <libintl.h>
213 #include <stdlib.h>
214 #include <string.h>
215Index: elfutils-0.164/libcpu/i386_gendis.c
216===================================================================
217--- elfutils-0.164.orig/libcpu/i386_gendis.c
218+++ elfutils-0.164/libcpu/i386_gendis.c
219@@ -31,7 +31,7 @@
220 # include <config.h>
221 #endif
222
223-#include <error.h>
224+#include <err.h>
225 #include <errno.h>
226 #include <stdio.h>
227 #include <stdlib.h>
228Index: elfutils-0.164/libcpu/i386_lex.c
229===================================================================
230--- elfutils-0.164.orig/libcpu/i386_lex.c
231+++ elfutils-0.164/libcpu/i386_lex.c
232@@ -571,7 +571,7 @@ char *i386_text;
233 #endif
234
235 #include <ctype.h>
236-#include <error.h>
237+#include <err.h>
238 #include <libintl.h>
239
240 #include <system.h>
241Index: elfutils-0.164/libcpu/i386_parse.c
242===================================================================
243--- elfutils-0.164.orig/libcpu/i386_parse.c
244+++ elfutils-0.164/libcpu/i386_parse.c
245@@ -107,7 +107,7 @@
246 #include <assert.h>
247 #include <ctype.h>
248 #include <errno.h>
249-#include <error.h>
250+#include <err.h>
251 #include <inttypes.h>
252 #include <libintl.h>
253 #include <math.h>
254Index: elfutils-0.164/libdw/Makefile.am
255===================================================================
256--- elfutils-0.164.orig/libdw/Makefile.am
257+++ elfutils-0.164/libdw/Makefile.am
258@@ -117,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
259 -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
260 -Wl,--version-script,$<,--no-undefined \
261 -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
262- -ldl $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS)
263+ -ldl $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS) -lfts -largp
264 @$(textrel_check)
265 $(AM_V_at)ln -fs $@ $@.$(VERSION)
266
267Index: elfutils-0.164/libdw/libdw_alloc.c
268===================================================================
269--- elfutils-0.164.orig/libdw/libdw_alloc.c
270+++ elfutils-0.164/libdw/libdw_alloc.c
271@@ -31,11 +31,12 @@
272 # include <config.h>
273 #endif
274
275-#include <error.h>
276+#include <err.h>
277 #include <errno.h>
278 #include <stdlib.h>
279 #include <sys/param.h>
280 #include "libdwP.h"
281+#include "system.h"
282
283
284 void *
285Index: elfutils-0.164/libdwfl/Makefile.am
286===================================================================
287--- elfutils-0.164.orig/libdwfl/Makefile.am
288+++ elfutils-0.164/libdwfl/Makefile.am
289@@ -86,6 +86,8 @@ libelf = ../libelf/libelf.so
290 libebl = ../libebl/libebl.a
291 libeu = ../lib/libeu.a
292
293+LDADD = -lfts
294+
295 libdwfl_pic_a_SOURCES =
296 am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
297
298Index: elfutils-0.164/libdwfl/dwfl_build_id_find_elf.c
299===================================================================
300--- elfutils-0.164.orig/libdwfl/dwfl_build_id_find_elf.c
301+++ elfutils-0.164/libdwfl/dwfl_build_id_find_elf.c
302@@ -27,6 +27,7 @@
303 not, see <http://www.gnu.org/licenses/>. */
304
305 #include "libdwflP.h"
306+#include "system.h"
307 #include <inttypes.h>
308 #include <fcntl.h>
309 #include <unistd.h>
310@@ -94,7 +95,7 @@ __libdwfl_open_by_build_id (Dwfl_Module
311 {
312 if (*file_name != NULL)
313 free (*file_name);
314- *file_name = canonicalize_file_name (name);
315+ *file_name = realpath (name, NULL);
316 if (*file_name == NULL)
317 {
318 *file_name = name;
319Index: elfutils-0.164/libdwfl/dwfl_error.c
320===================================================================
321--- elfutils-0.164.orig/libdwfl/dwfl_error.c
322+++ elfutils-0.164/libdwfl/dwfl_error.c
323@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
324 const char *
325 dwfl_errmsg (int error)
326 {
327+ static __thread char s[64] = "";
328 if (error == 0 || error == -1)
329 {
330 int last_error = global_error;
331@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
332 switch (error &~ 0xffff)
333 {
334 case OTHER_ERROR (ERRNO):
335- return strerror_r (error & 0xffff, "bad", 0);
336+ strerror_r (error & 0xffff, s, sizeof(s));
337+ return s;
338 case OTHER_ERROR (LIBELF):
339 return elf_errmsg (error & 0xffff);
340 case OTHER_ERROR (LIBDW):
341Index: elfutils-0.164/libdwfl/dwfl_module_getdwarf.c
342===================================================================
343--- elfutils-0.164.orig/libdwfl/dwfl_module_getdwarf.c
344+++ elfutils-0.164/libdwfl/dwfl_module_getdwarf.c
345@@ -31,6 +31,7 @@
346 #include <fcntl.h>
347 #include <string.h>
348 #include <unistd.h>
349+#include "system.h"
350 #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
351 #include "../libelf/libelfP.h"
352
353Index: elfutils-0.164/libdwfl/find-debuginfo.c
354===================================================================
355--- elfutils-0.164.orig/libdwfl/find-debuginfo.c
356+++ elfutils-0.164/libdwfl/find-debuginfo.c
357@@ -372,7 +372,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul
358 /* If FILE_NAME is a symlink, the debug file might be associated
359 with the symlink target name instead. */
360
361- char *canon = canonicalize_file_name (file_name);
362+ char *canon = realpath (file_name, NULL);
363 if (canon != NULL && strcmp (file_name, canon))
364 fd = find_debuginfo_in_path (mod, canon,
365 debuglink_file, debuglink_crc,
366Index: elfutils-0.164/libdwfl/libdwfl_crc32_file.c
367===================================================================
368--- elfutils-0.164.orig/libdwfl/libdwfl_crc32_file.c
369+++ elfutils-0.164/libdwfl/libdwfl_crc32_file.c
370@@ -31,6 +31,16 @@
371
372 #define crc32_file attribute_hidden __libdwfl_crc32_file
373 #define crc32 __libdwfl_crc32
374+
375+#ifndef TEMP_FAILURE_RETRY
376+#define TEMP_FAILURE_RETRY(expression) \
377+ (__extension__ \
378+ ({ long int __result; \
379+ do __result = (long int) (expression); \
380+ while (__result == -1L && errno == EINTR); \
381+ __result; }))
382+#endif
383+
384 #define LIB_SYSTEM_H 1
385 #include <libdwflP.h>
386 #include "../lib/crc32_file.c"
387Index: elfutils-0.164/libdwfl/linux-kernel-modules.c
388===================================================================
389--- elfutils-0.164.orig/libdwfl/linux-kernel-modules.c
390+++ elfutils-0.164/libdwfl/linux-kernel-modules.c
391@@ -34,6 +34,7 @@
392 #include <config.h>
393
394 #include "libdwflP.h"
395+#include "system.h"
396 #include <inttypes.h>
397 #include <errno.h>
398 #include <stdio.h>
399Index: elfutils-0.164/libebl/eblopenbackend.c
400===================================================================
401--- elfutils-0.164.orig/libebl/eblopenbackend.c
402+++ elfutils-0.164/libebl/eblopenbackend.c
403@@ -32,7 +32,7 @@
404
405 #include <assert.h>
406 #include <dlfcn.h>
407-#include <error.h>
408+#include <err.h>
409 #include <libelfP.h>
410 #include <dwarf.h>
411 #include <stdlib.h>
412Index: elfutils-0.164/libebl/eblwstrtab.c
413===================================================================
414--- elfutils-0.164.orig/libebl/eblwstrtab.c
415+++ elfutils-0.164/libebl/eblwstrtab.c
416@@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep,
417
418 /* Process the current node. */
419 nodep->offset = *offsetp;
420- *freep = wmempcpy (*freep, nodep->string, nodep->len);
421+ *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
422 *offsetp += nodep->len * sizeof (wchar_t);
423
424 for (subs = nodep->next; subs != NULL; subs = subs->next)
425Index: elfutils-0.164/libelf/elf.h
426===================================================================
427--- elfutils-0.164.orig/libelf/elf.h
428+++ elfutils-0.164/libelf/elf.h
429@@ -21,7 +21,9 @@
430
431 #include <features.h>
432
433-__BEGIN_DECLS
434+#ifdef __cplusplus
435+extern "C" {
436+#endif
437
438 /* Standard ELF types. */
439
440@@ -3552,7 +3554,8 @@ enum
441
442 #define R_TILEGX_NUM 130
443
444-
445-__END_DECLS
446+#ifdef __cplusplus
447+}
448+#endif
449
450 #endif /* elf.h */
451Index: elfutils-0.164/libelf/libelf.h
452===================================================================
453--- elfutils-0.164.orig/libelf/libelf.h
454+++ elfutils-0.164/libelf/libelf.h
455@@ -29,6 +29,7 @@
456 #ifndef _LIBELF_H
457 #define _LIBELF_H 1
458
459+#include <fcntl.h>
460 #include <stdint.h>
461 #include <sys/types.h>
462
463Index: elfutils-0.164/libelf/libelfP.h
464===================================================================
465--- elfutils-0.164.orig/libelf/libelfP.h
466+++ elfutils-0.164/libelf/libelfP.h
467@@ -36,6 +36,7 @@
468
469 #include <ar.h>
470 #include <gelf.h>
471+#include <libelf.h>
472
473 #include <errno.h>
474 #include <stdint.h>
475Index: elfutils-0.164/src/addr2line.c
476===================================================================
477--- elfutils-0.164.orig/src/addr2line.c
478+++ elfutils-0.164/src/addr2line.c
479@@ -23,7 +23,7 @@
480 #include <argp.h>
481 #include <assert.h>
482 #include <errno.h>
483-#include <error.h>
484+#include <err.h>
485 #include <fcntl.h>
486 #include <inttypes.h>
487 #include <libdwfl.h>
488Index: elfutils-0.164/src/ar.c
489===================================================================
490--- elfutils-0.164.orig/src/ar.c
491+++ elfutils-0.164/src/ar.c
492@@ -22,7 +22,7 @@
493
494 #include <argp.h>
495 #include <assert.h>
496-#include <error.h>
497+#include <err.h>
498 #include <fcntl.h>
499 #include <gelf.h>
500 #include <libintl.h>
501Index: elfutils-0.164/src/arlib.c
502===================================================================
503--- elfutils-0.164.orig/src/arlib.c
504+++ elfutils-0.164/src/arlib.c
505@@ -21,7 +21,7 @@
506 #endif
507
508 #include <assert.h>
509-#include <error.h>
510+#include <err.h>
511 #include <gelf.h>
512 #include <libintl.h>
513 #include <stdio.h>
514Index: elfutils-0.164/src/arlib2.c
515===================================================================
516--- elfutils-0.164.orig/src/arlib2.c
517+++ elfutils-0.164/src/arlib2.c
518@@ -20,7 +20,7 @@
519 # include <config.h>
520 #endif
521
522-#include <error.h>
523+#include <err.h>
524 #include <libintl.h>
525 #include <limits.h>
526 #include <string.h>
527Index: elfutils-0.164/src/elfcmp.c
528===================================================================
529--- elfutils-0.164.orig/src/elfcmp.c
530+++ elfutils-0.164/src/elfcmp.c
531@@ -23,7 +23,7 @@
532 #include <argp.h>
533 #include <assert.h>
534 #include <errno.h>
535-#include <error.h>
536+#include <err.h>
537 #include <fcntl.h>
538 #include <locale.h>
539 #include <libintl.h>
540Index: elfutils-0.164/src/elflint.c
541===================================================================
542--- elfutils-0.164.orig/src/elflint.c
543+++ elfutils-0.164/src/elflint.c
544@@ -24,7 +24,7 @@
545 #include <assert.h>
546 #include <byteswap.h>
547 #include <endian.h>
548-#include <error.h>
549+#include <err.h>
550 #include <fcntl.h>
551 #include <gelf.h>
552 #include <inttypes.h>
553Index: elfutils-0.164/src/findtextrel.c
554===================================================================
555--- elfutils-0.164.orig/src/findtextrel.c
556+++ elfutils-0.164/src/findtextrel.c
557@@ -23,7 +23,7 @@
558 #include <argp.h>
559 #include <assert.h>
560 #include <errno.h>
561-#include <error.h>
562+#include <err.h>
563 #include <fcntl.h>
564 #include <gelf.h>
565 #include <libdw.h>
566Index: elfutils-0.164/src/i386_ld.c
567===================================================================
568--- elfutils-0.164.orig/src/i386_ld.c
569+++ elfutils-0.164/src/i386_ld.c
570@@ -20,7 +20,7 @@
571 #endif
572
573 #include <assert.h>
574-#include <error.h>
575+#include <err.h>
576 #include <libintl.h>
577 #include <stdlib.h>
578 #include <string.h>
579Index: elfutils-0.164/src/ld.c
580===================================================================
581--- elfutils-0.164.orig/src/ld.c
582+++ elfutils-0.164/src/ld.c
583@@ -21,7 +21,7 @@
584
585 #include <argp.h>
586 #include <assert.h>
587-#include <error.h>
588+#include <err.h>
589 #include <fcntl.h>
590 #include <libelf.h>
591 #include <libintl.h>
592Index: elfutils-0.164/src/ldgeneric.c
593===================================================================
594--- elfutils-0.164.orig/src/ldgeneric.c
595+++ elfutils-0.164/src/ldgeneric.c
596@@ -23,7 +23,7 @@
597 #include <ctype.h>
598 #include <dlfcn.h>
599 #include <errno.h>
600-#include <error.h>
601+#include <err.h>
602 #include <fcntl.h>
603 #include <fnmatch.h>
604 #include <gelf.h>
605Index: elfutils-0.164/src/ldlex.c
606===================================================================
607--- elfutils-0.164.orig/src/ldlex.c
608+++ elfutils-0.164/src/ldlex.c
609@@ -1099,7 +1099,7 @@ char *ldtext;
610 #include <assert.h>
611 #include <ctype.h>
612 #include <elf.h>
613-#include <error.h>
614+#include <err.h>
615 #include <inttypes.h>
616 #include <libintl.h>
617 #include <stdbool.h>
618Index: elfutils-0.164/src/ldscript.c
619===================================================================
620--- elfutils-0.164.orig/src/ldscript.c
621+++ elfutils-0.164/src/ldscript.c
622@@ -95,7 +95,7 @@
623 #endif
624
625 #include <assert.h>
626-#include <error.h>
627+#include <err.h>
628 #include <libintl.h>
629 #include <stdbool.h>
630 #include <stdint.h>
631Index: elfutils-0.164/src/nm.c
632===================================================================
633--- elfutils-0.164.orig/src/nm.c
634+++ elfutils-0.164/src/nm.c
635@@ -26,7 +26,7 @@
636 #include <ctype.h>
637 #include <dwarf.h>
638 #include <errno.h>
639-#include <error.h>
640+#include <err.h>
641 #include <fcntl.h>
642 #include <gelf.h>
643 #include <inttypes.h>
644Index: elfutils-0.164/src/objdump.c
645===================================================================
646--- elfutils-0.164.orig/src/objdump.c
647+++ elfutils-0.164/src/objdump.c
648@@ -21,7 +21,7 @@
649 #endif
650
651 #include <argp.h>
652-#include <error.h>
653+#include <err.h>
654 #include <fcntl.h>
655 #include <inttypes.h>
656 #include <libintl.h>
657Index: elfutils-0.164/src/ranlib.c
658===================================================================
659--- elfutils-0.164.orig/src/ranlib.c
660+++ elfutils-0.164/src/ranlib.c
661@@ -24,7 +24,7 @@
662 #include <argp.h>
663 #include <assert.h>
664 #include <errno.h>
665-#include <error.h>
666+#include <err.h>
667 #include <fcntl.h>
668 #include <gelf.h>
669 #include <libintl.h>
670Index: elfutils-0.164/src/readelf.c
671===================================================================
672--- elfutils-0.164.orig/src/readelf.c
673+++ elfutils-0.164/src/readelf.c
674@@ -25,7 +25,7 @@
675 #include <ctype.h>
676 #include <dwarf.h>
677 #include <errno.h>
678-#include <error.h>
679+#include <err.h>
680 #include <fcntl.h>
681 #include <gelf.h>
682 #include <inttypes.h>
683Index: elfutils-0.164/src/size.c
684===================================================================
685--- elfutils-0.164.orig/src/size.c
686+++ elfutils-0.164/src/size.c
687@@ -21,7 +21,7 @@
688 #endif
689
690 #include <argp.h>
691-#include <error.h>
692+#include <err.h>
693 #include <fcntl.h>
694 #include <gelf.h>
695 #include <inttypes.h>
696Index: elfutils-0.164/src/stack.c
697===================================================================
698--- elfutils-0.164.orig/src/stack.c
699+++ elfutils-0.164/src/stack.c
700@@ -18,7 +18,7 @@
701 #include <config.h>
702 #include <assert.h>
703 #include <argp.h>
704-#include <error.h>
705+#include <err.h>
706 #include <stdlib.h>
707 #include <inttypes.h>
708 #include <stdio.h>
709Index: elfutils-0.164/src/strings.c
710===================================================================
711--- elfutils-0.164.orig/src/strings.c
712+++ elfutils-0.164/src/strings.c
713@@ -25,7 +25,7 @@
714 #include <ctype.h>
715 #include <endian.h>
716 #include <errno.h>
717-#include <error.h>
718+#include <err.h>
719 #include <fcntl.h>
720 #include <gelf.h>
721 #include <inttypes.h>
722Index: elfutils-0.164/src/strip.c
723===================================================================
724--- elfutils-0.164.orig/src/strip.c
725+++ elfutils-0.164/src/strip.c
726@@ -24,7 +24,7 @@
727 #include <assert.h>
728 #include <byteswap.h>
729 #include <endian.h>
730-#include <error.h>
731+#include <err.h>
732 #include <fcntl.h>
733 #include <gelf.h>
734 #include <libelf.h>
735Index: elfutils-0.164/src/unstrip.c
736===================================================================
737--- elfutils-0.164.orig/src/unstrip.c
738+++ elfutils-0.164/src/unstrip.c
739@@ -31,7 +31,7 @@
740 #include <argp.h>
741 #include <assert.h>
742 #include <errno.h>
743-#include <error.h>
744+#include <err.h>
745 #include <fcntl.h>
746 #include <fnmatch.h>
747 #include <libintl.h>
748Index: elfutils-0.164/tests/addrscopes.c
749===================================================================
750--- elfutils-0.164.orig/tests/addrscopes.c
751+++ elfutils-0.164/tests/addrscopes.c
752@@ -25,7 +25,7 @@
753 #include <stdio_ext.h>
754 #include <locale.h>
755 #include <stdlib.h>
756-#include <error.h>
757+#include <err.h>
758 #include <string.h>
759
760
761Index: elfutils-0.164/tests/allregs.c
762===================================================================
763--- elfutils-0.164.orig/tests/allregs.c
764+++ elfutils-0.164/tests/allregs.c
765@@ -21,7 +21,7 @@
766 #include <stdio.h>
767 #include <stdlib.h>
768 #include <string.h>
769-#include <error.h>
770+#include <err.h>
771 #include <locale.h>
772 #include <argp.h>
773 #include <assert.h>
774Index: elfutils-0.164/tests/backtrace-data.c
775===================================================================
776--- elfutils-0.164.orig/tests/backtrace-data.c
777+++ elfutils-0.164/tests/backtrace-data.c
778@@ -27,7 +27,7 @@
779 #include <dirent.h>
780 #include <stdlib.h>
781 #include <errno.h>
782-#include <error.h>
783+#include <err.h>
784 #include <unistd.h>
785 #include <dwarf.h>
786 #if defined(__x86_64__) && defined(__linux__)
787Index: elfutils-0.164/tests/backtrace-dwarf.c
788===================================================================
789--- elfutils-0.164.orig/tests/backtrace-dwarf.c
790+++ elfutils-0.164/tests/backtrace-dwarf.c
791@@ -22,7 +22,7 @@
792 #include <stdio_ext.h>
793 #include <locale.h>
794 #include <errno.h>
795-#include <error.h>
796+#include <err.h>
797 #include <unistd.h>
798 #include <sys/ptrace.h>
799 #include <sys/types.h>
800Index: elfutils-0.164/tests/backtrace.c
801===================================================================
802--- elfutils-0.164.orig/tests/backtrace.c
803+++ elfutils-0.164/tests/backtrace.c
804@@ -24,7 +24,7 @@
805 #include <dirent.h>
806 #include <stdlib.h>
807 #include <errno.h>
808-#include <error.h>
809+#include <err.h>
810 #include <unistd.h>
811 #include <dwarf.h>
812 #ifdef __linux__
813Index: elfutils-0.164/tests/buildid.c
814===================================================================
815--- elfutils-0.164.orig/tests/buildid.c
816+++ elfutils-0.164/tests/buildid.c
817@@ -23,7 +23,7 @@
818 #include ELFUTILS_HEADER(elf)
819 #include ELFUTILS_HEADER(dwelf)
820 #include <stdio.h>
821-#include <error.h>
822+#include <err.h>
823 #include <string.h>
824 #include <stdlib.h>
825 #include <sys/types.h>
826Index: elfutils-0.164/tests/debugaltlink.c
827===================================================================
828--- elfutils-0.164.orig/tests/debugaltlink.c
829+++ elfutils-0.164/tests/debugaltlink.c
830@@ -23,7 +23,7 @@
831 #include ELFUTILS_HEADER(dw)
832 #include ELFUTILS_HEADER(dwelf)
833 #include <stdio.h>
834-#include <error.h>
835+#include <err.h>
836 #include <string.h>
837 #include <stdlib.h>
838 #include <sys/types.h>
839Index: elfutils-0.164/tests/debuglink.c
840===================================================================
841--- elfutils-0.164.orig/tests/debuglink.c
842+++ elfutils-0.164/tests/debuglink.c
843@@ -21,7 +21,7 @@
844 #include <errno.h>
845 #include ELFUTILS_HEADER(dwelf)
846 #include <stdio.h>
847-#include <error.h>
848+#include <err.h>
849 #include <string.h>
850 #include <stdlib.h>
851 #include <sys/types.h>
852Index: elfutils-0.164/tests/deleted.c
853===================================================================
854--- elfutils-0.164.orig/tests/deleted.c
855+++ elfutils-0.164/tests/deleted.c
856@@ -21,7 +21,7 @@
857 #include <unistd.h>
858 #include <assert.h>
859 #include <stdio.h>
860-#include <error.h>
861+#include <err.h>
862 #include <errno.h>
863 #ifdef __linux__
864 #include <sys/prctl.h>
865Index: elfutils-0.164/tests/dwfl-addr-sect.c
866===================================================================
867--- elfutils-0.164.orig/tests/dwfl-addr-sect.c
868+++ elfutils-0.164/tests/dwfl-addr-sect.c
869@@ -23,7 +23,7 @@
870 #include <stdio_ext.h>
871 #include <stdlib.h>
872 #include <string.h>
873-#include <error.h>
874+#include <err.h>
875 #include <locale.h>
876 #include <argp.h>
877 #include ELFUTILS_HEADER(dwfl)
878Index: elfutils-0.164/tests/dwfl-bug-addr-overflow.c
879===================================================================
880--- elfutils-0.164.orig/tests/dwfl-bug-addr-overflow.c
881+++ elfutils-0.164/tests/dwfl-bug-addr-overflow.c
882@@ -20,7 +20,7 @@
883 #include <inttypes.h>
884 #include <stdio.h>
885 #include <stdio_ext.h>
886-#include <error.h>
887+#include <err.h>
888 #include <locale.h>
889 #include ELFUTILS_HEADER(dwfl)
890
891Index: elfutils-0.164/tests/dwfl-bug-fd-leak.c
892===================================================================
893--- elfutils-0.164.orig/tests/dwfl-bug-fd-leak.c
894+++ elfutils-0.164/tests/dwfl-bug-fd-leak.c
895@@ -24,7 +24,7 @@
896 #include <dirent.h>
897 #include <stdlib.h>
898 #include <errno.h>
899-#include <error.h>
900+#include <err.h>
901 #include <unistd.h>
902 #include <dwarf.h>
903 #include <sys/resource.h>
904Index: elfutils-0.164/tests/dwfl-bug-getmodules.c
905===================================================================
906--- elfutils-0.164.orig/tests/dwfl-bug-getmodules.c
907+++ elfutils-0.164/tests/dwfl-bug-getmodules.c
908@@ -18,7 +18,7 @@
909 #include <config.h>
910 #include ELFUTILS_HEADER(dwfl)
911
912-#include <error.h>
913+#include <err.h>
914
915 static const Dwfl_Callbacks callbacks =
916 {
917Index: elfutils-0.164/tests/dwfl-report-elf-align.c
918===================================================================
919--- elfutils-0.164.orig/tests/dwfl-report-elf-align.c
920+++ elfutils-0.164/tests/dwfl-report-elf-align.c
921@@ -20,7 +20,7 @@
922 #include <inttypes.h>
923 #include <stdio.h>
924 #include <stdio_ext.h>
925-#include <error.h>
926+#include <err.h>
927 #include <locale.h>
928 #include <string.h>
929 #include <stdlib.h>
930Index: elfutils-0.164/tests/dwfllines.c
931===================================================================
932--- elfutils-0.164.orig/tests/dwfllines.c
933+++ elfutils-0.164/tests/dwfllines.c
934@@ -27,7 +27,7 @@
935 #include <stdio.h>
936 #include <stdlib.h>
937 #include <string.h>
938-#include <error.h>
939+#include <err.h>
940
941 int
942 main (int argc, char *argv[])
943Index: elfutils-0.164/tests/dwflmodtest.c
944===================================================================
945--- elfutils-0.164.orig/tests/dwflmodtest.c
946+++ elfutils-0.164/tests/dwflmodtest.c
947@@ -23,7 +23,7 @@
948 #include <stdio_ext.h>
949 #include <stdlib.h>
950 #include <string.h>
951-#include <error.h>
952+#include <err.h>
953 #include <locale.h>
954 #include <argp.h>
955 #include ELFUTILS_HEADER(dwfl)
956Index: elfutils-0.164/tests/dwflsyms.c
957===================================================================
958--- elfutils-0.164.orig/tests/dwflsyms.c
959+++ elfutils-0.164/tests/dwflsyms.c
960@@ -25,7 +25,7 @@
961 #include <stdio.h>
962 #include <stdio_ext.h>
963 #include <stdlib.h>
964-#include <error.h>
965+#include <err.h>
966 #include <string.h>
967
968 static const char *
969Index: elfutils-0.164/tests/early-offscn.c
970===================================================================
971--- elfutils-0.164.orig/tests/early-offscn.c
972+++ elfutils-0.164/tests/early-offscn.c
973@@ -19,7 +19,7 @@
974 #endif
975
976 #include <errno.h>
977-#include <error.h>
978+#include <err.h>
979 #include <fcntl.h>
980 #include <gelf.h>
981 #include <stdio.h>
982Index: elfutils-0.164/tests/ecp.c
983===================================================================
984--- elfutils-0.164.orig/tests/ecp.c
985+++ elfutils-0.164/tests/ecp.c
986@@ -20,7 +20,7 @@
987 #endif
988
989 #include <errno.h>
990-#include <error.h>
991+#include <err.h>
992 #include <fcntl.h>
993 #include <gelf.h>
994 #include <stdlib.h>
995Index: elfutils-0.164/tests/find-prologues.c
996===================================================================
997--- elfutils-0.164.orig/tests/find-prologues.c
998+++ elfutils-0.164/tests/find-prologues.c
999@@ -25,7 +25,7 @@
1000 #include <stdio_ext.h>
1001 #include <locale.h>
1002 #include <stdlib.h>
1003-#include <error.h>
1004+#include <err.h>
1005 #include <string.h>
1006 #include <fnmatch.h>
1007
1008Index: elfutils-0.164/tests/funcretval.c
1009===================================================================
1010--- elfutils-0.164.orig/tests/funcretval.c
1011+++ elfutils-0.164/tests/funcretval.c
1012@@ -25,7 +25,7 @@
1013 #include <stdio_ext.h>
1014 #include <locale.h>
1015 #include <stdlib.h>
1016-#include <error.h>
1017+#include <err.h>
1018 #include <string.h>
1019 #include <fnmatch.h>
1020
1021Index: elfutils-0.164/tests/funcscopes.c
1022===================================================================
1023--- elfutils-0.164.orig/tests/funcscopes.c
1024+++ elfutils-0.164/tests/funcscopes.c
1025@@ -25,7 +25,7 @@
1026 #include <stdio_ext.h>
1027 #include <locale.h>
1028 #include <stdlib.h>
1029-#include <error.h>
1030+#include <err.h>
1031 #include <string.h>
1032 #include <fnmatch.h>
1033
1034Index: elfutils-0.164/tests/getsrc_die.c
1035===================================================================
1036--- elfutils-0.164.orig/tests/getsrc_die.c
1037+++ elfutils-0.164/tests/getsrc_die.c
1038@@ -19,7 +19,7 @@
1039 #endif
1040
1041 #include <errno.h>
1042-#include <error.h>
1043+#include <err.h>
1044 #include <fcntl.h>
1045 #include <inttypes.h>
1046 #include <libelf.h>
1047Index: elfutils-0.164/tests/line2addr.c
1048===================================================================
1049--- elfutils-0.164.orig/tests/line2addr.c
1050+++ elfutils-0.164/tests/line2addr.c
1051@@ -26,7 +26,7 @@
1052 #include <locale.h>
1053 #include <stdlib.h>
1054 #include <string.h>
1055-#include <error.h>
1056+#include <err.h>
1057
1058
1059 static void
1060Index: elfutils-0.164/tests/low_high_pc.c
1061===================================================================
1062--- elfutils-0.164.orig/tests/low_high_pc.c
1063+++ elfutils-0.164/tests/low_high_pc.c
1064@@ -25,7 +25,7 @@
1065 #include <stdio_ext.h>
1066 #include <locale.h>
1067 #include <stdlib.h>
1068-#include <error.h>
1069+#include <err.h>
1070 #include <string.h>
1071 #include <fnmatch.h>
1072
1073Index: elfutils-0.164/tests/md5-sha1-test.c
1074===================================================================
1075--- elfutils-0.164.orig/tests/md5-sha1-test.c
1076+++ elfutils-0.164/tests/md5-sha1-test.c
1077@@ -19,7 +19,7 @@
1078 #endif
1079
1080 #include <string.h>
1081-#include <error.h>
1082+#include <err.h>
1083
1084 #include "md5.h"
1085 #include "sha1.h"
1086Index: elfutils-0.164/tests/rdwrmmap.c
1087===================================================================
1088--- elfutils-0.164.orig/tests/rdwrmmap.c
1089+++ elfutils-0.164/tests/rdwrmmap.c
1090@@ -19,7 +19,7 @@
1091 #endif
1092
1093 #include <errno.h>
1094-#include <error.h>
1095+#include <err.h>
1096 #include <stdio.h>
1097 #include <fcntl.h>
1098 #include <unistd.h>
1099Index: elfutils-0.164/tests/saridx.c
1100===================================================================
1101--- elfutils-0.164.orig/tests/saridx.c
1102+++ elfutils-0.164/tests/saridx.c
1103@@ -17,7 +17,7 @@
1104
1105 #include <config.h>
1106
1107-#include <error.h>
1108+#include <err.h>
1109 #include <fcntl.h>
1110 #include <gelf.h>
1111 #include <stdio.h>
1112Index: elfutils-0.164/tests/sectiondump.c
1113===================================================================
1114--- elfutils-0.164.orig/tests/sectiondump.c
1115+++ elfutils-0.164/tests/sectiondump.c
1116@@ -18,7 +18,7 @@
1117 #include <config.h>
1118
1119 #include <errno.h>
1120-#include <error.h>
1121+#include <err.h>
1122 #include <fcntl.h>
1123 #include <gelf.h>
1124 #include <inttypes.h>
1125Index: elfutils-0.164/tests/varlocs.c
1126===================================================================
1127--- elfutils-0.164.orig/tests/varlocs.c
1128+++ elfutils-0.164/tests/varlocs.c
1129@@ -25,7 +25,7 @@
1130 #include <dwarf.h>
1131 #include <stdio.h>
1132 #include <stdlib.h>
1133-#include <error.h>
1134+#include <err.h>
1135 #include <string.h>
1136 #include <sys/types.h>
1137 #include <sys/stat.h>
1138Index: elfutils-0.164/tests/vdsosyms.c
1139===================================================================
1140--- elfutils-0.164.orig/tests/vdsosyms.c
1141+++ elfutils-0.164/tests/vdsosyms.c
1142@@ -18,7 +18,7 @@
1143 #include <config.h>
1144 #include <assert.h>
1145 #include <errno.h>
1146-#include <error.h>
1147+#include <err.h>
1148 #include <inttypes.h>
1149 #include <stdio.h>
1150 #include <string.h>
1151Index: elfutils-0.164/libelf/elf_getarsym.c
1152===================================================================
1153--- elfutils-0.164.orig/libelf/elf_getarsym.c
1154+++ elfutils-0.164/libelf/elf_getarsym.c
1155@@ -302,7 +302,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
1156 arsym[cnt].as_off = (*u32)[cnt];
1157
1158 arsym[cnt].as_hash = _dl_elf_hash (str_data);
1159- str_data = rawmemchr (str_data, '\0') + 1;
1160+ str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
1161 }
1162
1163 /* At the end a special entry. */