aboutsummaryrefslogtreecommitdiffstats
path: root/main/elfutils/musl-qsort_r.patch
blob: e1455baf6918ad77fdcf0ee6c8bed8cafae180d0 (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
--- a/src/readelf.c	2015-10-12 12:22:58.000000000 +0200
+++ b/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