valgrind-dont-include-a-out-header.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Add replacement for <a.out.h>
  2. Valgrind includes <a.out.h> to get the definition of 'struct
  3. nlist'. However, while glibc directly defines 'struct nlist' in
  4. <a.out.h>, uClibc relies on it being defined by kernel headers (i.e
  5. <a.out.h> simply includes <linux/a.out.h>). This works for most
  6. architectures, but not for PowerPC, on which the a.out binary format
  7. has never been supported, and therefore the <linux/a.out.h> kernel
  8. header does not exist.
  9. One solution would have been to use the <nlist.h> header, but this one
  10. is only available in glibc, and it also has a slightly different
  11. definition than the one in <a.out.h>. So, for the time being, the
  12. easiest solution is to just replace the #include <a.out.h> in Valgrind
  13. code by a copy/paste of the 'struct nlist' definition.
  14. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  15. Index: b/coregrind/m_debuginfo/readstabs.c
  16. ===================================================================
  17. --- a/coregrind/m_debuginfo/readstabs.c
  18. +++ b/coregrind/m_debuginfo/readstabs.c
  19. @@ -53,7 +53,21 @@
  20. /* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
  21. #if defined(VGO_linux)
  22. -# include <a.out.h> /* stabs defns */
  23. +/* Copied from a.out.h, because it is otherwise not available on
  24. + PowerPC/uClibc */
  25. +struct nlist
  26. +{
  27. + union
  28. + {
  29. + char *n_name;
  30. + struct nlist *n_next;
  31. + long n_strx;
  32. + } n_un;
  33. + unsigned char n_type;
  34. + char n_other;
  35. + short n_desc;
  36. + unsigned long n_value;
  37. +};
  38. #elif defined(VGO_darwin)
  39. # include <mach-o/nlist.h>
  40. # define n_other n_sect