diff --git lib/color.c lib/color.c
index f3cc906..ea6ee73 100644
--- lib/color.c
+++ lib/color.c
@@ -32,7 +32,7 @@
 #endif
 
 #include <argp.h>
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 #include <stdlib.h>
 #include <string.h>
diff --git lib/fixedsizehash.h lib/fixedsizehash.h
index 06ce6a2..566def2 100644
--- lib/fixedsizehash.h
+++ lib/fixedsizehash.h
@@ -30,12 +30,12 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/cdefs.h>
 #include <sys/param.h>
 
 #include <system.h>
 
-#define CONCAT(t1,t2) __CONCAT (t1,t2)
+#define CONCAT1(x,y) x##y
+#define CONCAT(x,y) CONCAT1(x,y)
 
 /* Before including this file the following macros must be defined:
 
diff --git lib/system.h lib/system.h
index f31cfd0..191462a 100644
--- lib/system.h
+++ lib/system.h
@@ -68,6 +68,16 @@ extern int crc32_file (int fd, uint32_t *resp);
 
 #define gettext_noop(Str) Str
 
+#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__)
 
 static inline ssize_t __attribute__ ((unused))
 pwrite_retry (int fd, const void *buf, size_t len, off_t off)
diff --git lib/xmalloc.c lib/xmalloc.c
index 27ccab9..87292fc 100644
--- lib/xmalloc.c
+++ 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 libasm/asm_end.c libasm/asm_end.c
index f4145a7..a50cbf5 100644
--- libasm/asm_end.c
+++ 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 libasm/asm_newscn.c libasm/asm_newscn.c
index ece7f5c..da95351 100644
--- libasm/asm_newscn.c
+++ 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 libcpu/i386_gendis.c libcpu/i386_gendis.c
index aae5eae..6d76016 100644
--- libcpu/i386_gendis.c
+++ 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 libcpu/i386_lex.c libcpu/i386_lex.c
index cb0be8d..2cffc02 100644
--- libcpu/i386_lex.c
+++ 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 <system.h>
diff --git libcpu/i386_lex.l libcpu/i386_lex.l
index 1e10dd7..0fba91e 100644
--- libcpu/i386_lex.l
+++ libcpu/i386_lex.l
@@ -31,7 +31,7 @@
 #endif
 
 #include <ctype.h>
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 
 #include <system.h>
diff --git libcpu/i386_parse.c libcpu/i386_parse.c
index cf8fe25..269ced3 100644
--- libcpu/i386_parse.c
+++ 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 libdw/libdw_alloc.c libdw/libdw_alloc.c
index a3b7958..4b7b9af 100644
--- libdw/libdw_alloc.c
+++ 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 <sys/param.h>
@@ -74,5 +74,5 @@ __attribute ((noreturn, visibility ("hidden")))
 __libdw_oom (void)
 {
   while (1)
-    error (EXIT_FAILURE, ENOMEM, "libdw");
+    err (EXIT_FAILURE, "libdw: out of memory");
 }
diff --git libdwfl/dwfl_build_id_find_elf.c libdwfl/dwfl_build_id_find_elf.c
index 062aad1..eec3ce6 100644
--- libdwfl/dwfl_build_id_find_elf.c
+++ libdwfl/dwfl_build_id_find_elf.c
@@ -80,7 +80,7 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
 	{
 	  if (*file_name != NULL)
 	    free (*file_name);
-	  *file_name = canonicalize_file_name (name);
+	  *file_name = realpath (name, NULL);
 	  if (*file_name == NULL)
 	    {
 	      *file_name = name;
diff --git libdwfl/dwfl_error.c libdwfl/dwfl_error.c
index d9ca9e7..31236af 100644
--- libdwfl/dwfl_error.c
+++ libdwfl/dwfl_error.c
@@ -128,6 +128,7 @@ const char *
 dwfl_errmsg (error)
      int error;
 {
+  static __thread char s[64] = "";
   if (error == 0 || error == -1)
     {
       int last_error = global_error;
@@ -142,7 +143,8 @@ dwfl_errmsg (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 libdwfl/find-debuginfo.c libdwfl/find-debuginfo.c
index 3f5314a..954dbe8 100644
--- libdwfl/find-debuginfo.c
+++ libdwfl/find-debuginfo.c
@@ -338,7 +338,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
       /* If FILE_NAME is a symlink, the debug file might be associated
 	 with the symlink target name instead.  */
 
