Legacy code was dropped in the new version, so we don't need patch for
that anymore.

On the other hand a new compiling bug appeared, see:
https://sourceforge.net/p/oprofile/bugs/245/
It's related to the uClibc, so we need a workaround for it (it was
cherry-picked from the master).

Signed-off-by: Rafał Miłecki <zaj...@gmail.com>
---
V2: use a workaround from oprofile's master branch

Felix: could you push this patch?
---
 package/devel/oprofile/Makefile                    |    6 +-
 .../0001-Use-insmod-instead-of-modprobe.patch      |   25 +++++++
 ...-error-on-ppc-uClibc-platform-AT_BASE_PLA.patch |   76 ++++++++++++++++++++
 .../100-use_insmod_instead_of_modprobe.patch       |   20 ------
 .../oprofile/patches/101-remove_24_support.patch   |   64 -----------------
 5 files changed, 104 insertions(+), 87 deletions(-)
 create mode 100644 
package/devel/oprofile/patches/0001-Use-insmod-instead-of-modprobe.patch
 create mode 100644 
package/devel/oprofile/patches/0002-Fix-compile-error-on-ppc-uClibc-platform-AT_BASE_PLA.patch
 delete mode 100644 
package/devel/oprofile/patches/100-use_insmod_instead_of_modprobe.patch
 delete mode 100644 package/devel/oprofile/patches/101-remove_24_support.patch

diff --git a/package/devel/oprofile/Makefile b/package/devel/oprofile/Makefile
index 884c54b..f69b3ec 100644
--- a/package/devel/oprofile/Makefile
+++ b/package/devel/oprofile/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=oprofile
-PKG_VERSION:=0.9.7
+PKG_VERSION:=0.9.9
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/oprofile/
-PKG_MD5SUM:=8b5d1d9b65f84420bcc3234777ad3be3
+PKG_MD5SUM:=00aec1287da2dfffda17a9b1c0a01868
 
 PKG_MAINTAINER:=Felix Fietkau <n...@openwrt.org>
 
@@ -30,7 +30,7 @@ define Package/oprofile
   CATEGORY:=Development
   TITLE:=OProfile System Profiler
   URL:=http://oprofile.sourceforge.net
-  DEPENDS:=+libpopt +kmod-oprofile +libstdcpp +objdump
+  DEPENDS:=+libpopt +librt +kmod-oprofile +libstdcpp +objdump
 endef
 
 define Package/oprofile/description
