kumquat-buildroot/package/oprofile/oprofile-002-Fix-compile-error-on-ppc-uClibc-platform-AT_BASE_PLA.patch

79 lines
2.6 KiB
Diff
Raw Normal View History

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 http://sourceforge.net/p/oprofile/oprofile/ci/fcb818623bf1a638ef4f93dca9e90f8651899bf3/ oprofile-003-oprofile-ppc32-build-fix.patch http://sourceforge.net/p/oprofile/oprofile/ci/fa889ea74b6b931e241a8cd57e90edc23cd7ab03/ oprofile-004-fix-ppc64-specific-libpfm-usage.patch http://sourceforge.net/p/oprofile/oprofile/ci/79a183ed0d9611955714bfa1d6edb361d6bf5c2c/ oprofile-005-fix-up-configure-to-handle-architectures-that-do-not.patch http://sourceforge.net/p/oprofile/oprofile/ci/ca6d916a6f8f0f8abbb4c9b6a97dd1a1615bb124/ 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 http://sourceforge.net/p/oprofile/oprofile/ci/08241f1b2c5a4d48020c82b509dc1076f51bf0bd/ 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-05-20 16:54:36 +02:00
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