summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
blob: e88f2c069c0a61adccd7d5064e37a26a2e3e185d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
From 207be05c44da5c4c31179a34660e176145ff8d4b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Jul 2018 09:52:23 +0800
Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
 compiling it on musl

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>

Rebase to 0.172

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 Makefile.am                      |  2 +-
 lib/color.c                      |  3 ++-
 lib/fixedsizehash.h              |  1 -
 lib/system.h                     | 10 ++++++++++
 lib/xmalloc.c                    |  2 +-
 libasm/asm_end.c                 |  2 +-
 libasm/asm_newscn.c              |  2 +-
 libcpu/i386_gendis.c             |  2 +-
 libcpu/i386_lex.c                |  2 +-
 libcpu/i386_parse.c              |  2 +-
 libdw/Makefile.am                |  3 ++-
 libdw/libdw_alloc.c              |  2 +-
 libdwfl/dwfl_build_id_find_elf.c |  1 +
 libdwfl/dwfl_error.c             |  4 +++-
 libdwfl/dwfl_module_getdwarf.c   |  1 +
 libdwfl/libdwfl_crc32_file.c     |  9 +++++++++
 libdwfl/linux-kernel-modules.c   |  1 +
 libebl/eblopenbackend.c          |  2 +-
 libelf/elf.h                     |  8 ++++++--
 libelf/libelf.h                  |  1 +
 libelf/libelfP.h                 |  1 +
 src/addr2line.c                  |  2 +-
 src/ar.c                         |  2 +-
 src/arlib.c                      |  2 +-
 src/arlib2.c                     |  2 +-
 src/elfcmp.c                     |  2 +-
 src/elflint.c                    |  2 +-
 src/findtextrel.c                |  2 +-
 src/nm.c                         |  2 +-
 src/objdump.c                    |  2 +-
 src/ranlib.c                     |  2 +-
 src/readelf.c                    |  2 +-
 src/size.c                       |  2 +-
 src/stack.c                      |  2 +-
 src/strings.c                    |  2 +-
 src/strip.c                      |  2 +-
 src/unstrip.c                    |  2 +-
 tests/addrscopes.c               |  2 +-
 tests/allregs.c                  |  2 +-
 tests/backtrace-data.c           |  2 +-
 tests/backtrace-dwarf.c          |  2 +-
 tests/backtrace.c                |  2 +-
 tests/buildid.c                  |  2 +-
 tests/debugaltlink.c             |  2 +-
 tests/debuglink.c                |  2 +-
 tests/deleted.c                  |  2 +-
 tests/dwfl-addr-sect.c           |  2 +-
 tests/dwfl-bug-addr-overflow.c   |  2 +-
 tests/dwfl-bug-fd-leak.c         |  2 +-
 tests/dwfl-bug-getmodules.c      |  2 +-
 tests/dwfl-report-elf-align.c    |  2 +-
 tests/dwfllines.c                |  2 +-
 tests/dwflmodtest.c              |  2 +-
 tests/dwflsyms.c                 |  2 +-
 tests/early-offscn.c             |  2 +-
 tests/ecp.c                      |  2 +-
 tests/find-prologues.c           |  2 +-
 tests/funcretval.c               |  2 +-
 tests/funcscopes.c               |  2 +-
 tests/getsrc_die.c               |  2 +-
 tests/line2addr.c                |  2 +-
 tests/low_high_pc.c              |  2 +-
 tests/rdwrmmap.c                 |  2 +-
 tests/saridx.c                   |  2 +-
 tests/sectiondump.c              |  2 +-
 tests/varlocs.c                  |  2 +-
 tests/vdsosyms.c                 |  2 +-
 67 files changed, 92 insertions(+), 61 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2ff444e..41f77df 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,7 +28,7 @@ pkginclude_HEADERS = version.h
 
 # Add doc back when we have some real content.
 SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
-	  backends src po tests
+	  backends po tests
 
 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
 	     COPYING COPYING-GPLV2 COPYING-LGPLV3
diff --git a/lib/color.c b/lib/color.c
index f62389d..a2a84b4 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -32,13 +32,14 @@
 #endif
 
 #include <argp.h>
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include "libeu.h"
 #include "color.h"
