blob: a42ce7b3585c65bd4e7a30bbbc97974d28d4e95f [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From ef0981744669149a00dd0439a54dac30de7b56a7 Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 16 Aug 2017 10:06:26 +0800
4Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
5 compiling it on musl
6
7Upstream-Status: Pending
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10Rebase to 0.170
11
12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Brad Bishop316dfdd2018-06-25 12:45:53 -040013
Brad Bishopd7bf8c12018-02-25 22:55:05 -050014---
15 Makefile.am | 2 +-
16 lib/color.c | 3 ++-
17 lib/fixedsizehash.h | 1 -
18 lib/system.h | 10 ++++++++++
19 lib/xmalloc.c | 2 +-
20 libasm/asm_end.c | 2 +-
21 libasm/asm_newscn.c | 2 +-
22 libcpu/i386_gendis.c | 2 +-
23 libcpu/i386_lex.c | 2 +-
24 libcpu/i386_parse.c | 2 +-
25 libdw/Makefile.am | 3 ++-
26 libdw/libdw_alloc.c | 2 +-
27 libdwfl/dwfl_build_id_find_elf.c | 3 ++-
28 libdwfl/dwfl_error.c | 4 +++-
29 libdwfl/dwfl_module_getdwarf.c | 1 +
30 libdwfl/find-debuginfo.c | 2 +-
31 libdwfl/libdwfl_crc32_file.c | 9 +++++++++
32 libdwfl/linux-kernel-modules.c | 1 +
33 libebl/eblopenbackend.c | 2 +-
34 libelf/elf.h | 8 ++++++--
35 libelf/libelf.h | 1 +
36 libelf/libelfP.h | 1 +
37 src/addr2line.c | 2 +-
38 src/ar.c | 2 +-
39 src/arlib.c | 2 +-
40 src/arlib2.c | 2 +-
41 src/elfcmp.c | 2 +-
42 src/elflint.c | 2 +-
43 src/findtextrel.c | 2 +-
44 src/nm.c | 2 +-
45 src/objdump.c | 2 +-
46 src/ranlib.c | 2 +-
47 src/readelf.c | 2 +-
48 src/size.c | 2 +-
49 src/stack.c | 2 +-
50 src/strings.c | 2 +-
51 src/strip.c | 2 +-
52 src/unstrip.c | 2 +-
53 tests/addrscopes.c | 2 +-
54 tests/allregs.c | 2 +-
55 tests/backtrace-data.c | 2 +-
56 tests/backtrace-dwarf.c | 2 +-
57 tests/backtrace.c | 2 +-
58 tests/buildid.c | 2 +-
59 tests/debugaltlink.c | 2 +-
60 tests/debuglink.c | 2 +-
61 tests/deleted.c | 2 +-
62 tests/dwfl-addr-sect.c | 2 +-
63 tests/dwfl-bug-addr-overflow.c | 2 +-
64 tests/dwfl-bug-fd-leak.c | 2 +-
65 tests/dwfl-bug-getmodules.c | 2 +-
66 tests/dwfl-report-elf-align.c | 2 +-
67 tests/dwfllines.c | 2 +-
68 tests/dwflmodtest.c | 2 +-
69 tests/dwflsyms.c | 2 +-
70 tests/early-offscn.c | 2 +-
71 tests/ecp.c | 2 +-
72 tests/find-prologues.c | 2 +-
73 tests/funcretval.c | 2 +-
74 tests/funcscopes.c | 2 +-
75 tests/getsrc_die.c | 2 +-
76 tests/line2addr.c | 2 +-
77 tests/low_high_pc.c | 2 +-
78 tests/md5-sha1-test.c | 2 +-
79 tests/rdwrmmap.c | 2 +-
80 tests/saridx.c | 2 +-
81 tests/sectiondump.c | 2 +-
82 tests/varlocs.c | 2 +-
83 tests/vdsosyms.c | 2 +-
84 69 files changed, 95 insertions(+), 64 deletions(-)
85
86diff --git a/Makefile.am b/Makefile.am
Brad Bishop316dfdd2018-06-25 12:45:53 -040087index 2ff444e7..41f77df8 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050088--- a/Makefile.am
89+++ b/Makefile.am
90@@ -28,7 +28,7 @@ pkginclude_HEADERS = version.h
91
92 # Add doc back when we have some real content.
93 SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
94- backends src po tests
95+ backends po tests
96
97 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
98 COPYING COPYING-GPLV2 COPYING-LGPLV3
99diff --git a/lib/color.c b/lib/color.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400100index f62389d5..a2a84b46 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500101--- a/lib/color.c
102+++ b/lib/color.c
103@@ -32,13 +32,14 @@
104 #endif
105
106 #include <argp.h>
107-#include <error.h>
108+#include <err.h>
109 #include <libintl.h>
110 #include <stdlib.h>
111 #include <string.h>
112 #include <unistd.h>
113 #include "libeu.h"
114 #include "color.h"
115+#include "system.h"
116
117 /* Prototype for option handler. */
118 static error_t parse_opt (int key, char *arg, struct argp_state *state);
119diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
Brad Bishop316dfdd2018-06-25 12:45:53 -0400120index dac2a5f5..43016fc3 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500121--- a/lib/fixedsizehash.h
122+++ b/lib/fixedsizehash.h
123@@ -30,7 +30,6 @@
124 #include <errno.h>
125 #include <stdlib.h>
126 #include <string.h>
127-#include <sys/cdefs.h>
128
129 #include <system.h>
130
131diff --git a/lib/system.h b/lib/system.h
Brad Bishop316dfdd2018-06-25 12:45:53 -0400132index 92033355..1a601319 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500133--- a/lib/system.h
134+++ b/lib/system.h
135@@ -50,6 +50,16 @@
136 #else
137 # error "Unknown byte order"
138 #endif
139+#ifndef TEMP_FAILURE_RETRY
140+#define TEMP_FAILURE_RETRY(expression) \
141+ (__extension__ \
142+ ({ long int __result; \
143+ do __result = (long int) (expression); \
144+ while (__result == -1L && errno == EINTR); \
145+ __result; }))
146+#endif
147+
148+#define error(status, errno, ...) err(status, __VA_ARGS__)
149
150 #ifndef MAX
151 #define MAX(m, n) ((m) < (n) ? (n) : (m))
152diff --git a/lib/xmalloc.c b/lib/xmalloc.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400153index 0cde384f..217b0541 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500154--- a/lib/xmalloc.c
155+++ b/lib/xmalloc.c
156@@ -30,7 +30,7 @@
157 # include <config.h>
158 #endif
159
160-#include <error.h>
161+#include <err.h>
162 #include <libintl.h>
163 #include <stddef.h>
164 #include <stdlib.h>
165diff --git a/libasm/asm_end.c b/libasm/asm_end.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400166index ced24f50..4ad918c4 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500167--- a/libasm/asm_end.c
168+++ b/libasm/asm_end.c
169@@ -32,7 +32,7 @@
170 #endif
171
172 #include <assert.h>
173-#include <error.h>
174+#include <err.h>
175 #include <libintl.h>
176 #include <stdio.h>
177 #include <stdlib.h>
178diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400179index ddbb25df..74a598d9 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500180--- a/libasm/asm_newscn.c
181+++ b/libasm/asm_newscn.c
182@@ -32,7 +32,7 @@
183 #endif
184
185 #include <assert.h>
186-#include <error.h>
187+#include <err.h>
188 #include <libintl.h>
189 #include <stdlib.h>
190 #include <string.h>
191diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400192index aae5eae6..6d760165 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500193--- a/libcpu/i386_gendis.c
194+++ b/libcpu/i386_gendis.c
195@@ -31,7 +31,7 @@
196 # include <config.h>
197 #endif
198
199-#include <error.h>
200+#include <err.h>
201 #include <errno.h>
202 #include <stdio.h>
203 #include <stdlib.h>
204diff --git a/libcpu/i386_lex.c b/libcpu/i386_lex.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400205index ba5f4aa5..b1e41916 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500206--- a/libcpu/i386_lex.c
207+++ b/libcpu/i386_lex.c
208@@ -577,7 +577,7 @@ char *i386_text;
209 #endif
210
211 #include <ctype.h>
212-#include <error.h>
213+#include <err.h>
214 #include <libintl.h>
215
216 #include <libeu.h>
217diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400218index 6fa7ce3d..bb270061 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500219--- a/libcpu/i386_parse.c
220+++ b/libcpu/i386_parse.c
221@@ -107,7 +107,7 @@
222 #include <assert.h>
223 #include <ctype.h>
224 #include <errno.h>
225-#include <error.h>
226+#include <err.h>
227 #include <inttypes.h>
228 #include <libintl.h>
229 #include <math.h>
230diff --git a/libdw/Makefile.am b/libdw/Makefile.am
Brad Bishop316dfdd2018-06-25 12:45:53 -0400231index ff8c291e..89e792aa 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500232--- a/libdw/Makefile.am
233+++ b/libdw/Makefile.am
234@@ -105,7 +105,8 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
235 libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \
236 ../libdwfl/libdwfl_pic.a ../libebl/libebl.a
237 libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
238-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS)
239+fts_LDADD = -lfts
240+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) $(fts_LDADD)
241 libdw_so_SOURCES =
242 libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
243 # The rpath is necessary for libebl because its $ORIGIN use will
244diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400245index 28a8cf6e..29aeb3f7 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500246--- a/libdw/libdw_alloc.c
247+++ b/libdw/libdw_alloc.c
248@@ -31,7 +31,7 @@
249 # include <config.h>
250 #endif
251
252-#include <error.h>
253+#include <err.h>
254 #include <errno.h>
255 #include <stdlib.h>
256 #include "libdwP.h"
257diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400258index ee0c1646..b06ab596 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500259--- a/libdwfl/dwfl_build_id_find_elf.c
260+++ b/libdwfl/dwfl_build_id_find_elf.c
261@@ -31,6 +31,7 @@
262 #endif
263
264 #include "libdwflP.h"
265+#include "system.h"
266 #include <inttypes.h>
267 #include <fcntl.h>
268 #include <unistd.h>
269@@ -99,7 +100,7 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
270 {
271 if (*file_name != NULL)
272 free (*file_name);
273- *file_name = canonicalize_file_name (name);
274+ *file_name = realpath (name, NULL);
275 if (*file_name == NULL)
276 {
277 *file_name = name;
278diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400279index 7bcf61cc..c345797a 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500280--- a/libdwfl/dwfl_error.c
281+++ b/libdwfl/dwfl_error.c
282@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
283 const char *
284 dwfl_errmsg (int error)
285 {
286+ static __thread char s[64] = "";
287 if (error == 0 || error == -1)
288 {
289 int last_error = global_error;
290@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
291 switch (error &~ 0xffff)
292 {
293 case OTHER_ERROR (ERRNO):
294- return strerror_r (error & 0xffff, "bad", 0);
295+ strerror_r (error & 0xffff, s, sizeof(s));
296+ return s;
297 case OTHER_ERROR (LIBELF):
298 return elf_errmsg (error & 0xffff);
299 case OTHER_ERROR (LIBDW):
300diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400301index 9775aced..511c4a6a 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500302--- a/libdwfl/dwfl_module_getdwarf.c
303+++ b/libdwfl/dwfl_module_getdwarf.c
304@@ -35,6 +35,7 @@
305 #include <fcntl.h>
306 #include <string.h>
307 #include <unistd.h>
308+#include "system.h"
309 #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
310 #include "../libelf/libelfP.h"
311 #include "system.h"
312diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400313index 6d5a42a6..9267788d 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500314--- a/libdwfl/find-debuginfo.c
315+++ b/libdwfl/find-debuginfo.c
316@@ -389,7 +389,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
317 /* If FILE_NAME is a symlink, the debug file might be associated
318 with the symlink target name instead. */
319
320- char *canon = canonicalize_file_name (file_name);
321+ char *canon = realpath (file_name, NULL);
322 if (canon != NULL && strcmp (file_name, canon))
323 fd = find_debuginfo_in_path (mod, canon,
324 debuglink_file, debuglink_crc,
325diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400326index f849128d..6f0aca1b 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500327--- a/libdwfl/libdwfl_crc32_file.c
328+++ b/libdwfl/libdwfl_crc32_file.c
329@@ -29,6 +29,15 @@
330 # include <config.h>
331 #endif
332
333+#ifndef TEMP_FAILURE_RETRY
334+#define TEMP_FAILURE_RETRY(expression) \
335+ (__extension__ \
336+ ({ long int __result; \
337+ do __result = (long int) (expression); \
338+ while (__result == -1L && errno == EINTR); \
339+ __result; }))
340+#endif
341+
342 #define crc32_file attribute_hidden __libdwfl_crc32_file
343 #define crc32 __libdwfl_crc32
344 #include <libdwflP.h>
345diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400346index 9d0fef2c..9fc09b88 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500347--- a/libdwfl/linux-kernel-modules.c
348+++ b/libdwfl/linux-kernel-modules.c
349@@ -40,6 +40,7 @@
350 #include <system.h>
351
352 #include "libdwflP.h"
353+#include "system.h"
354 #include <inttypes.h>
355 #include <errno.h>
356 #include <stdio.h>
357diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400358index 53713963..2e66dfdd 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500359--- a/libebl/eblopenbackend.c
360+++ b/libebl/eblopenbackend.c
361@@ -32,7 +32,7 @@
362
363 #include <assert.h>
364 #include <dlfcn.h>
365-#include <error.h>
366+#include <err.h>
367 #include <libelfP.h>
368 #include <dwarf.h>
369 #include <stdlib.h>
370diff --git a/libelf/elf.h b/libelf/elf.h
Brad Bishop316dfdd2018-06-25 12:45:53 -0400371index 5cf2b934..990b3afb 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500372--- a/libelf/elf.h
373+++ b/libelf/elf.h
374@@ -21,7 +21,9 @@
375
376 #include <features.h>
377
378-__BEGIN_DECLS
379+#ifdef __cplusplus
380+extern "C" {
381+#endif
382
383 /* Standard ELF types. */
384
385@@ -3705,6 +3707,8 @@ enum
386 #define R_BPF_NONE 0 /* No reloc */
387 #define R_BPF_MAP_FD 1 /* Map fd to pointer */
388
389-__END_DECLS
390+#ifdef __cplusplus
391+}
392+#endif
393
394 #endif /* elf.h */
395diff --git a/libelf/libelf.h b/libelf/libelf.h
Brad Bishop316dfdd2018-06-25 12:45:53 -0400396index 547c0f50..dd78799e 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500397--- a/libelf/libelf.h
398+++ b/libelf/libelf.h
399@@ -29,6 +29,7 @@
400 #ifndef _LIBELF_H
401 #define _LIBELF_H 1
402
403+#include <fcntl.h>
404 #include <stdint.h>
405 #include <sys/types.h>
406
407diff --git a/libelf/libelfP.h b/libelf/libelfP.h
Brad Bishop316dfdd2018-06-25 12:45:53 -0400408index 7ee6625a..58408997 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500409--- a/libelf/libelfP.h
410+++ b/libelf/libelfP.h
411@@ -32,6 +32,7 @@
412
413 #include <ar.h>
414 #include <gelf.h>
415+#include <libelf.h>
416
417 #include <errno.h>
418 #include <stdbool.h>
419diff --git a/src/addr2line.c b/src/addr2line.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400420index 444ee52c..9596fa67 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500421--- a/src/addr2line.c
422+++ b/src/addr2line.c
423@@ -23,7 +23,7 @@
424 #include <argp.h>
425 #include <assert.h>
426 #include <errno.h>
427-#include <error.h>
428+#include <err.h>
429 #include <fcntl.h>
430 #include <inttypes.h>
431 #include <libdwfl.h>
432diff --git a/src/ar.c b/src/ar.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400433index ec32cee5..4efd729c 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500434--- a/src/ar.c
435+++ b/src/ar.c
436@@ -22,7 +22,7 @@
437
438 #include <argp.h>
439 #include <assert.h>
440-#include <error.h>
441+#include <err.h>
442 #include <fcntl.h>
443 #include <gelf.h>
444 #include <libintl.h>
445diff --git a/src/arlib.c b/src/arlib.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400446index e0839aab..1143658f 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500447--- a/src/arlib.c
448+++ b/src/arlib.c
449@@ -21,7 +21,7 @@
450 #endif
451
452 #include <assert.h>
453-#include <error.h>
454+#include <err.h>
455 #include <gelf.h>
456 #include <inttypes.h>
457 #include <libintl.h>
458diff --git a/src/arlib2.c b/src/arlib2.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400459index 553fc57b..46443d0e 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500460--- a/src/arlib2.c
461+++ b/src/arlib2.c
462@@ -20,7 +20,7 @@
463 # include <config.h>
464 #endif
465
466-#include <error.h>
467+#include <err.h>
468 #include <libintl.h>
469 #include <limits.h>
470 #include <string.h>
471diff --git a/src/elfcmp.c b/src/elfcmp.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400472index 50464207..cff183fa 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500473--- a/src/elfcmp.c
474+++ b/src/elfcmp.c
475@@ -23,7 +23,7 @@
476 #include <argp.h>
477 #include <assert.h>
478 #include <errno.h>
479-#include <error.h>
480+#include <err.h>
481 #include <fcntl.h>
482 #include <locale.h>
483 #include <libintl.h>
484diff --git a/src/elflint.c b/src/elflint.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400485index df1b3a03..67d8d134 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500486--- a/src/elflint.c
487+++ b/src/elflint.c
488@@ -24,7 +24,7 @@
489 #include <assert.h>
490 #include <byteswap.h>
491 #include <endian.h>
492-#include <error.h>
493+#include <err.h>
494 #include <fcntl.h>
495 #include <gelf.h>
496 #include <inttypes.h>
497diff --git a/src/findtextrel.c b/src/findtextrel.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400498index 8f1e239a..71463af3 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500499--- a/src/findtextrel.c
500+++ b/src/findtextrel.c
501@@ -23,7 +23,7 @@
502 #include <argp.h>
503 #include <assert.h>
504 #include <errno.h>
505-#include <error.h>
506+#include <err.h>
507 #include <fcntl.h>
508 #include <gelf.h>
509 #include <libdw.h>
510diff --git a/src/nm.c b/src/nm.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400511index 969c6d35..3113c04c 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500512--- a/src/nm.c
513+++ b/src/nm.c
514@@ -26,7 +26,7 @@
515 #include <ctype.h>
516 #include <dwarf.h>
517 #include <errno.h>
518-#include <error.h>
519+#include <err.h>
520 #include <fcntl.h>
521 #include <gelf.h>
522 #include <inttypes.h>
523diff --git a/src/objdump.c b/src/objdump.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400524index 0dd9a6aa..9c8bf149 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500525--- a/src/objdump.c
526+++ b/src/objdump.c
527@@ -21,7 +21,7 @@
528 #endif
529
530 #include <argp.h>
531-#include <error.h>
532+#include <err.h>
533 #include <fcntl.h>
534 #include <inttypes.h>
535 #include <libintl.h>
536diff --git a/src/ranlib.c b/src/ranlib.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400537index cc0ee233..ae851e40 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500538--- a/src/ranlib.c
539+++ b/src/ranlib.c
540@@ -24,7 +24,7 @@
541 #include <argp.h>
542 #include <assert.h>
543 #include <errno.h>
544-#include <error.h>
545+#include <err.h>
546 #include <fcntl.h>
547 #include <gelf.h>
548 #include <libintl.h>
549diff --git a/src/readelf.c b/src/readelf.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400550index 6a27e7e0..4759a965 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500551--- a/src/readelf.c
552+++ b/src/readelf.c
553@@ -25,7 +25,7 @@
554 #include <ctype.h>
555 #include <dwarf.h>
556 #include <errno.h>
557-#include <error.h>
558+#include <err.h>
559 #include <fcntl.h>
560 #include <gelf.h>
561 #include <inttypes.h>
562diff --git a/src/size.c b/src/size.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400563index ad8dbcbb..fd83be06 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500564--- a/src/size.c
565+++ b/src/size.c
566@@ -21,7 +21,7 @@
567 #endif
568
569 #include <argp.h>
570-#include <error.h>
571+#include <err.h>
572 #include <fcntl.h>
573 #include <gelf.h>
574 #include <inttypes.h>
575diff --git a/src/stack.c b/src/stack.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400576index 6f2ff69f..6da0243d 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500577--- a/src/stack.c
578+++ b/src/stack.c
579@@ -18,7 +18,7 @@
580 #include <config.h>
581 #include <assert.h>
582 #include <argp.h>
583-#include <error.h>
584+#include <err.h>
585 #include <stdlib.h>
586 #include <inttypes.h>
587 #include <stdio.h>
588diff --git a/src/strings.c b/src/strings.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400589index 03d0f133..5c311cbd 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500590--- a/src/strings.c
591+++ b/src/strings.c
592@@ -25,7 +25,7 @@
593 #include <ctype.h>
594 #include <endian.h>
595 #include <errno.h>
596-#include <error.h>
597+#include <err.h>
598 #include <fcntl.h>
599 #include <gelf.h>
600 #include <inttypes.h>
601diff --git a/src/strip.c b/src/strip.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400602index c7830ec6..0d7f148d 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500603--- a/src/strip.c
604+++ b/src/strip.c
605@@ -24,7 +24,7 @@
606 #include <assert.h>
607 #include <byteswap.h>
608 #include <endian.h>
609-#include <error.h>
610+#include <err.h>
611 #include <fcntl.h>
612 #include <fnmatch.h>
613 #include <gelf.h>
614diff --git a/src/unstrip.c b/src/unstrip.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400615index 50749093..3d4f9525 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500616--- a/src/unstrip.c
617+++ b/src/unstrip.c
618@@ -31,7 +31,7 @@
619 #include <argp.h>
620 #include <assert.h>
621 #include <errno.h>
622-#include <error.h>
623+#include <err.h>
624 #include <fcntl.h>
625 #include <fnmatch.h>
626 #include <libintl.h>
627diff --git a/tests/addrscopes.c b/tests/addrscopes.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400628index 791569f5..54f4311b 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500629--- a/tests/addrscopes.c
630+++ b/tests/addrscopes.c
631@@ -25,7 +25,7 @@
632 #include <stdio_ext.h>
633 #include <locale.h>
634 #include <stdlib.h>
635-#include <error.h>
636+#include <err.h>
637 #include <string.h>
638
639
640diff --git a/tests/allregs.c b/tests/allregs.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400641index 286f7e3c..c9de0897 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500642--- a/tests/allregs.c
643+++ b/tests/allregs.c
644@@ -21,7 +21,7 @@
645 #include <stdio.h>
646 #include <stdlib.h>
647 #include <string.h>
648-#include <error.h>
649+#include <err.h>
650 #include <locale.h>
651 #include <argp.h>
652 #include <assert.h>
653diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400654index a387d8ff..955c27d1 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500655--- a/tests/backtrace-data.c
656+++ b/tests/backtrace-data.c
657@@ -27,7 +27,7 @@
658 #include <dirent.h>
659 #include <stdlib.h>
660 #include <errno.h>
661-#include <error.h>
662+#include <err.h>
663 #include <unistd.h>
664 #include <dwarf.h>
665 #if defined(__x86_64__) && defined(__linux__)
666diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400667index 2dc8a9a2..24ca7fb0 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500668--- a/tests/backtrace-dwarf.c
669+++ b/tests/backtrace-dwarf.c
670@@ -22,7 +22,7 @@
671 #include <stdio_ext.h>
672 #include <locale.h>
673 #include <errno.h>
674-#include <error.h>
675+#include <err.h>
676 #include <unistd.h>
677 #include <sys/types.h>
678 #include <sys/wait.h>
679diff --git a/tests/backtrace.c b/tests/backtrace.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400680index f5dd761f..a93a8f03 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500681--- a/tests/backtrace.c
682+++ b/tests/backtrace.c
683@@ -24,7 +24,7 @@
684 #include <dirent.h>
685 #include <stdlib.h>
686 #include <errno.h>
687-#include <error.h>
688+#include <err.h>
689 #include <unistd.h>
690 #include <dwarf.h>
691 #ifdef __linux__
692diff --git a/tests/buildid.c b/tests/buildid.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400693index 87c18773..2953e6bb 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500694--- a/tests/buildid.c
695+++ b/tests/buildid.c
696@@ -23,7 +23,7 @@
697 #include ELFUTILS_HEADER(elf)
698 #include ELFUTILS_HEADER(dwelf)
699 #include <stdio.h>
700-#include <error.h>
701+#include <err.h>
702 #include <string.h>
703 #include <stdlib.h>
704 #include <sys/types.h>
705diff --git a/tests/debugaltlink.c b/tests/debugaltlink.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400706index 6d97d500..ee7e559e 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500707--- a/tests/debugaltlink.c
708+++ b/tests/debugaltlink.c
709@@ -23,7 +23,7 @@
710 #include ELFUTILS_HEADER(dw)
711 #include ELFUTILS_HEADER(dwelf)
712 #include <stdio.h>
713-#include <error.h>
714+#include <err.h>
715 #include <string.h>
716 #include <stdlib.h>
717 #include <sys/types.h>
718diff --git a/tests/debuglink.c b/tests/debuglink.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400719index 935d1029..741cb814 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500720--- a/tests/debuglink.c
721+++ b/tests/debuglink.c
722@@ -21,7 +21,7 @@
723 #include <errno.h>
724 #include ELFUTILS_HEADER(dwelf)
725 #include <stdio.h>
726-#include <error.h>
727+#include <err.h>
728 #include <string.h>
729 #include <stdlib.h>
730 #include <sys/types.h>
731diff --git a/tests/deleted.c b/tests/deleted.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400732index 6be35bc2..01907113 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500733--- a/tests/deleted.c
734+++ b/tests/deleted.c
735@@ -21,7 +21,7 @@
736 #include <unistd.h>
737 #include <assert.h>
738 #include <stdio.h>
739-#include <error.h>
740+#include <err.h>
741 #include <errno.h>
742 #ifdef __linux__
743 #include <sys/prctl.h>
744diff --git a/tests/dwfl-addr-sect.c b/tests/dwfl-addr-sect.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400745index 21e470a3..1ea1e3b2 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500746--- a/tests/dwfl-addr-sect.c
747+++ b/tests/dwfl-addr-sect.c
748@@ -23,7 +23,7 @@
749 #include <stdio_ext.h>
750 #include <stdlib.h>
751 #include <string.h>
752-#include <error.h>
753+#include <err.h>
754 #include <locale.h>
755 #include <argp.h>
756 #include ELFUTILS_HEADER(dwfl)
757diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400758index aa8030e1..02c8bef9 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500759--- a/tests/dwfl-bug-addr-overflow.c
760+++ b/tests/dwfl-bug-addr-overflow.c
761@@ -20,7 +20,7 @@
762 #include <inttypes.h>
763 #include <stdio.h>
764 #include <stdio_ext.h>
765-#include <error.h>
766+#include <err.h>
767 #include <locale.h>
768 #include ELFUTILS_HEADER(dwfl)
769
770diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400771index 689cdd79..5973da39 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500772--- a/tests/dwfl-bug-fd-leak.c
773+++ b/tests/dwfl-bug-fd-leak.c
774@@ -24,7 +24,7 @@
775 #include <dirent.h>
776 #include <stdlib.h>
777 #include <errno.h>
778-#include <error.h>
779+#include <err.h>
780 #include <unistd.h>
781 #include <dwarf.h>
782
783diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400784index 1ee989f8..fd62e653 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500785--- a/tests/dwfl-bug-getmodules.c
786+++ b/tests/dwfl-bug-getmodules.c
787@@ -18,7 +18,7 @@
788 #include <config.h>
789 #include ELFUTILS_HEADER(dwfl)
790
791-#include <error.h>
792+#include <err.h>
793
794 static const Dwfl_Callbacks callbacks =
795 {
796diff --git a/tests/dwfl-report-elf-align.c b/tests/dwfl-report-elf-align.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400797index a4e97d3c..f471587c 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500798--- a/tests/dwfl-report-elf-align.c
799+++ b/tests/dwfl-report-elf-align.c
800@@ -20,7 +20,7 @@
801 #include <inttypes.h>
802 #include <stdio.h>
803 #include <stdio_ext.h>
804-#include <error.h>
805+#include <err.h>
806 #include <locale.h>
807 #include <string.h>
808 #include <stdlib.h>
809diff --git a/tests/dwfllines.c b/tests/dwfllines.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400810index 90379dd2..cbdf6c4c 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500811--- a/tests/dwfllines.c
812+++ b/tests/dwfllines.c
813@@ -27,7 +27,7 @@
814 #include <stdio.h>
815 #include <stdlib.h>
816 #include <string.h>
817-#include <error.h>
818+#include <err.h>
819
820 int
821 main (int argc, char *argv[])
822diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400823index 0027f96b..e68d3bca 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500824--- a/tests/dwflmodtest.c
825+++ b/tests/dwflmodtest.c
826@@ -23,7 +23,7 @@
827 #include <stdio_ext.h>
828 #include <stdlib.h>
829 #include <string.h>
830-#include <error.h>
831+#include <err.h>
832 #include <locale.h>
833 #include <argp.h>
834 #include ELFUTILS_HEADER(dwfl)
835diff --git a/tests/dwflsyms.c b/tests/dwflsyms.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400836index 49ac3346..cf078301 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500837--- a/tests/dwflsyms.c
838+++ b/tests/dwflsyms.c
839@@ -25,7 +25,7 @@
840 #include <stdio.h>
841 #include <stdio_ext.h>
842 #include <stdlib.h>
843-#include <error.h>
844+#include <err.h>
845 #include <string.h>
846
847 static const char *
848diff --git a/tests/early-offscn.c b/tests/early-offscn.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400849index 924cb9ef..6f60d5a3 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500850--- a/tests/early-offscn.c
851+++ b/tests/early-offscn.c
852@@ -19,7 +19,7 @@
853 #endif
854
855 #include <errno.h>
856-#include <error.h>
857+#include <err.h>
858 #include <fcntl.h>
859 #include <gelf.h>
860 #include <stdio.h>
861diff --git a/tests/ecp.c b/tests/ecp.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400862index 38a6859e..743cea5d 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500863--- a/tests/ecp.c
864+++ b/tests/ecp.c
865@@ -20,7 +20,7 @@
866 #endif
867
868 #include <errno.h>
869-#include <error.h>
870+#include <err.h>
871 #include <fcntl.h>
872 #include <gelf.h>
873 #include <stdlib.h>
874diff --git a/tests/find-prologues.c b/tests/find-prologues.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400875index ba8ae371..76f5f047 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500876--- a/tests/find-prologues.c
877+++ b/tests/find-prologues.c
878@@ -25,7 +25,7 @@
879 #include <stdio_ext.h>
880 #include <locale.h>
881 #include <stdlib.h>
882-#include <error.h>
883+#include <err.h>
884 #include <string.h>
885 #include <fnmatch.h>
886
887diff --git a/tests/funcretval.c b/tests/funcretval.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400888index 8d19d117..c8aaa93d 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500889--- a/tests/funcretval.c
890+++ b/tests/funcretval.c
891@@ -25,7 +25,7 @@
892 #include <stdio_ext.h>
893 #include <locale.h>
894 #include <stdlib.h>
895-#include <error.h>
896+#include <err.h>
897 #include <string.h>
898 #include <fnmatch.h>
899
900diff --git a/tests/funcscopes.c b/tests/funcscopes.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400901index 9c901858..dbccb89e 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500902--- a/tests/funcscopes.c
903+++ b/tests/funcscopes.c
904@@ -25,7 +25,7 @@
905 #include <stdio_ext.h>
906 #include <locale.h>
907 #include <stdlib.h>
908-#include <error.h>
909+#include <err.h>
910 #include <string.h>
911 #include <fnmatch.h>
912
913diff --git a/tests/getsrc_die.c b/tests/getsrc_die.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400914index 055aede0..9c394dd0 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500915--- a/tests/getsrc_die.c
916+++ b/tests/getsrc_die.c
917@@ -19,7 +19,7 @@
918 #endif
919
920 #include <errno.h>
921-#include <error.h>
922+#include <err.h>
923 #include <fcntl.h>
924 #include <inttypes.h>
925 #include <libelf.h>
926diff --git a/tests/line2addr.c b/tests/line2addr.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400927index e0d65d3d..9bf0023b 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500928--- a/tests/line2addr.c
929+++ b/tests/line2addr.c
930@@ -26,7 +26,7 @@
931 #include <locale.h>
932 #include <stdlib.h>
933 #include <string.h>
934-#include <error.h>
935+#include <err.h>
936
937
938 static void
939diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400940index d0f43023..8da4fbdf 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500941--- a/tests/low_high_pc.c
942+++ b/tests/low_high_pc.c
943@@ -25,7 +25,7 @@
944 #include <stdio_ext.h>
945 #include <locale.h>
946 #include <stdlib.h>
947-#include <error.h>
948+#include <err.h>
949 #include <string.h>
950 #include <fnmatch.h>
951
952diff --git a/tests/md5-sha1-test.c b/tests/md5-sha1-test.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400953index d50355e9..3c41f40b 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500954--- a/tests/md5-sha1-test.c
955+++ b/tests/md5-sha1-test.c
956@@ -19,7 +19,7 @@
957 #endif
958
959 #include <string.h>
960-#include <error.h>
961+#include <err.h>
962
963 #include "md5.h"
964 #include "sha1.h"
965diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400966index 6f027dfe..1ce5e6ed 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500967--- a/tests/rdwrmmap.c
968+++ b/tests/rdwrmmap.c
969@@ -19,7 +19,7 @@
970 #endif
971
972 #include <errno.h>
973-#include <error.h>
974+#include <err.h>
975 #include <stdio.h>
976 #include <fcntl.h>
977 #include <unistd.h>
978diff --git a/tests/saridx.c b/tests/saridx.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400979index 8a450d82..b3878013 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500980--- a/tests/saridx.c
981+++ b/tests/saridx.c
982@@ -17,7 +17,7 @@
983
984 #include <config.h>
985
986-#include <error.h>
987+#include <err.h>
988 #include <fcntl.h>
989 #include <gelf.h>
990 #include <stdio.h>
991diff --git a/tests/sectiondump.c b/tests/sectiondump.c
Brad Bishop316dfdd2018-06-25 12:45:53 -0400992index 3033fedc..8e888db3 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500993--- a/tests/sectiondump.c
994+++ b/tests/sectiondump.c
995@@ -18,7 +18,7 @@
996 #include <config.h>
997
998 #include <errno.h>
999-#include <error.h>
1000+#include <err.h>
1001 #include <fcntl.h>
1002 #include <gelf.h>
1003 #include <inttypes.h>
1004diff --git a/tests/varlocs.c b/tests/varlocs.c
Brad Bishop316dfdd2018-06-25 12:45:53 -04001005index c3fba89e..e043ea2c 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001006--- a/tests/varlocs.c
1007+++ b/tests/varlocs.c
1008@@ -25,7 +25,7 @@
1009 #include <dwarf.h>
1010 #include <stdio.h>
1011 #include <stdlib.h>
1012-#include <error.h>
1013+#include <err.h>
1014 #include <string.h>
1015 #include <sys/types.h>
1016 #include <sys/stat.h>
1017diff --git a/tests/vdsosyms.c b/tests/vdsosyms.c
Brad Bishop316dfdd2018-06-25 12:45:53 -04001018index b876c10b..afb28232 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001019--- a/tests/vdsosyms.c
1020+++ b/tests/vdsosyms.c
1021@@ -18,7 +18,7 @@
1022 #include <config.h>
1023 #include <assert.h>
1024 #include <errno.h>
1025-#include <error.h>
1026+#include <err.h>
1027 #include <inttypes.h>
1028 #include <stdio.h>
1029 #include <string.h>