-      char *canon = canonicalize_file_name (file_name);
+      char *canon = realpath (file_name, NULL);
       if (canon != NULL && strcmp (file_name, canon))
 	fd = find_debuginfo_in_path (mod, canon,
 				     debuglink_file, debuglink_crc,
diff --git libdwfl/libdwfl.h libdwfl/libdwfl.h
index 2bb4f45..b6675c0 100644
--- libdwfl/libdwfl.h
+++ libdwfl/libdwfl.h
@@ -31,6 +31,27 @@
 
 #include "libdw.h"
 #include <stdio.h>
+#include <unistd.h>
+#include <alloca.h>
+#include <string.h>
+
+#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
+
+#ifndef strndupa
+#define strndupa(s, n) \
+	(__extension__ ({const char *__in = (s); \
+			 size_t __len = strnlen (__in, (n)) + 1; \
+			 char *__out = (char *) alloca (__len); \
+			 __out[__len-1] = '\0'; \
+			 (char *) memcpy (__out, __in, __len-1);}))
+#endif
 
 /* Handle for a session using the library.  */
 typedef struct Dwfl Dwfl;
diff --git libebl/eblopenbackend.c libebl/eblopenbackend.c
index 3a22f53..296d0f0 100644
--- libebl/eblopenbackend.c
+++ 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 libebl/eblwstrtab.c libebl/eblwstrtab.c
index 08e0ba7..2981b47 100644
--- libebl/eblwstrtab.c
+++ libebl/eblwstrtab.c
@@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep, wchar_t **freep, size_t *offsetp)
 
   /* Process the current node.  */
   nodep->offset = *offsetp;
-  *freep = wmempcpy (*freep, nodep->string, nodep->len);
+  *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
   *offsetp += nodep->len * sizeof (wchar_t);
 
   for (subs = nodep->next; subs != NULL; subs = subs->next)
diff --git libelf/elf.h libelf/elf.h
index 40e87b2..fab9796 100644
--- libelf/elf.h
+++ libelf/elf.h
@@ -19,9 +19,10 @@
 #ifndef _ELF_H
 #define	_ELF_H 1
 
-#include <features.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Standard ELF types.  */
 
@@ -3358,6 +3359,8 @@ typedef Elf32_Addr Elf32_Conflict;
 #define R_TILEGX_NUM		130
 
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif	/* elf.h */
diff --git libelf/elf_getarsym.c libelf/elf_getarsym.c
index 132d1a2..4c6d24c 100644
--- libelf/elf_getarsym.c
+++ libelf/elf_getarsym.c
@@ -284,7 +284,7 @@ elf_getarsym (elf, ptr)
 		arsym[cnt].as_off = file_data->u32[cnt];
 
 	      arsym[cnt].as_hash = _dl_elf_hash (str_data);
-	      str_data = rawmemchr (str_data, '\0') + 1;
+	      str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
 	    }
 
 	  /* At the end a special entry.  */
diff --git libelf/libelf.h libelf/libelf.h
index 4ead65a..34304aa 100644
--- libelf/libelf.h
+++ libelf/libelf.h
@@ -29,6 +29,7 @@
 #ifndef _LIBELF_H
 #define _LIBELF_H 1
 
+#include <fcntl.h>
 #include <sys/types.h>
 
 /* Get the ELF types.  */
diff --git src/addr2line.c src/addr2line.c
index e982982..d70da46 100644
--- src/addr2line.c
+++ 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 src/ar.c src/ar.c
index f51f0ef..9437516 100644
--- src/ar.c
+++ 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 src/arlib.c src/arlib.c
index 43a9145..091d8c3 100644
--- src/arlib.c
+++ src/arlib.c
@@ -21,7 +21,7 @@
 #endif
 
 #include <assert.h>
-#include <error.h>
+#include <err.h>
 #include <gelf.h>
 #include <libintl.h>
 #include <stdio.h>