+#include "system.h"
 
 /* Prototype for option handler.  */
 static error_t parse_opt (int key, char *arg, struct argp_state *state);
diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
index dac2a5f..43016fc 100644
--- a/lib/fixedsizehash.h
+++ b/lib/fixedsizehash.h
@@ -30,7 +30,6 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/cdefs.h>
 
 #include <system.h>
 
diff --git a/lib/system.h b/lib/system.h
index 9203335..1a60131 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -50,6 +50,16 @@
 #else
 # error "Unknown byte order"
 #endif
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+  (__extension__							      \
+    ({ long int __result;						      \
+       do __result = (long int) (expression);				      \
+       while (__result == -1L && errno == EINTR);			      \
+       __result; }))
+#endif
+
+#define error(status, errno, ...) err(status, __VA_ARGS__)
 
 #ifndef MAX
 #define MAX(m, n) ((m) < (n) ? (n) : (m))
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index 0cde384..217b054 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -30,7 +30,7 @@
 # include <config.h>
 #endif
 
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 #include <stddef.h>
 #include <stdlib.h>
diff --git a/libasm/asm_end.c b/libasm/asm_end.c
index ced24f5..4ad918c 100644
--- a/libasm/asm_end.c
+++ b/libasm/asm_end.c
@@ -32,7 +32,7 @@
 #endif
 
 #include <assert.h>
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c
index ddbb25d..74a598d 100644
--- a/libasm/asm_newscn.c
+++ b/libasm/asm_newscn.c
@@ -32,7 +32,7 @@
 #endif
 
 #include <assert.h>
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c
index aae5eae..6d76016 100644
--- a/libcpu/i386_gendis.c
+++ b/libcpu/i386_gendis.c
@@ -31,7 +31,7 @@
 # include <config.h>
 #endif
 
-#include <error.h>
+#include <err.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libcpu/i386_lex.c b/libcpu/i386_lex.c
index facdf71..f13842f 100644
--- a/libcpu/i386_lex.c
+++ b/libcpu/i386_lex.c
@@ -571,7 +571,7 @@ char *i386_text;
 #endif
 
 #include <ctype.h>
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 
 #include <libeu.h>
diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c
index 3c5058a..bf402d6 100644
--- a/libcpu/i386_parse.c
+++ b/libcpu/i386_parse.c
@@ -107,7 +107,7 @@
 #include <assert.h>
 #include <ctype.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <inttypes.h>
 #include <libintl.h>
 #include <math.h>
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 41df4f3..e6b275f 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -107,7 +107,8 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
 libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \
 	  ../libdwfl/libdwfl_pic.a ../libebl/libebl.a
 libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS)
+fts_LDADD = -lfts
+libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) $(fts_LDADD)
 libdw_so_SOURCES =
 libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
 # The rpath is necessary for libebl because its $ORIGIN use will
diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
index d6af23a..deb724c 100644
--- a/libdw/libdw_alloc.c
+++ b/libdw/libdw_alloc.c
@@ -31,7 +31,7 @@
 # include <config.h>
 #endif
 
-#include <error.h>
+#include <err.h>
 #include <errno.h>
 #include <stdlib.h>
 #include "libdwP.h"
diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
index cc6c3f6..b06ab59 100644
--- a/libdwfl/dwfl_build_id_find_elf.c
+++ b/libdwfl/dwfl_build_id_find_elf.c
@@ -31,6 +31,7 @@
 #endif
 
 #include "libdwflP.h"
+#include "system.h"
 #include <inttypes.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c
