void-packages/srcpkgs/elfutils/patches/musl-qsort_r.patch

57 lines
1.5 KiB
Diff

--- src/readelf.c 2015-10-12 12:22:58.000000000 +0200
+++ src/readelf.c 2015-11-20 08:11:32.945159213 +0100
@@ -4366,10 +4366,11 @@
return base;
}
+static const char *listptr_name;
+
static int
-compare_listptr (const void *a, const void *b, void *arg)
+compare_listptr (const void *a, const void *b)
{
- const char *name = arg;
struct listptr *p1 = (void *) a;
struct listptr *p2 = (void *) b;
@@ -4385,21 +4386,21 @@
p1->warned = p2->warned = true;
error (0, 0,
gettext ("%s %#" PRIx64 " used with different address sizes"),
- name, (uint64_t) p1->offset);
+ listptr_name, (uint64_t) p1->offset);
}
if (p1->dwarf64 != p2->dwarf64)
{
p1->warned = p2->warned = true;
error (0, 0,
gettext ("%s %#" PRIx64 " used with different offset sizes"),
- name, (uint64_t) p1->offset);
+ listptr_name, (uint64_t) p1->offset);
}
if (listptr_base (p1) != listptr_base (p2))
{
p1->warned = p2->warned = true;
error (0, 0,
gettext ("%s %#" PRIx64 " used with different base addresses"),
- name, (uint64_t) p1->offset);
+ listptr_name, (uint64_t) p1->offset);
}
}
@@ -4464,9 +4465,11 @@
static void
sort_listptr (struct listptr_table *table, const char *name)
{
- if (table->n > 0)
- qsort_r (table->table, table->n, sizeof table->table[0],
- &compare_listptr, (void *) name);
+ if (table->n > 0) {
+ listptr_name = name;
+ qsort (table->table, table->n, sizeof table->table[0],
+ &compare_listptr);
+ }
}
static bool