aboutsummaryrefslogtreecommitdiffstats
path: root/community/flatpak-builder/musl-fixes-error.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/flatpak-builder/musl-fixes-error.patch')
-rw-r--r--community/flatpak-builder/musl-fixes-error.patch808
1 files changed, 808 insertions, 0 deletions
diff --git a/community/flatpak-builder/musl-fixes-error.patch b/community/flatpak-builder/musl-fixes-error.patch
new file mode 100644
index 00000000000..5d8064f77e0
--- /dev/null
+++ b/community/flatpak-builder/musl-fixes-error.patch
@@ -0,0 +1,808 @@
+--- a/subprojects/debugedit/tools/debugedit.c
++++ b/subprojects/debugedit/tools/debugedit.c
+@@ -25,7 +25,7 @@
+ #include <byteswap.h>
+ #include <endian.h>
+ #include <errno.h>
+-#include <error.h>
++#include <err.h>
+ #include <limits.h>
+ #include <string.h>
+ #include <stdlib.h>
+@@ -536,7 +535,7 @@
+ relbuf = malloc (maxndx * sizeof (REL));
+ *reltype = dso->shdr[i].sh_type;
+ if (relbuf == NULL)
+- error (1, errno, "%s: Could not allocate memory", dso->filename);
++ err (1, "%s: Could not allocate memory", dso->filename);
+
+ symdata = elf_getdata (dso->scn[dso->shdr[i].sh_link], NULL);
+ assert (symdata != NULL && symdata->d_buf != NULL);
+@@ -626,7 +625,7 @@
+ #endif
+ default:
+ fail:
+- error (1, 0, "%s: Unhandled relocation %d at [%d] for %s section",
++ err (1, "%s: Unhandled relocation %d at [%d] for %s section",
+ dso->filename, rtype, ndx, sec->name);
+ }
+ relend->ptr = sec->data
+@@ -669,17 +668,17 @@
+ int ndx = relptr->ndx;
+
+ if (gelf_getrela (data, ndx, &rela) == NULL)
+- error (1, 0, "Couldn't get relocation: %s",
++ err (1, "Couldn't get relocation: %s",
+ elf_errmsg (-1));
+
+ if (gelf_getsym (symdata, GELF_R_SYM (rela.r_info),
+ &sym) == NULL)
+- error (1, 0, "Couldn't get symbol: %s", elf_errmsg (-1));
++ err (1, "Couldn't get symbol: %s", elf_errmsg (-1));
+
+ rela.r_addend = relptr->addend - sym.st_value;
+
+ if (gelf_update_rela (data, ndx, &rela) == 0)
+- error (1, 0, "Couldn't update relocations: %s",
++ err (1, "Couldn't update relocations: %s",
+ elf_errmsg (-1));
+
+ ++relptr;
+@@ -738,7 +737,7 @@
+ if (h == NULL)
+ {
+ no_memory:
+- error (0, ENOMEM, "%s: Could not read .debug_abbrev", dso->filename);
++ err (0, "%s: Could not read .debug_abbrev", dso->filename);
+ if (h)
+ htab_delete (h);
+ return NULL;
+@@ -760,7 +759,7 @@
+ }
+ if (*slot != NULL)
+ {
+- error (0, 0, "%s: Duplicate DWARF abbreviation %d", dso->filename,
++ err (0, "%s: Duplicate DWARF abbreviation %d", dso->filename,
+ t->entry);
+ free (t);
+ htab_delete (h);
+@@ -796,7 +795,7 @@
+ || form == DW_FORM_addrx3
+ || form == DW_FORM_addrx4)))
+ {
+- error (0, 0, "%s: Unknown DWARF DW_FORM_0x%x", dso->filename,
++ err (0, "%s: Unknown DWARF DW_FORM_0x%x", dso->filename,
+ form);
+ htab_delete (h);
+ return NULL;
+@@ -812,7 +811,7 @@
+ }
+ if (read_uleb128 (ptr) != 0)
+ {
+- error (0, 0, "%s: DWARF abbreviation does not end with 2 zeros",
++ err (0, "%s: DWARF abbreviation does not end with 2 zeros",
+ dso->filename);
+ htab_delete (h);
+ return NULL;
+@@ -1016,7 +1015,7 @@
+ + (STRIDXENTRIES * sizeof (struct stridxentry)));
+ struct strentblock *newentries = malloc (entriessz);
+ if (newentries == NULL)
+- error (1, errno, "Couldn't allocate new string entries block");
++ err (1, "Couldn't allocate new string entries block");
+ else
+ {
+ if (strings->entries == NULL)
+@@ -1036,7 +1035,7 @@
+ struct stridxentry **tres = tsearch (entry, &strings->strent_root,
+ strent_compare);
+ if (tres == NULL)
+- error (1, ENOMEM, "Couldn't insert new strtab idx");
++ err (1, "Couldn't insert new strtab idx");
+ else if (*tres == entry)
+ {
+ /* idx not yet seen, must add actual str. */
+@@ -1078,7 +1077,7 @@
+ debug_section *sec = &debug_sections[line_strp
+ ? DEBUG_LINE_STR : DEBUG_STR];
+ if (old_idx >= sec->size)
+- error (1, 0, "Bad string pointer index %zd (%s)", old_idx, sec->name);
++ err (1, "Bad string pointer index %zd (%s)", old_idx, sec->name);
+
+ Strent *strent;
+ const char *old_str = (char *)sec->data + old_idx;
+@@ -1099,7 +1098,7 @@
+ nsize += 1 + file_len; /* + '/' */
+ char *nname = new_string_storage (strings, nsize);
+ if (nname == NULL)
+- error (1, ENOMEM, "Couldn't allocate new string storage");
++ err (1, "Couldn't allocate new string storage");
+ memcpy (nname, dest_dir, dest_len);
+ if (file_len > 0)
+ {
+@@ -1113,7 +1112,7 @@
+ ret = true;
+ }
+ if (strent == NULL)
+- error (1, ENOMEM, "Could not create new string table entry");
++ err (1, "Could not create new string table entry");
+ else
+ entry->entry = strent;
+ }
+@@ -1134,13 +1133,13 @@
+ debug_section *sec = &debug_sections[line_strp
+ ? DEBUG_LINE_STR : DEBUG_STR];
+ if (old_idx >= sec->size)
+- error (1, 0, "Bad string pointer index %zd (%s)", old_idx, sec->name);
++ err (1, "Bad string pointer index %zd (%s)", old_idx, sec->name);
+
+ const char *str = (char *)sec->data + old_idx;
+ Strent *strent = strtab_add_len (strings->str_tab,
+ str, strlen (str) + 1);
+ if (strent == NULL)
+- error (1, ENOMEM, "Could not create new string table entry");
++ err (1, "Could not create new string table entry");
+ else
+ entry->entry = strent;
+ }
+@@ -1217,7 +1216,7 @@
+ + MIN_LINE_TABLES)));
+ if (new_table == NULL)
+ {
+- error (0, ENOMEM, "Couldn't add more debug_line tables");
++ err (0, "Couldn't add more debug_line tables");
+ *table = NULL;
+ return false;
+ }
+@@ -1238,13 +1237,13 @@
+ unsigned char *endsec = ptr + debug_sections[DEBUG_LINE].size;
+ if (ptr == NULL)
+ {
+- error (0, 0, "%s: No .line_table section", dso->filename);
++ err (0, "%s: No .line_table section", dso->filename);
+ return false;
+ }
+
+ if (off > debug_sections[DEBUG_LINE].size)
+ {
+- error (0, 0, "%s: Invalid .line_table offset 0x%zx",
++ err (0, "%s: Invalid .line_table offset 0x%zx",
+ dso->filename, off);
+ return false;
+ }
+@@ -1256,13 +1255,13 @@
+ endcu += t->unit_length;
+ if (endcu == ptr + 0xffffffff)
+ {
+- error (0, 0, "%s: 64-bit DWARF not supported", dso->filename);
++ err (0, "%s: 64-bit DWARF not supported", dso->filename);
+ return false;
+ }
+
+ if (endcu > endsec)
+ {
+- error (0, 0, "%s: .debug_line CU does not fit into section",
++ err (0, "%s: .debug_line CU does not fit into section",
+ dso->filename);
+ return false;
+ }
+@@ -1271,7 +1270,7 @@
+ t->version = read_16 (ptr);
+ if (t->version != 2 && t->version != 3 && t->version != 4 && t->version != 5)
+ {
+- error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
++ err (0, "%s: DWARF version %d unhandled", dso->filename,
+ t->version);
+ return false;
+ }
+@@ -1282,7 +1281,7 @@
+ assert (ptr_size != 0);
+ if (ptr_size != read_8 (ptr))
+ {
+- error (0, 0, "%s: .debug_line address size differs from .debug_info",
++ err (0, "%s: .debug_line address size differs from .debug_info",
+ dso->filename);
+ return false;
+ }
+@@ -1297,7 +1296,7 @@
+ endprol += t->header_length;
+ if (endprol > endcu)
+ {
+- error (0, 0, "%s: .debug_line CU prologue does not fit into CU",
++ err (0, "%s: .debug_line CU prologue does not fit into CU",
+ dso->filename);
+ return false;
+ }
+@@ -1323,7 +1322,7 @@
+
+ if (ptr + t->opcode_base - 1 >= endcu)
+ {
+- error (0, 0, "%s: .debug_line opcode table does not fit into CU",
++ err (0, "%s: .debug_line opcode table does not fit into CU",
+ dso->filename);
+ return false;
+ }
+@@ -1378,7 +1377,7 @@
+
+ dso->lines.line_buf = malloc (dso->lines.debug_lines_len);
+ if (dso->lines.line_buf == NULL)
+- error (1, ENOMEM, "No memory for new .debug_line table (0x%zx bytes)",
++ err (1, "No memory for new .debug_line table (0x%zx bytes)",
+ dso->lines.debug_lines_len);
+
+ linedata->d_size = dso->lines.debug_lines_len;
+@@ -1651,7 +1650,7 @@
+ assert (len < UINT_MAX);
+ break;
+ default:
+- error (0, 0, "%s: Unknown DWARF DW_FORM_0x%x", dso->filename, *formp);
++ err (0, "%s: Unknown DWARF DW_FORM_0x%x", dso->filename, *formp);
+ return FORM_ERROR;
+ }
+
+@@ -1719,7 +1718,7 @@
+
+ if (value >= dirt_cnt)
+ {
+- error (0, 0, "%s: Wrong directory table index %u",
++ err (0, "%s: Wrong directory table index %u",
+ dso->filename, value);
+ return false;
+ }
+@@ -1743,7 +1742,7 @@
+ s = malloc (comp_dir_len + 1 + file_len + 1 + dir_len + 1);
+ if (s == NULL)
+ {
+- error (0, ENOMEM, "%s: Reading file table", dso->filename);
++ err (0, "%s: Reading file table", dso->filename);
+ return false;
+ }
+ if (*file == '/')
+@@ -1789,7 +1788,7 @@
+ {
+ ssize_t ret = write (list_file_fd, p, size);
+ if (ret == -1)
+- error (1, errno, "Could not write to '%s'", list_file);
++ err (1, "Could not write to '%s'", list_file);
+ size -= ret;
+ p += ret;
+ }
+@@ -1838,7 +1837,7 @@
+ *ndir = entry_count;
+ *dirs = malloc (entry_count * sizeof (char *));
+ if (*dirs == NULL)
+- error (1, errno, "%s: Could not allocate debug_line dirs",
++ err (1, "%s: Could not allocate debug_line dirs",
+ dso->filename);
+ }
+
+@@ -1889,7 +1888,7 @@
+ }
+ break;
+ default:
+- error (0, 0, "%s: Unsupported "
++ err (0, "%s: Unsupported "
+ ".debug_line %s %u path DW_FORM_0x%x",
+ dso->filename, entry_name, entryi, form);
+ return false;
+@@ -1914,7 +1913,7 @@
+ dirndx = do_read_32 (*ptrp);
+ break;
+ default:
+- error (0, 0, "%s: Unsupported "
++ err (0, "%s: Unsupported "
+ ".debug_line %s %u dirndx DW_FORM_0x%x",
+ dso->filename, entry_name, entryi, form);
+ return false;
+@@ -1922,7 +1921,7 @@
+
+ if (dirndx > *ndir)
+ {
+- error (0, 0, "%s: Bad dir number %u in .debug_line %s",
++ err (0, "%s: Bad dir number %u in .debug_line %s",
+ dso->filename, entryi, entry_name);
+ return false;
+ }
+@@ -1946,7 +1945,7 @@
+ case FORM_ERROR:
+ return false;
+ case FORM_INDIRECT:
+- error (0, 0, "%s: Unsupported "
++ err (0, "%s: Unsupported "
+ ".debug_line %s %u DW_FORM_indirect",
+ dso->filename, entry_name, entryi);
+ return false;
+@@ -1967,7 +1966,7 @@
+ char *s = malloc (comp_dir_len + 1 + file_len + 1 + dir_len + 1);
+ if (s == NULL)
+ {
+- error (0, ENOMEM, "%s: Reading file table", dso->filename);
++ err (0, "%s: Reading file table", dso->filename);
+ return false;
+ }
+ if (file[0] == '/')
+@@ -2013,7 +2012,7 @@
+ {
+ ssize_t ret = write (list_file_fd, p, size);
+ if (ret == -1)
+- error (1, errno, "Could not write to '%s'", list_file);
++ err (1, "Could not write to '%s'", list_file);
+ size -= ret;
+ p += ret;
+ }
+@@ -2126,7 +2125,7 @@
+ debug_section *sec = &debug_sections[line_strp
+ ? DEBUG_LINE_STR : DEBUG_STR];
+ if (sec->data == NULL || idx >= sec->size)
+- error (1, 0, "%s: Bad string pointer index %zd for comp_dir (%s)",
++ err (1, "%s: Bad string pointer index %zd for comp_dir (%s)",
+ dso->filename, idx, sec->name);
+ dir = (char *) sec->data + idx;
+
+@@ -2229,7 +2228,7 @@
+ producers will use DW_FORM_strp which is
+ more efficient. */
+ if (orig_len < new_len)
+- error (0, 0, "Warning, not replacing comp_dir "
++ err (0, "Warning, not replacing comp_dir "
+ "'%s' prefix ('%s' -> '%s') encoded as "
+ "DW_FORM_string. "
+ "Replacement too large.",
+@@ -2281,7 +2280,7 @@
+ ? DEBUG_LINE_STR
+ : DEBUG_STR];
+ if (idx >= sec->size)
+- error (1, 0,
++ err (1,
+ "%s: Bad string pointer index %zd for unit name (%s)",
+ dso->filename, idx, sec->name);
+ char *name = (char *) sec->data + idx;
+@@ -2356,7 +2355,7 @@
+ {
+ ssize_t ret = write (list_file_fd, p, size);
+ if (ret == -1)
+- error (1, errno, "Could not write to '%s'", list_file);
++ err (1, "Could not write to '%s'", list_file);
+ size -= ret;
+ p += ret;
+ }
+@@ -2370,7 +2369,7 @@
+ else
+ ret = write (list_file_fd, "", 1);
+ if (ret == -1)
+- error (1, errno, "Could not write to '%s'", list_file);
++ err (1, "Could not write to '%s'", list_file);
+ }
+ }
+ }
+@@ -2423,7 +2422,7 @@
+ /* header size, version, unit_type, ptr_size. */
+ if (ptr + 4 + 2 + 1 + 1 > endsec)
+ {
+- error (0, 0, "%s: %s CU header too small",
++ err (0, "%s: %s CU header too small",
+ dso->filename, sec->name);
+ return 1;
+ }
+@@ -2432,13 +2431,13 @@
+ endcu += read_32 (ptr);
+ if (endcu == ptr + 0xffffffff)
+ {
+- error (0, 0, "%s: 64-bit DWARF not supported", dso->filename);
++ err (0, "%s: 64-bit DWARF not supported", dso->filename);
+ return 1;
+ }
+
+ if (endcu > endsec)
+ {
+- error (0, 0, "%s: %s too small", dso->filename, sec->name);
++ err (0, "%s: %s too small", dso->filename, sec->name);
+ return 1;
+ }
+
+@@ -2446,7 +2445,7 @@
+ if (cu_version != 2 && cu_version != 3 && cu_version != 4
+ && cu_version != 5)
+ {
+- error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
++ err (0, "%s: DWARF version %d unhandled", dso->filename,
+ cu_version);
+ return 1;
+ }
+@@ -2458,7 +2457,7 @@
+ uint8_t unit_type = read_8 (ptr);
+ if (unit_type != DW_UT_compile && unit_type != DW_UT_partial)
+ {
+- error (0, 0, "%s: Unit type %u unhandled", dso->filename,
++ err (0, "%s: Unit type %u unhandled", dso->filename,
+ unit_type);
+ return 1;
+ }
+@@ -2469,7 +2468,7 @@
+ unsigned char *header_end = (cu_start + 23 + (cu_version < 5 ? 0 : 1));
+ if (header_end > endsec)
+ {
+- error (0, 0, "%s: %s CU header too small", dso->filename, sec->name);
++ err (0, "%s: %s CU header too small", dso->filename, sec->name);
+ return 1;
+ }
+
+@@ -2477,9 +2476,9 @@
+ if (value >= debug_sections[DEBUG_ABBREV].size)
+ {
+ if (debug_sections[DEBUG_ABBREV].data == NULL)
+- error (0, 0, "%s: .debug_abbrev not present", dso->filename);
++ err (0, "%s: .debug_abbrev not present", dso->filename);
+ else
+- error (0, 0, "%s: DWARF CU abbrev offset too large",
++ err (0, "%s: DWARF CU abbrev offset too large",
+ dso->filename);
+ return 1;
+ }
+@@ -2492,14 +2491,14 @@
+ ptr_size = cu_ptr_size;
+ if (ptr_size != 4 && ptr_size != 8)
+ {
+- error (0, 0, "%s: Invalid DWARF pointer size %d",
++ err (0, "%s: Invalid DWARF pointer size %d",
+ dso->filename, ptr_size);
+ return 1;
+ }
+ }
+ else if (cu_ptr_size != ptr_size)
+ {
+- error (0, 0, "%s: DWARF pointer size differs between CUs",
++ err (0, "%s: DWARF pointer size differs between CUs",
+ dso->filename);
+ return 1;
+ }
+@@ -2520,7 +2519,7 @@
+ t = htab_find_with_hash (abbrev, &tag, tag.entry);
+ if (t == NULL)
+ {
+- error (0, 0, "%s: Could not find DWARF abbreviation %d",
++ err (0, "%s: Could not find DWARF abbreviation %d",
+ dso->filename, tag.entry);
+ htab_delete (abbrev);
+ return 1;
+@@ -2592,7 +2591,7 @@
+ {
+ if (j != DEBUG_MACRO && j != DEBUG_TYPES)
+ {
+- error (0, 0, "%s: Found two copies of %s section",
++ err (0, "%s: Found two copies of %s section",
+ dso->filename, name);
+ return 1;
+ }
+@@ -2603,7 +2602,7 @@
+ struct debug_section *sec;
+ sec = calloc (sizeof (struct debug_section), 1);
+ if (sec == NULL)
+- error (1, errno,
++ err (1,
+ "%s: Could not allocate more %s sections",
+ dso->filename, name);
+ sec->name = name;
+@@ -2632,7 +2631,7 @@
+
+ if (debug_sections[j].name == NULL)
+ {
+- error (0, 0, "%s: Unknown debugging section %s",
++ err (0, "%s: Unknown debugging section %s",
+ dso->filename, name);
+ }
+ }
+@@ -2664,7 +2663,7 @@
+ multi_sec = multi_sec->next;
+ }
+ if (multi_sec == NULL)
+- error (0, 1, "No %s reloc section: %s",
++ err (0, "No %s reloc section: %s",
+ debug_sections[j].name, dso->filename);
+ }
+ else
+@@ -2690,7 +2689,7 @@
+ }
+ else
+ {
+- error (0, 0, "%s: Wrong ELF data enconding", dso->filename);
++ err (0, "%s: Wrong ELF data enconding", dso->filename);
+ return 1;
+ }
+
+@@ -2758,7 +2757,7 @@
+ rels = dso->shdr[rndx].sh_size / dso->shdr[rndx].sh_entsize;
+ rbuf = malloc (rels * sizeof (LINE_REL));
+ if (rbuf == NULL)
+- error (1, errno, "%s: Could not allocate line relocations",
++ err (1, "%s: Could not allocate line relocations",
+ dso->filename);
+
+ /* Sort them by offset into section. */
+@@ -2768,7 +2767,7 @@
+ {
+ GElf_Rela rela;
+ if (gelf_getrela (rdata, i, &rela) == NULL)
+- error (1, 0, "Couldn't get relocation: %s",
++ err (1, "Couldn't get relocation: %s",
+ elf_errmsg (-1));
+ rbuf[i].r_offset = rela.r_offset;
+ rbuf[i].ndx = i;
+@@ -2777,7 +2776,7 @@
+ {
+ GElf_Rel rel;
+ if (gelf_getrel (rdata, i, &rel) == NULL)
+- error (1, 0, "Couldn't get relocation: %s",
++ err (1, "Couldn't get relocation: %s",
+ elf_errmsg (-1));
+ rbuf[i].r_offset = rel.r_offset;
+ rbuf[i].ndx = i;
+@@ -2798,14 +2797,14 @@
+ if (rtype == SHT_RELA)
+ {
+ if (gelf_getrela (rdata, ndx, &rela) == NULL)
+- error (1, 0, "Couldn't get relocation: %s",
++ err (1, "Couldn't get relocation: %s",
+ elf_errmsg (-1));
+ r_offset = rela.r_offset;
+ }
+ else
+ {
+ if (gelf_getrel (rdata, ndx, &rel) == NULL)
+- error (1, 0, "Couldn't get relocation: %s",
++ err (1, "Couldn't get relocation: %s",
+ elf_errmsg (-1));
+ r_offset = rel.r_offset;
+ }
+@@ -2817,7 +2816,7 @@
+ lndx++;
+
+ if (lndx >= dso->lines.used)
+- error (1, 0,
++ err (1,
+ ".debug_line relocation offset out of range");
+
+ /* Offset (pointing into the line program) moves
+@@ -2831,14 +2830,14 @@
+ {
+ rela.r_offset = r_offset;
+ if (gelf_update_rela (rdata, ndx, &rela) == 0)
+- error (1, 0, "Couldn't update relocation: %s",
++ err (1, "Couldn't update relocation: %s",
+ elf_errmsg (-1));
+ }
+ else
+ {
+ rel.r_offset = r_offset;
+ if (gelf_update_rel (rdata, ndx, &rel) == 0)
+- error (1, 0, "Couldn't update relocation: %s",
++ err (1, "Couldn't update relocation: %s",
+ elf_errmsg (-1));
+ }
+ }
+@@ -2874,17 +2873,17 @@
+ macro_version = read_16 (ptr);
+ macro_flags = read_8 (ptr);
+ if (macro_version < 4 || macro_version > 5)
+- error (1, 0, "unhandled .debug_macro version: %d",
++ err (1, "unhandled .debug_macro version: %d",
+ macro_version);
+ if ((macro_flags & ~2) != 0)
+- error (1, 0, "unhandled .debug_macro flags: 0x%x",
++ err (1, "unhandled .debug_macro flags: 0x%x",
+ macro_flags);
+
+ offset_len = (macro_flags & 0x01) ? 8 : 4;
+ line_offset = (macro_flags & 0x02) ? 1 : 0;
+
+ if (offset_len != 4)
+- error (0, 1,
++ err (0,
+ "Cannot handle 8 byte macro offsets: %s",
+ dso->filename);
+
+@@ -2943,7 +2942,7 @@
+ ptr += offset_len;
+ break;
+ default:
+- error (1, 0, "Unhandled DW_MACRO op 0x%x", op);
++ err (1, "Unhandled DW_MACRO op 0x%x", op);
+ break;
+ }
+ }
+@@ -3098,26 +3097,26 @@
+ elf = elf_begin (fd, ELF_C_RDWR, NULL);
+ if (elf == NULL)
+ {
+- error (0, 0, "cannot open ELF file: %s", elf_errmsg (-1));
++ err (0, "cannot open ELF file: %s", elf_errmsg (-1));
+ goto error_out;
+ }
+
+ if (elf_kind (elf) != ELF_K_ELF)
+ {
+- error (0, 0, "\"%s\" is not an ELF file", name);
++ err (0, "\"%s\" is not an ELF file", name);
+ goto error_out;
+ }
+
+ if (gelf_getehdr (elf, &ehdr) == NULL)
+ {
+- error (0, 0, "cannot get the ELF header: %s",
++ err (0, "cannot get the ELF header: %s",
+ elf_errmsg (-1));
+ goto error_out;
+ }
+
+ if (ehdr.e_type != ET_DYN && ehdr.e_type != ET_EXEC && ehdr.e_type != ET_REL)
+ {
+- error (0, 0, "\"%s\" is not a shared library", name);
++ err (0, "\"%s\" is not a shared library", name);
+ goto error_out;
+ }
+
+@@ -3128,13 +3127,13 @@
+ + (ehdr.e_shnum + 20) * sizeof(Elf_Scn *));
+ if (!dso)
+ {
+- error (0, ENOMEM, "Could not open DSO");
++ err (0, "Could not open DSO");
+ goto error_out;
+ }
+
+ if (elf_getphdrnum (elf, &phnum) != 0)
+ {
+- error (0, 0, "Couldn't get number of phdrs: %s", elf_errmsg (-1));
++ err (0, "Couldn't get number of phdrs: %s", elf_errmsg (-1));
+ goto error_out;
+ }
+
+@@ -3187,7 +3186,7 @@
+
+ if (build_id_size != 16 && build_id_size != 20)
+ {
+- error (1, 0, "Cannot handle %Zu-byte build ID", build_id_size);
++ err (1, "Cannot handle %Zu-byte build ID", build_id_size);
+ }
+
+ int i = -1;
+@@ -3239,7 +3238,7 @@
+ if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL)
+ {
+ bad:
+- error (1, 0, "Failed to compute header checksum: %s",
++ err (1, "Failed to compute header checksum: %s",
+ elf_errmsg (elf_errno ()));
+ }
+
+@@ -3384,7 +3383,7 @@
+
+ if (optind != argc - 1)
+ {
+- error (0, 0, "Need one FILE as input");
++ err (0, "Need one FILE as input");
+ usage (argv[0], true);
+ }
+
+@@ -3392,18 +3391,18 @@
+ {
+ if (base_dir == NULL)
+ {
+- error (1, 0, "You must specify a base dir if you specify a dest dir");
++ err (1, "You must specify a base dir if you specify a dest dir");
+ }
+ }
+
+ if (build_id_seed != NULL && do_build_id == 0)
+ {
+- error (1, 0, "--build-id-seed (-s) needs --build-id (-i)");
++ err (1, "--build-id-seed (-s) needs --build-id (-i)");
+ }
+
+ if (build_id_seed != NULL && strlen (build_id_seed) < 1)
+ {
+- error (1, 0, "--build-id-seed (-s) string should be at least 1 char");
++ err (1, "--build-id-seed (-s) string should be at least 1 char");
+ }
+
+ /* Ensure clean paths, users can muck with these. Also removes any
+@@ -3422,22 +3421,22 @@
+
+ if (elf_version(EV_CURRENT) == EV_NONE)
+ {
+- error (1, 0, "library out of date");
++ err (1, "library out of date");
+ }
+
+ if (stat(file, &stat_buf) < 0)
+ {
+- error (1, errno, "Failed to open input file '%s'", file);
++ err (1, "Failed to open input file '%s'", file);
+ }
+
+ /* Make sure we can read and write */
+ if (chmod (file, stat_buf.st_mode | S_IRUSR | S_IWUSR) != 0)
+- error (0, errno, "Failed to chmod input file '%s' to make sure we can read and write", file);
++ err (0, "Failed to chmod input file '%s' to make sure we can read and write", file);
+
+ fd = open (file, O_RDWR);
+ if (fd < 0)
+ {
+- error (1, errno, "Failed to open input file '%s'", file);
++ err (1, "Failed to open input file '%s'", file);
+ }
+
+ dso = fdopen_dso (fd, file);
+@@ -3465,7 +3464,7 @@
+ /* TODO: Handle stabs */
+ if (strcmp (name, ".stab") == 0)
+ {
+- error (0, 0, "Stabs debuginfo not supported: %s", file);
++ err (0, "Stabs debuginfo not supported: %s", file);
+ break;
+ }
+ if (!(do_build_id && no_recompute_build_id && !base_dir && !dest_dir)
+@@ -3542,7 +3541,7 @@
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ if (shdr == NULL)
+- error (1, 0, "Couldn't get shdr: %s", elf_errmsg (-1));
++ err (1, "Couldn't get shdr: %s", elf_errmsg (-1));
+
+ /* Any sections we have changed aren't allocated sections,
+ so we don't need to lookup any changed section sizes. */
+@@ -3562,7 +3561,7 @@
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ if (shdr == NULL)
+- error (1, 0, "Couldn't get shdr: %s", elf_errmsg (-1));
++ err (1, "Couldn't get shdr: %s", elf_errmsg (-1));
+
+ /* A bug in elfutils before 0.169 means we have to write out
+ all section data, even when nothing changed.
+@@ -3611,7 +3610,7 @@
+ shdr->sh_size = sec_size;
+ shdr->sh_offset = sec_offset;
+ if (gelf_update_shdr (scn, shdr) == 0)
+- error (1, 0, "Couldn't update shdr: %s",
++ err (1, "Couldn't update shdr: %s",
+ elf_errmsg (-1));
+ }
+ }
+@@ -3625,13 +3624,13 @@
+ {
+ dso->ehdr.e_shoff = new_offset;
+ if (gelf_update_ehdr (elf, &dso->ehdr) == 0)
+- error (1, 0, "Couldn't update ehdr: %s", elf_errmsg (-1));
++ err (1, "Couldn't update ehdr: %s", elf_errmsg (-1));
+ }
+ }
+
+ if (elf_update (dso->elf, ELF_C_NULL) < 0)
+ {
+- error (1, 0, "Failed to update file: %s", elf_errmsg (elf_errno ()));
++ err (1, "Failed to update file: %s", elf_errmsg (elf_errno ()));
+ }
+
+ if (do_build_id && build_id != NULL)
+@@ -3639,17 +3638,17 @@
+
+ if (elf_update (dso->elf, ELF_C_WRITE) < 0)
+ {
+- error (1, 0, "Failed to write file: %s", elf_errmsg (elf_errno()));
++ err (1, "Failed to write file: %s", elf_errmsg (elf_errno()));
+ }
+ if (elf_end (dso->elf) < 0)
+ {
+- error (1, 0, "elf_end failed: %s", elf_errmsg (elf_errno()));
++ err (1, "elf_end failed: %s", elf_errmsg (elf_errno()));
+ }
+ close (fd);
+
+ /* Restore old access rights */
+ if (chmod (file, stat_buf.st_mode) != 0)
+- error (0, errno, "Failed to chmod input file '%s' to restore old access rights", file);
++ err (0, "Failed to chmod input file '%s' to restore old access rights", file);
+
+ free ((char *) dso->filename);
+ destroy_strings (&dso->debug_str);