diff --git src/arlib2.c src/arlib2.c
index 7998fc6..df0e7d5 100644
--- src/arlib2.c
+++ 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 src/elfcmp.c src/elfcmp.c
index d1008b3..df83832 100644
--- src/elfcmp.c
+++ 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 src/elflint.c src/elflint.c
index 7e73253..78f73b1 100644
--- src/elflint.c
+++ 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 src/findtextrel.c src/findtextrel.c
index d7de202..aa5497a 100644
--- src/findtextrel.c
+++ 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 src/i386_ld.c src/i386_ld.c
index d196177..ba57657 100644
--- src/i386_ld.c
+++ src/i386_ld.c
@@ -20,7 +20,7 @@
 #endif
 
 #include <assert.h>
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 #include <stdlib.h>
 #include <string.h>
diff --git src/ld.c src/ld.c
index 73e4f04..8f33870 100644
--- src/ld.c
+++ src/ld.c
@@ -21,7 +21,7 @@
 
 #include <argp.h>
 #include <assert.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <libelf.h>
 #include <libintl.h>
diff --git src/ldgeneric.c src/ldgeneric.c
index 1b5d0f9..e1e7b3a 100644
--- src/ldgeneric.c
+++ src/ldgeneric.c
@@ -23,7 +23,7 @@
 #include <ctype.h>
 #include <dlfcn.h>
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <fnmatch.h>
 #include <gelf.h>
diff --git src/ldlex.c src/ldlex.c
index 03870df..77d239d 100644
--- src/ldlex.c
+++ src/ldlex.c
@@ -1099,7 +1099,7 @@ char *ldtext;
 #include <assert.h>
 #include <ctype.h>
 #include <elf.h>
-#include <error.h>
+#include <err.h>
 #include <inttypes.h>
 #include <libintl.h>
 #include <stdbool.h>
diff --git src/ldlex.l src/ldlex.l
index bfc8bbe..fce3d03 100644
--- src/ldlex.l
+++ src/ldlex.l
@@ -23,7 +23,7 @@
 #include <assert.h>
 #include <ctype.h>
 #include <elf.h>
-#include <error.h>
+#include <err.h>
 #include <inttypes.h>
 #include <libintl.h>
 #include <stdbool.h>
diff --git src/ldscript.c src/ldscript.c
index 690d805..ad8a888 100644
--- src/ldscript.c
+++ src/ldscript.c
@@ -95,7 +95,7 @@
 #endif
 
 #include <assert.h>
-#include <error.h>
+#include <err.h>
 #include <libintl.h>
 #include <stdbool.h>
 #include <stdint.h>
@@ -106,7 +106,7 @@
 #include <system.h>
 #include <ld.h>
 