index 7bcf61c..c345797 100644
--- a/libdwfl/dwfl_error.c
+++ b/libdwfl/dwfl_error.c
@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
 const char *
 dwfl_errmsg (int error)
 {
+  static __thread char s[64] = "";
   if (error == 0 || error == -1)
     {
       int last_error = global_error;
@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
   switch (error &~ 0xffff)
     {
     case OTHER_ERROR (ERRNO):
-      return strerror_r (error & 0xffff, "bad", 0);
+      strerror_r (error & 0xffff, s, sizeof(s));
+      return s;
     case OTHER_ERROR (LIBELF):
       return elf_errmsg (error & 0xffff);
     case OTHER_ERROR (LIBDW):
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index af6838a..c079d6a 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -35,6 +35,7 @@
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
+#include "system.h"
 #include "../libdw/libdwP.h"	/* DWARF_E_* values are here.  */
 #include "../libelf/libelfP.h"
 #include "system.h"
diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c
index f849128..6f0aca1 100644
--- a/libdwfl/libdwfl_crc32_file.c
+++ b/libdwfl/libdwfl_crc32_file.c
@@ -29,6 +29,15 @@
 # include <config.h>
 #endif
 
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                             \
+    ({ long int __result;                                                    \
+       do __result = (long int) (expression);                                \
+       while (__result == -1L && errno == EINTR);                            \
+       __result; }))
+#endif
+
 #define crc32_file attribute_hidden __libdwfl_crc32_file
 #define crc32 __libdwfl_crc32
 #include <libdwflP.h>
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 9d0fef2..9fc09b8 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -40,6 +40,7 @@
 #include <system.h>
 
 #include "libdwflP.h"
+#include "system.h"
 #include <inttypes.h>
 #include <errno.h>
 #include <stdio.h>
diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
index 8b063f4..9bdeead 100644
--- a/libebl/eblopenbackend.c
+++ b/libebl/eblopenbackend.c
@@ -32,7 +32,7 @@
 
 #include <assert.h>
 #include <dlfcn.h>
-#include <error.h>
+#include <err.h>
 #include <libelfP.h>
 #include <dwarf.h>
 #include <stdlib.h>
diff --git a/libelf/elf.h b/libelf/elf.h
index f774898..be277d0 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -21,7 +21,9 @@
 
 #include <features.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Standard ELF types.  */
 
@@ -3912,6 +3914,8 @@ enum
 #define R_METAG_TLS_LE_HI16	60
 #define R_METAG_TLS_LE_LO16	61
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif	/* elf.h */
diff --git a/libelf/libelf.h b/libelf/libelf.h
index 547c0f5..dd78799 100644
--- a/libelf/libelf.h
+++ b/libelf/libelf.h
@@ -29,6 +29,7 @@
 #ifndef _LIBELF_H
 #define _LIBELF_H 1
 
+#include <fcntl.h>
 #include <stdint.h>
 #include <sys/types.h>
 
diff --git a/libelf/libelfP.h b/libelf/libelfP.h
index ca805ac..47f25c2 100644
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -32,6 +32,7 @@
 
 #include <ar.h>
 #include <gelf.h>
+#include <libelf.h>
 
 #include <errno.h>
 #include <stdbool.h>
diff --git a/src/addr2line.c b/src/addr2line.c
index 5acafa0..a4920b3 100644
--- a/src/addr2line.c
+++ b/src/addr2line.c
@@ -23,7 +23,7 @@
 #include <argp.h>
 #include <assert.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <libdwfl.h>
diff --git a/src/ar.c b/src/ar.c
index 818115b..2166f1b 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -22,7 +22,7 @@
 
 #include <argp.h>
 #include <assert.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <libintl.h>
diff --git a/src/arlib.c b/src/arlib.c
index e0839aa..1143658 100644
--- a/src/arlib.c
+++ b/src/arlib.c
@@ -21,7 +21,7 @@
 #endif
 
 #include <assert.h>
-#include <error.h>
+#include <err.h>
 #include <gelf.h>
 #include <inttypes.h>
 #include <libintl.h>
diff --git a/src/arlib2.c b/src/arlib2.c
index 553fc57..46443d0 100644
--- a/src/arlib2.c
+++ b/src/arlib2.c
@@ -20,7 +20,7 @@
 # include <config.h>
 #endif
 
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 #include <limits.h>
 #include <string.h>
diff --git a/src/elfcmp.c b/src/elfcmp.c
index 5046420..cff183f 100644
--- a/src/elfcmp.c
+++ b/src/elfcmp.c
@@ -23,7 +23,7 @@
 #include <argp.h>
 #include <assert.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <locale.h>
 #include <libintl.h>
diff --git a/src/elflint.c b/src/elflint.c
index 0a26d97..e45fb39 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -24,7 +24,7 @@
 #include <assert.h>
 #include <byteswap.h>
 #include <endian.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <inttypes.h>
diff --git a/src/findtextrel.c b/src/findtextrel.c
index 8f1e239..71463af 100644
--- a/src/findtextrel.c
+++ b/src/findtextrel.c
@@ -23,7 +23,7 @@
 #include <argp.h>
 #include <assert.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <libdw.h>
diff --git a/src/nm.c b/src/nm.c
index 969c6d3..3113c04 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -26,7 +26,7 @@
 #include <ctype.h>
 #include <dwarf.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <inttypes.h>
diff --git a/src/objdump.c b/src/objdump.c
index 0dd9a6a..9c8bf14 100644
--- a/src/objdump.c
+++ b/src/objdump.c
@@ -21,7 +21,7 @@
 #endif
 
 #include <argp.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <libintl.h>
diff --git a/src/ranlib.c b/src/ranlib.c
index cc0ee23..ae851e4 100644
--- a/src/ranlib.c
+++ b/src/ranlib.c
@@ -24,7 +24,7 @@
 #include <argp.h>
 #include <assert.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <libintl.h>
diff --git a/src/readelf.c b/src/readelf.c
index f185897..6623e93 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -24,7 +24,7 @@
 #include <ctype.h>
 #include <dwarf.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <inttypes.h>
diff --git a/src/size.c b/src/size.c
index ad8dbcb..fd83be0 100644
--- a/src/size.c
+++ b/src/size.c
@@ -21,7 +21,7 @@
 #endif
 
 #include <argp.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <inttypes.h>
diff --git a/src/stack.c b/src/stack.c
index 52ae3a8..0fda285 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -18,7 +18,7 @@
 #include <config.h>
 #include <assert.h>
 #include <argp.h>
-#include <error.h>
+#include <err.h>
 #include <stdlib.h>
 #include <inttypes.h>
 #include <stdio.h>
diff --git a/src/strings.c b/src/strings.c
index 03d0f13..5c311cb 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -25,7 +25,7 @@
 #include <ctype.h>
 #include <endian.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <inttypes.h>
diff --git a/src/strip.c b/src/strip.c
index 773ed54..ff05f46 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -24,7 +24,7 @@
 #include <assert.h>
 #include <byteswap.h>
 #include <endian.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <fnmatch.h>
 #include <gelf.h>
diff --git a/src/unstrip.c b/src/unstrip.c
index f368e69..5ca83d0 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -31,7 +31,7 @@
 #include <argp.h>
 #include <assert.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <fnmatch.h>
 #include <libintl.h>
diff --git a/tests/addrscopes.c b/tests/addrscopes.c
index 791569f..54f4311 100644
--- a/tests/addrscopes.c
+++ b/tests/addrscopes.c
@@ -25,7 +25,7 @@
 #include <stdio_ext.h>
 #include <locale.h>
 #include <stdlib.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 
 
diff --git a/tests/allregs.c b/tests/allregs.c
index 286f7e3..c9de089 100644
--- a/tests/allregs.c
+++ b/tests/allregs.c
@@ -21,7 +21,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <error.h>
+#include <err.h>
 #include <locale.h>
 #include <argp.h>
 #include <assert.h>
diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
index a387d8f..955c27d 100644
--- a/tests/backtrace-data.c
+++ b/tests/backtrace-data.c
@@ -27,7 +27,7 @@
 #include <dirent.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <unistd.h>
 #include <dwarf.h>
 #if defined(__x86_64__) && defined(__linux__)
diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index 7ff826c..246650b 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -21,7 +21,7 @@
 #include <stdio_ext.h>
 #include <locale.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include ELFUTILS_HEADER(dwfl)
diff --git a/tests/backtrace.c b/tests/backtrace.c
index f5dd761..a93a8f0 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -24,7 +24,7 @@
 #include <dirent.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <unistd.h>
 #include <dwarf.h>
 #ifdef __linux__
diff --git a/tests/buildid.c b/tests/buildid.c
index 87c1877..2953e6b 100644
--- a/tests/buildid.c
+++ b/tests/buildid.c
@@ -23,7 +23,7 @@
 #include ELFUTILS_HEADER(elf)
 #include ELFUTILS_HEADER(dwelf)
 #include <stdio.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
diff --git a/tests/debugaltlink.c b/tests/debugaltlink.c
index 6d97d50..ee7e559 100644
--- a/tests/debugaltlink.c
+++ b/tests/debugaltlink.c
@@ -23,7 +23,7 @@
 #include ELFUTILS_HEADER(dw)
 #include ELFUTILS_HEADER(dwelf)
 #include <stdio.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
diff --git a/tests/debuglink.c b/tests/debuglink.c
index 935d102..741cb81 100644
--- a/tests/debuglink.c
+++ b/tests/debuglink.c
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include ELFUTILS_HEADER(dwelf)
 #include <stdio.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
diff --git a/tests/deleted.c b/tests/deleted.c
index 6be35bc..0190711 100644
--- a/tests/deleted.c
+++ b/tests/deleted.c
@@ -21,7 +21,7 @@
 #include <unistd.h>
 #include <assert.h>
 #include <stdio.h>
-#include <error.h>
+#include <err.h>
 #include <errno.h>
 #ifdef __linux__
 #include <sys/prctl.h>
diff --git a/tests/dwfl-addr-sect.c b/tests/dwfl-addr-sect.c
index 21e470a..1ea1e3b 100644
--- a/tests/dwfl-addr-sect.c
+++ b/tests/dwfl-addr-sect.c
@@ -23,7 +23,7 @@
 #include <stdio_ext.h>
 #include <stdlib.h>
 #include <string.h>
-#include <error.h>
+#include <err.h>
 #include <locale.h>
 #include <argp.h>
 #include ELFUTILS_HEADER(dwfl)
diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c
index aa8030e..02c8bef 100644
--- a/tests/dwfl-bug-addr-overflow.c
+++ b/tests/dwfl-bug-addr-overflow.c
@@ -20,7 +20,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdio_ext.h>
-#include <error.h>
+#include <err.h>
 #include <locale.h>
 #include ELFUTILS_HEADER(dwfl)
 
diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c
index 689cdd7..5973da3 100644
--- a/tests/dwfl-bug-fd-leak.c
+++ b/tests/dwfl-bug-fd-leak.c
@@ -24,7 +24,7 @@
 #include <dirent.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <unistd.h>
 #include <dwarf.h>
 
diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c
index 1ee989f..fd62e65 100644
--- a/tests/dwfl-bug-getmodules.c
+++ b/tests/dwfl-bug-getmodules.c
@@ -18,7 +18,7 @@
 #include <config.h>
 #include ELFUTILS_HEADER(dwfl)
 
-#include <error.h>
+#include <err.h>
 
 static const Dwfl_Callbacks callbacks =
   {
diff --git a/tests/dwfl-report-elf-align.c b/tests/dwfl-report-elf-align.c
index a4e97d3..f471587 100644
--- a/tests/dwfl-report-elf-align.c
+++ b/tests/dwfl-report-elf-align.c
@@ -20,7 +20,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdio_ext.h>
-#include <error.h>
+#include <err.h>
 #include <locale.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/tests/dwfllines.c b/tests/dwfllines.c
index 90379dd..cbdf6c4 100644
--- a/tests/dwfllines.c
+++ b/tests/dwfllines.c
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <error.h>
+#include <err.h>
 
 int
 main (int argc, char *argv[])
diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c
index 0027f96..e68d3bc 100644
--- a/tests/dwflmodtest.c
+++ b/tests/dwflmodtest.c
@@ -23,7 +23,7 @@
 #include <stdio_ext.h>
 #include <stdlib.h>
 #include <string.h>
-#include <error.h>
+#include <err.h>
 #include <locale.h>
 #include <argp.h>
 #include ELFUTILS_HEADER(dwfl)
diff --git a/tests/dwflsyms.c b/tests/dwflsyms.c
index 49ac334..cf07830 100644
--- a/tests/dwflsyms.c
+++ b/tests/dwflsyms.c
@@ -25,7 +25,7 @@
 #include <stdio.h>
 #include <stdio_ext.h>
 #include <stdlib.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 
 static const char *
diff --git a/tests/early-offscn.c b/tests/early-offscn.c
index 924cb9e..6f60d5a 100644
--- a/tests/early-offscn.c
+++ b/tests/early-offscn.c
@@ -19,7 +19,7 @@
 #endif
 
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <stdio.h>
diff --git a/tests/ecp.c b/tests/ecp.c
index 38a6859..743cea5 100644
--- a/tests/ecp.c
+++ b/tests/ecp.c
@@ -20,7 +20,7 @@
 #endif
 
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <stdlib.h>
diff --git a/tests/find-prologues.c b/tests/find-prologues.c
index ba8ae37..76f5f04 100644
--- a/tests/find-prologues.c
+++ b/tests/find-prologues.c
@@ -25,7 +25,7 @@
 #include <stdio_ext.h>
 #include <locale.h>
 #include <stdlib.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 #include <fnmatch.h>
 
diff --git a/tests/funcretval.c b/tests/funcretval.c
index 8d19d11..c8aaa93 100644
--- a/tests/funcretval.c
+++ b/tests/funcretval.c
@@ -25,7 +25,7 @@
 #include <stdio_ext.h>
 #include <locale.h>
 #include <stdlib.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 #include <fnmatch.h>
 
diff --git a/tests/funcscopes.c b/tests/funcscopes.c
index 9c90185..dbccb89 100644
--- a/tests/funcscopes.c
+++ b/tests/funcscopes.c
@@ -25,7 +25,7 @@
 #include <stdio_ext.h>
 #include <locale.h>
 #include <stdlib.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 #include <fnmatch.h>
 
diff --git a/tests/getsrc_die.c b/tests/getsrc_die.c
index 055aede..9c394dd 100644
--- a/tests/getsrc_die.c
+++ b/tests/getsrc_die.c
@@ -19,7 +19,7 @@
 #endif
 
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <libelf.h>
diff --git a/tests/line2addr.c b/tests/line2addr.c
index e0d65d3..9bf0023 100644
--- a/tests/line2addr.c
+++ b/tests/line2addr.c
@@ -26,7 +26,7 @@
 #include <locale.h>
 #include <stdlib.h>
 #include <string.h>
-#include <error.h>
+#include <err.h>
 
 
 static void
diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
index 5c6b343..fa0c158 100644
--- a/tests/low_high_pc.c
+++ b/tests/low_high_pc.c
@@ -25,7 +25,7 @@
 #include <stdio_ext.h>
 #include <locale.h>
 #include <stdlib.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 #include <fnmatch.h>
 
diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c
index 6f027df..1ce5e6e 100644
--- a/tests/rdwrmmap.c
+++ b/tests/rdwrmmap.c
@@ -19,7 +19,7 @@
 #endif
 
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/tests/saridx.c b/tests/saridx.c
index 8a450d8..b387801 100644
--- a/tests/saridx.c
+++ b/tests/saridx.c
@@ -17,7 +17,7 @@
 
 #include <config.h>
 
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <stdio.h>
diff --git a/tests/sectiondump.c b/tests/sectiondump.c
index 3033fed..8e888db 100644
--- a/tests/sectiondump.c
+++ b/tests/sectiondump.c
@@ -18,7 +18,7 @@
 #include <config.h>
 
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <inttypes.h>
diff --git a/tests/varlocs.c b/tests/varlocs.c
index f4a711c..1d89a61 100644
--- a/tests/varlocs.c
+++ b/tests/varlocs.c
@@ -25,7 +25,7 @@
 #include <dwarf.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <error.h>
+#include <err.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/tests/vdsosyms.c b/tests/vdsosyms.c
index b876c10..afb2823 100644
--- a/tests/vdsosyms.c
+++ b/tests/vdsosyms.c
@@ -18,7 +18,7 @@
 #include <config.h>
 #include <assert.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
-- 
2.7.4