aboutsummaryrefslogtreecommitdiffstats
path: root/package/valgrind/valgrind-dont-include-a-out-header.patch
blob: 2afd44a886c355f67fb4d87d37bd4e0dc2e97d23 (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
Add replacement for <a.out.h>

Valgrind includes <a.out.h> to get the definition of 'struct
nlist'. However, while glibc directly defines 'struct nlist' in
<a.out.h>, uClibc relies on it being defined by kernel headers (i.e
<a.out.h> simply includes <linux/a.out.h>). This works for most
architectures, but not for PowerPC, on which the a.out binary format
has never been supported, and therefore the <linux/a.out.h> kernel
header does not exist.

One solution would have been to use the <nlist.h> header, but this one
is only available in glibc, and it also has a slightly different
definition than the one in <a.out.h>. So, for the time being, the
easiest solution is to just replace the #include <a.out.h> in Valgrind
code by a copy/paste of the 'struct nlist' definition.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Index: b/coregrind/m_debuginfo/readstabs.c
===================================================================
--- a/coregrind/m_debuginfo/readstabs.c
+++ b/coregrind/m_debuginfo/readstabs.c
@@ -53,7 +53,21 @@
 
 /* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
 #if defined(VGO_linux)
-#  include <a.out.h> /* stabs defns */
+/* Copied from a.out.h, because it is otherwise not available on
+   PowerPC/uClibc */
+struct nlist
+{
+  union
+    {
+      char *n_name;
+      struct nlist *n_next;
+      long n_strx;
+    } n_un;
+  unsigned char n_type;
+  char n_other;
+  short n_desc;
+  unsigned long n_value;
+};
 #elif defined(VGO_darwin)
 #  include <mach-o/nlist.h>
 #  define n_other n_sect