patch-libop_op_cpu_type_c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --- oprofile-0.9.9.orig/libop/op_cpu_type.c 2013-07-29 17:55:07.000000000 +0200
  2. +++ oprofile-0.9.9/libop/op_cpu_type.c 2013-11-05 20:55:54.000000000 +0100
  3. @@ -23,9 +23,17 @@
  4. #include <elf.h>
  5. #include <link.h>
  6. +#include "config.h"
  7. #include "op_cpu_type.h"
  8. #include "op_hw_specific.h"
  9. +
  10. +/* A macro to be used for ppc64 architecture-specific code. The '__powerpc__' macro
  11. + * is defined for both ppc64 and ppc32 architectures, so we must further qualify by
  12. + * including the 'HAVE_LIBPFM' macro, since that macro will be defined only for ppc64.
  13. + */
  14. +#define PPC64_ARCH (HAVE_LIBPFM) && ((defined(__powerpc__) || defined(__powerpc64__)))
  15. +
  16. struct cpu_descr {
  17. char const * pretty;
  18. char const * name;
  19. @@ -176,6 +184,7 @@ static char * _get_cpuinfo_cpu_type(char
  20. return _get_cpuinfo_cpu_type_line(buf, len, prefix, 1);
  21. }
  22. +#if PPC64_ARCH
  23. // The aux vector stuff below is currently only used by ppc64 arch
  24. static ElfW(auxv_t) * auxv_buf = NULL;
  25. @@ -313,6 +322,13 @@ static op_cpu _get_ppc64_cpu_type(void)
  26. return cpu_type;
  27. }
  28. +#else
  29. +static op_cpu _get_ppc64_cpu_type(void)
  30. +{
  31. + return CPU_NO_GOOD;
  32. +}
  33. +#endif
  34. +
  35. static op_cpu _get_arm_cpu_type(void)
  36. {
  37. unsigned long cpuid, vendorid;