-/* The error handler.  */
+/* The err.handler.  */
 static void yyerror (const char *s);
 
 /* Some helper functions we need to construct the data structures
diff --git src/nm.c src/nm.c
index 4f2e0e7..676402e 100644
--- src/nm.c
+++ 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 src/objdump.c src/objdump.c
index 87290cc..cada7f2 100644
--- src/objdump.c
+++ 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 src/ranlib.c src/ranlib.c
index 8435fc1..36ff6f4 100644
--- src/ranlib.c
+++ 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 src/readelf.c src/readelf.c
index 772cfca..37658d2 100644
--- src/readelf.c
+++ src/readelf.c
@@ -25,7 +25,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 src/size.c src/size.c
index 0e7e41e..0297fc0 100644
--- src/size.c
+++ 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 src/stack.c src/stack.c
index c277dfd..d85858e 100644
--- src/stack.c
+++ 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 src/strings.c src/strings.c
index dae6ab2..9685c92 100644
--- src/strings.c
+++ 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 src/strip.c src/strip.c
index 1b34eee..204e3d8 100644
--- src/strip.c
+++ 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 <gelf.h>
 #include <libelf.h>
diff --git src/unstrip.c src/unstrip.c
index 989ac5f..ed3e483 100644
--- src/unstrip.c
+++ 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 tests/addrscopes.c tests/addrscopes.c
index fca61d3..f33cae4 100644
--- tests/addrscopes.c
+++ 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 tests/allregs.c tests/allregs.c
index b103ce1..675234a 100644
--- tests/allregs.c
+++ 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 tests/backtrace-data.c tests/backtrace-data.c
index 01c1c00..0a10611 100644
--- tests/backtrace-data.c
+++ 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>
 #include <sys/resource.h>
diff --git tests/backtrace.c tests/backtrace.c
index 46af9b5..9e45fbe 100644
--- tests/backtrace.c
+++ 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>
 #include <sys/resource.h>
diff --git tests/buildid.c tests/buildid.c
index 87c1877..2953e6b 100644
--- tests/buildid.c
+++ 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 tests/debugaltlink.c tests/debugaltlink.c
index 6d97d50..ee7e559 100644
--- tests/debugaltlink.c
+++ 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 tests/debuglink.c tests/debuglink.c
index 935d102..741cb81 100644
--- tests/debuglink.c
+++ 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 tests/dwfl-addr-sect.c tests/dwfl-addr-sect.c
index 21e470a..1ea1e3b 100644
--- tests/dwfl-addr-sect.c
+++ 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 tests/dwfl-bug-addr-overflow.c tests/dwfl-bug-addr-overflow.c
index aa8030e..02c8bef 100644
--- tests/dwfl-bug-addr-overflow.c
+++ 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 tests/dwfl-bug-fd-leak.c tests/dwfl-bug-fd-leak.c
index 170a61a..d80deb9 100644
--- tests/dwfl-bug-fd-leak.c
+++ 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>
 #include <sys/resource.h>
diff --git tests/dwfl-bug-getmodules.c tests/dwfl-bug-getmodules.c
index 1ee989f..fd62e65 100644
--- tests/dwfl-bug-getmodules.c
+++ 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 tests/dwfl-report-elf-align.c tests/dwfl-report-elf-align.c
index a4e97d3..f471587 100644
--- tests/dwfl-report-elf-align.c
+++ 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 tests/dwfllines.c tests/dwfllines.c
index 90379dd..cbdf6c4 100644
--- tests/dwfllines.c
+++ 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 tests/dwflmodtest.c tests/dwflmodtest.c
index 0027f96..e68d3bc 100644
--- tests/dwflmodtest.c
+++ 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 tests/dwflsyms.c tests/dwflsyms.c
index 49ac334..cf07830 100644
--- tests/dwflsyms.c
+++ 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 tests/early-offscn.c tests/early-offscn.c
index 924cb9e..6f60d5a 100644
--- tests/early-offscn.c
+++ 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 tests/ecp.c tests/ecp.c
index 39a4851..c4de16a 100644
--- tests/ecp.c
+++ tests/ecp.c
@@ -16,7 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <fcntl.h>
 #include <gelf.h>
 #include <stdlib.h>
diff --git tests/find-prologues.c tests/find-prologues.c
index ba8ae37..76f5f04 100644
--- tests/find-prologues.c
+++ 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 tests/funcretval.c tests/funcretval.c
index 8d19d11..c8aaa93 100644
--- tests/funcretval.c
+++ 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 tests/funcscopes.c tests/funcscopes.c
index 720ff3b..01afbe1 100644
--- tests/funcscopes.c
+++ 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 tests/line2addr.c tests/line2addr.c
index 7c171b9..8ea266b 100644
--- tests/line2addr.c
+++ 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 tests/low_high_pc.c tests/low_high_pc.c
index d0f4302..8da4fbd 100644
--- tests/low_high_pc.c
+++ 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 tests/md5-sha1-test.c tests/md5-sha1-test.c
index 49de078..d4ab508 100644
--- tests/md5-sha1-test.c
+++ tests/md5-sha1-test.c
@@ -19,7 +19,7 @@
 #endif
 
 #include <string.h>
-#include <error.h>
+#include <err.h>
 
 #include "md5.h"
 #include "sha1.h"
diff --git tests/rdwrmmap.c tests/rdwrmmap.c
index 95a4df3..9849b07 100644
--- tests/rdwrmmap.c
+++ tests/rdwrmmap.c
@@ -15,7 +15,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
-#include <error.h>
+#include <err.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git tests/saridx.c tests/saridx.c
index 8a450d8..b387801 100644
--- tests/saridx.c
+++ 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 tests/sectiondump.c tests/sectiondump.c
index f865954..83ef20d 100644
--- tests/sectiondump.c
+++ 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 tests/varlocs.c tests/varlocs.c
index 04f17ff..af8a6c9 100644
--- tests/varlocs.c
+++ 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>
