kumquat-buildroot/package/oprofile/oprofile-002-Fix-compile-error-on-ppc-uClibc-platform-AT_BASE_PLA.patch
Alexey Brodkin 8ad6acc029 oprofile: bump to version 0.9.9
Relese notes for 0.9.9 release are avaialble here:
http://oprofile.sourceforge.net/release-notes/oprofile-0.9.9

This release adds support for ARC architecture.

Also introduces new "ocount" program for collection of raw event counts.

With release of 0.9.9 we may drop back-ported patches:
oprofile-002-no-query-modules.patch - liblegacy was removed since 2.4 kernels
are no longer supported
fcb818623b/

oprofile-003-oprofile-ppc32-build-fix.patch
fa889ea74b/

oprofile-004-fix-ppc64-specific-libpfm-usage.patch
79a183ed0d/

oprofile-005-fix-up-configure-to-handle-architectures-that-do-not.patch
ca6d916a6f/

But in 0.9.9 was introduced build breakage which was fixed later so adding
another back-ported patch
oprofile-002-Fix-compile-error-on-ppc-uClibc-platform-AT_BASE_PLA.patch
08241f1b2c/

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Cc: Simon Dawson <spdawson@gmail.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-06-03 23:34:26 +02:00

79 lines
2.6 KiB
Diff

Upstream-Status: Backport
From 08241f1b2c5a4d48020c82b509dc1076f51bf0bd Mon Sep 17 00:00:00 2001
From: Maynard Johnson <maynardj@us.ibm.com>
Date: Wed, 14 Aug 2013 15:40:44 -0500
Subject: [PATCH] Fix compile error on ppc/uClibc platform: 'AT_BASE_PLATFORM'
undeclared'
This issue was reported via bug #245.
The method for obtaining cpu type on the ppc64 platform was recently
modified to detect the case when we're running on a kernel that has
not been updated to recognize the native processor type. The cpu
type returned in the case where the native processor type is newer
than POWER7 will be "CPU_PPC64_ARCH_V1" (architected CPU type).
The method used for detecting when the kernel does not recognize the
native processor type is to inspect the aux vector and compare
AT_PLATFORM and AT_BASE_PLATFORM. The 'AT_BASE_PLATFORM' was defined
in glibc's elf.h around 5 years ago, but was never added to uClibc,
so the code that implements the above-described method fails to compile
on systems using uClibc.
Since the above-described method of using the aux vector is only
required for ppc64 systems, and ppc64-based platforms always use glibc
(which has the AT_BASE_PLATFORM macro defined), we now wrap that code
with '#if PPC64_ARCH' to prevent problems on other architectures.
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
---
libop/op_cpu_type.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
index 44d6809..89d5a92 100644
--- a/libop/op_cpu_type.c
+++ b/libop/op_cpu_type.c
@@ -23,9 +23,16 @@
#include <elf.h>
#include <link.h>
+#include "config.h"
#include "op_cpu_type.h"
#include "op_hw_specific.h"
+/* A macro to be used for ppc64 architecture-specific code. The '__powerpc__' macro
+ * is defined for both ppc64 and ppc32 architectures, so we must further qualify by
+ * including the 'HAVE_LIBPFM' macro, since that macro will be defined only for ppc64.
+ */
+#define PPC64_ARCH (HAVE_LIBPFM) && ((defined(__powerpc__) || defined(__powerpc64__)))
+
struct cpu_descr {
char const * pretty;
char const * name;
@@ -176,6 +183,7 @@ static char * _get_cpuinfo_cpu_type(char * buf, int len, const char * prefix)
return _get_cpuinfo_cpu_type_line(buf, len, prefix, 1);
}
+#if PPC64_ARCH
// The aux vector stuff below is currently only used by ppc64 arch
static ElfW(auxv_t) * auxv_buf = NULL;
@@ -312,6 +320,13 @@ static op_cpu _get_ppc64_cpu_type(void)
cpu_type = op_get_cpu_number(cpu_type_str);
return cpu_type;
}
+#else
+static op_cpu _get_ppc64_cpu_type(void)
+{
+ return CPU_NO_GOOD;
+}
+#endif
+
static op_cpu _get_arm_cpu_type(void)
{
--
1.9.0