aboutsummaryrefslogtreecommitdiffstats
path: root/main/elfutils/musl-qsort_r.patch
blob: 0843aec6485927f2925b5d0337159f12cace9a85 (plain) (blame)
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
diff --git a/src/readelf.c b/src/readelf.c
index cbb519d..dea513b 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -4829,10 +4829,11 @@ listptr_base (struct listptr *p)
   return cudie_base (&cu);
 }
 
+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;
 
@@ -4848,21 +4849,21 @@ compare_listptr (const void *a, const void *b, void *arg)
 	  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);
 	}
       if (p1->attr != p2 ->attr)
 	{
@@ -4870,7 +4871,7 @@ compare_listptr (const void *a, const void *b, void *arg)
 	  error (0, 0,
 		 gettext ("%s %#" PRIx64
 			  " used with different attribute %s and %s"),
-		 name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr),
+		 listptr_name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr),
 		 dwarf_attr_name (p2->attr));
 	}
     }
@@ -4941,9 +4942,11 @@ notice_listptr (enum section_e section, struct listptr_table *table,
 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