]> code.ossystems Code Review - openembedded-core.git/blob
a42ce7b3585c65bd4e7a30bbbc97974d28d4e95f
[openembedded-core.git] /
1 From ef0981744669149a00dd0439a54dac30de7b56a7 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Wed, 16 Aug 2017 10:06:26 +0800
4 Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
5  compiling it on musl
6
7 Upstream-Status: Pending
8 Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10 Rebase to 0.170
11
12 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
13
14 ---
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
86 diff --git a/Makefile.am b/Makefile.am
87 index 2ff444e7..41f77df8 100644
88 --- 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
99 diff --git a/lib/color.c b/lib/color.c
100 index f62389d5..a2a84b46 100644
101 --- 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);
119 diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
120 index dac2a5f5..43016fc3 100644
121 --- 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  
131 diff --git a/lib/system.h b/lib/system.h
132 index 92033355..1a601319 100644
133 --- 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))
152 diff --git a/lib/xmalloc.c b/lib/xmalloc.c
153 index 0cde384f..217b0541 100644
154 --- 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>
165 diff --git a/libasm/asm_end.c b/libasm/asm_end.c
166 index ced24f50..4ad918c4 100644
167 --- 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>
178 diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c
179 index ddbb25df..74a598d9 100644
180 --- 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>
191 diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c
192 index aae5eae6..6d760165 100644
193 --- 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>
204 diff --git a/libcpu/i386_lex.c b/libcpu/i386_lex.c
205 index ba5f4aa5..b1e41916 100644
206 --- 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>
217 diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c
218 index 6fa7ce3d..bb270061 100644
219 --- 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>
230 diff --git a/libdw/Makefile.am b/libdw/Makefile.am
231 index ff8c291e..89e792aa 100644
232 --- 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
244 diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
245 index 28a8cf6e..29aeb3f7 100644
246 --- 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"
257 diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
258 index ee0c1646..b06ab596 100644
259 --- 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;
278 diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
279 index 7bcf61cc..c345797a 100644
280 --- 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):
300 diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
301 index 9775aced..511c4a6a 100644
302 --- 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"
312 diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
313 index 6d5a42a6..9267788d 100644
314 --- 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,
325 diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c
326 index f849128d..6f0aca1b 100644
327 --- 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>
345 diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
346 index 9d0fef2c..9fc09b88 100644
347 --- 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>
357 diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
358 index 53713963..2e66dfdd 100644
359 --- 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>
370 diff --git a/libelf/elf.h b/libelf/elf.h
371 index 5cf2b934..990b3afb 100644
372 --- 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 */
395 diff --git a/libelf/libelf.h b/libelf/libelf.h
396 index 547c0f50..dd78799e 100644
397 --- 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  
407 diff --git a/libelf/libelfP.h b/libelf/libelfP.h
408 index 7ee6625a..58408997 100644
409 --- 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>
419 diff --git a/src/addr2line.c b/src/addr2line.c
420 index 444ee52c..9596fa67 100644
421 --- 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>
432 diff --git a/src/ar.c b/src/ar.c
433 index ec32cee5..4efd729c 100644
434 --- 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>
445 diff --git a/src/arlib.c b/src/arlib.c
446 index e0839aab..1143658f 100644
447 --- 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>
458 diff --git a/src/arlib2.c b/src/arlib2.c
459 index 553fc57b..46443d0e 100644
460 --- 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>
471 diff --git a/src/elfcmp.c b/src/elfcmp.c
472 index 50464207..cff183fa 100644
473 --- 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>
484 diff --git a/src/elflint.c b/src/elflint.c
485 index df1b3a03..67d8d134 100644
486 --- 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>
497 diff --git a/src/findtextrel.c b/src/findtextrel.c
498 index 8f1e239a..71463af3 100644
499 --- 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>
510 diff --git a/src/nm.c b/src/nm.c
511 index 969c6d35..3113c04c 100644
512 --- 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>
523 diff --git a/src/objdump.c b/src/objdump.c
524 index 0dd9a6aa..9c8bf149 100644
525 --- 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>
536 diff --git a/src/ranlib.c b/src/ranlib.c
537 index cc0ee233..ae851e40 100644
538 --- 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>
549 diff --git a/src/readelf.c b/src/readelf.c
550 index 6a27e7e0..4759a965 100644
551 --- 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>
562 diff --git a/src/size.c b/src/size.c
563 index ad8dbcbb..fd83be06 100644
564 --- 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>
575 diff --git a/src/stack.c b/src/stack.c
576 index 6f2ff69f..6da0243d 100644
577 --- 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>
588 diff --git a/src/strings.c b/src/strings.c
589 index 03d0f133..5c311cbd 100644
590 --- 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>
601 diff --git a/src/strip.c b/src/strip.c
602 index c7830ec6..0d7f148d 100644
603 --- 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>
614 diff --git a/src/unstrip.c b/src/unstrip.c
615 index 50749093..3d4f9525 100644
616 --- 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>
627 diff --git a/tests/addrscopes.c b/tests/addrscopes.c
628 index 791569f5..54f4311b 100644
629 --- 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  
640 diff --git a/tests/allregs.c b/tests/allregs.c
641 index 286f7e3c..c9de0897 100644
642 --- 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>
653 diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
654 index a387d8ff..955c27d1 100644
655 --- 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__)
666 diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
667 index 2dc8a9a2..24ca7fb0 100644
668 --- 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>
679 diff --git a/tests/backtrace.c b/tests/backtrace.c
680 index f5dd761f..a93a8f03 100644
681 --- 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__
692 diff --git a/tests/buildid.c b/tests/buildid.c
693 index 87c18773..2953e6bb 100644
694 --- 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>
705 diff --git a/tests/debugaltlink.c b/tests/debugaltlink.c
706 index 6d97d500..ee7e559e 100644
707 --- 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>
718 diff --git a/tests/debuglink.c b/tests/debuglink.c
719 index 935d1029..741cb814 100644
720 --- 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>
731 diff --git a/tests/deleted.c b/tests/deleted.c
732 index 6be35bc2..01907113 100644
733 --- 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>
744 diff --git a/tests/dwfl-addr-sect.c b/tests/dwfl-addr-sect.c
745 index 21e470a3..1ea1e3b2 100644
746 --- 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)
757 diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c
758 index aa8030e1..02c8bef9 100644
759 --- 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  
770 diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c
771 index 689cdd79..5973da39 100644
772 --- 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  
783 diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c
784 index 1ee989f8..fd62e653 100644
785 --- 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    {
796 diff --git a/tests/dwfl-report-elf-align.c b/tests/dwfl-report-elf-align.c
797 index a4e97d3c..f471587c 100644
798 --- 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>
809 diff --git a/tests/dwfllines.c b/tests/dwfllines.c
810 index 90379dd2..cbdf6c4c 100644
811 --- 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[])
822 diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c
823 index 0027f96b..e68d3bca 100644
824 --- 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)
835 diff --git a/tests/dwflsyms.c b/tests/dwflsyms.c
836 index 49ac3346..cf078301 100644
837 --- 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 *
848 diff --git a/tests/early-offscn.c b/tests/early-offscn.c
849 index 924cb9ef..6f60d5a3 100644
850 --- 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>
861 diff --git a/tests/ecp.c b/tests/ecp.c
862 index 38a6859e..743cea5d 100644
863 --- 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>
874 diff --git a/tests/find-prologues.c b/tests/find-prologues.c
875 index ba8ae371..76f5f047 100644
876 --- 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  
887 diff --git a/tests/funcretval.c b/tests/funcretval.c
888 index 8d19d117..c8aaa93d 100644
889 --- 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  
900 diff --git a/tests/funcscopes.c b/tests/funcscopes.c
901 index 9c901858..dbccb89e 100644
902 --- 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  
913 diff --git a/tests/getsrc_die.c b/tests/getsrc_die.c
914 index 055aede0..9c394dd0 100644
915 --- 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>
926 diff --git a/tests/line2addr.c b/tests/line2addr.c
927 index e0d65d3d..9bf0023b 100644
928 --- 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
939 diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
940 index d0f43023..8da4fbdf 100644
941 --- 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  
952 diff --git a/tests/md5-sha1-test.c b/tests/md5-sha1-test.c
953 index d50355e9..3c41f40b 100644
954 --- 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"
965 diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c
966 index 6f027dfe..1ce5e6ed 100644
967 --- 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>
978 diff --git a/tests/saridx.c b/tests/saridx.c
979 index 8a450d82..b3878013 100644
980 --- 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>
991 diff --git a/tests/sectiondump.c b/tests/sectiondump.c
992 index 3033fedc..8e888db3 100644
993 --- 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>
1004 diff --git a/tests/varlocs.c b/tests/varlocs.c
1005 index c3fba89e..e043ea2c 100644
1006 --- 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>
1017 diff --git a/tests/vdsosyms.c b/tests/vdsosyms.c
1018 index b876c10b..afb28232 100644
1019 --- 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>