diff --git 
a/package/devel/oprofile/patches/0001-Use-insmod-instead-of-modprobe.patch 
b/package/devel/oprofile/patches/0001-Use-insmod-instead-of-modprobe.patch
new file mode 100644
index 0000000..b5745e0
--- /dev/null
+++ b/package/devel/oprofile/patches/0001-Use-insmod-instead-of-modprobe.patch
@@ -0,0 +1,25 @@
+From 23b8f78de0860d6ba4cfe5425a3066ab9c2040bc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zaj...@gmail.com>
+Date: Thu, 8 Aug 2013 19:48:25 +0200
+Subject: [PATCH] Use insmod instead of modprobe
+
+---
+ utils/opcontrol |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/utils/opcontrol b/utils/opcontrol
+index 38bb1ac..cbd51d4 100644
+--- a/utils/opcontrol
++++ b/utils/opcontrol
+@@ -249,7 +249,7 @@ load_module_26()
+ {
+       grep oprofilefs /proc/filesystems >/dev/null
+       if test "$?" -ne 0; then
+-              modprobe oprofile
++              insmod oprofile
+               if test "$?" != "0"; then
+                       # couldn't load the module
+                       return
+-- 
+1.7.10.4
+
diff --git 
a/package/devel/oprofile/patches/0002-Fix-compile-error-on-ppc-uClibc-platform-AT_BASE_PLA.patch
 
b/package/devel/oprofile/patches/0002-Fix-compile-error-on-ppc-uClibc-platform-AT_BASE_PLA.patch
new file mode 100644
index 0000000..fda246c
--- /dev/null
+++ 
b/package/devel/oprofile/patches/0002-Fix-compile-error-on-ppc-uClibc-platform-AT_BASE_PLA.patch
@@ -0,0 +1,76 @@
+From 08241f1b2c5a4d48020c82b509dc1076f51bf0bd Mon Sep 17 00:00:00 2001
+From: Maynard Johnson <mayna...@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 <mayna...@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.7.10.4
+
diff --git 
a/package/devel/oprofile/patches/100-use_insmod_instead_of_modprobe.patch 
b/package/devel/oprofile/patches/100-use_insmod_instead_of_modprobe.patch
deleted file mode 100644
index 1010798..0000000
--- a/package/devel/oprofile/patches/100-use_insmod_instead_of_modprobe.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/utils/opcontrol
-+++ b/utils/opcontrol
-@@ -248,7 +248,7 @@ load_module_26()
- {
-       grep oprofilefs /proc/filesystems >/dev/null
-       if test "$?" -ne 0; then
--              modprobe oprofile
-+              insmod oprofile
-               if test "$?" != "0"; then
-                       # couldn't load the module
-                       return
-@@ -278,7 +278,7 @@ load_module_24()
- {
-       grep oprof /proc/devices >/dev/null
-       if test "$?" -ne 0; then
--              modprobe oprofile
-+              insmod oprofile
-               if test "$?" != "0"; then
-                       # couldn't load a module
-                       return
diff --git a/package/devel/oprofile/patches/101-remove_24_support.patch 
b/package/devel/oprofile/patches/101-remove_24_support.patch
deleted file mode 100644
index 99eb928..0000000
--- a/package/devel/oprofile/patches/101-remove_24_support.patch
+++ /dev/null
@@ -1,64 +0,0 @@
---- a/daemon/Makefile.am
-+++ b/daemon/Makefile.am
-@@ -1,4 +1,4 @@
--SUBDIRS = liblegacy .
-+SUBDIRS = .
- 
- oprofiled_SOURCES = \
-       init.c \
-@@ -49,7 +49,6 @@ AM_CFLAGS = @OP_CFLAGS@ -fno-omit-frame-
- bin_PROGRAMS = oprofiled
- 
- oprofiled_LDADD = \
--      liblegacy/liblegacy.a \
-       ../libabi/libabi.a \
-       ../libdb/libodb.a \
-       ../libop/libop.a \
---- a/daemon/Makefile.in
-+++ b/daemon/Makefile.in
-@@ -70,7 +70,7 @@ am_oprofiled_OBJECTS = init.$(OBJEXT) op
-       opd_extended.$(OBJEXT) opd_ibs.$(OBJEXT) \
-       opd_ibs_trans.$(OBJEXT)
- oprofiled_OBJECTS = $(am_oprofiled_OBJECTS)
--oprofiled_DEPENDENCIES = liblegacy/liblegacy.a ../libabi/libabi.a \
-+oprofiled_DEPENDENCIES = ../libabi/libabi.a \
-       ../libdb/libodb.a ../libop/libop.a ../libutil/libutil.a
- DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
- depcomp = $(SHELL) $(top_srcdir)/depcomp
-@@ -285,7 +285,7 @@ top_build_prefix = @top_build_prefix@
- top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
- topdir = @topdir@
--SUBDIRS = liblegacy .
-+SUBDIRS = .
- oprofiled_SOURCES = \
-       init.c \
-       oprofiled.c \
-@@ -331,7 +331,6 @@ AM_CPPFLAGS = \
- # -fno-omit-frame-pointer needed for daemon build: see ChangeLog-2004 02-23
- AM_CFLAGS = @OP_CFLAGS@ -fno-omit-frame-pointer
- oprofiled_LDADD = \
--      liblegacy/liblegacy.a \
-       ../libabi/libabi.a \
-       ../libdb/libodb.a \
-       ../libop/libop.a \
---- a/daemon/oprofiled.c
-+++ b/daemon/oprofiled.c
-@@ -77,7 +77,6 @@ static char * events;
- static char * ext_feature;
- static int showvers;
- static struct oprofiled_ops * opd_ops;
--extern struct oprofiled_ops opd_24_ops;
- extern struct oprofiled_ops opd_26_ops;
- 
- #define OPD_IMAGE_FILTER_HASH_SIZE 32
-@@ -477,9 +476,6 @@ static void opd_options(int argc, char c
- static struct oprofiled_ops * get_ops(void)
- {
-       switch (op_get_interface()) {
--              case OP_INTERFACE_24:
--                      printf("Using 2.4 OProfile kernel interface.\n");
--                      return &opd_24_ops;
-               case OP_INTERFACE_26:
-                       printf("Using 2.6+ OProfile kernel interface.\n");
-                       return &opd_26_ops;
-- 
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to