Accepting request 863768 from devel:tools

OBS-URL: https://build.opensuse.org/request/show/863768
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/oprofile?expand=0&rev=55
This commit is contained in:
Dominique Leuenberger 2021-01-18 10:28:56 +00:00 committed by Git OBS Bridge
commit 903b6b53bf
6 changed files with 18 additions and 213 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:95ded8bde1ec39922f0af015981a67aec63e025a501e4dc04cd65d38f73647e6
size 1547258

3
oprofile-1.4.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7ba06f99d7c188389d20d1d5e53ee690c7733f87aa9af62bd664fa0ca235a412
size 1557625

View File

@ -1,166 +0,0 @@
From 377610414fb6cd7ac30e4485d9d6482fcf29aca6 Mon Sep 17 00:00:00 2001
From: William Cohen <wcohen@redhat.com>
Date: Wed, 18 Mar 2020 21:19:16 -0400
Subject: [PATCH] Macro wrappers to handle the binutils 2.34 api changes
Changes in binutils 2.34 API prevented oprofile from compiling with
it. This patch tests for the changes in the binutils API during
configuration and selects the appropiate wrappers to allow oprofile to
compile. This allows oprofile to compile with both older and newer
versions of binutils.
---
configure.ac | 20 ++++++++++++++++++++
libutil++/bfd_support.cpp | 11 ++++++-----
libutil/op_bfd_wrappers.h | 28 ++++++++++++++++++++++++++++
opjitconv/create_bfd.c | 7 ++++---
4 files changed, 58 insertions(+), 8 deletions(-)
create mode 100644 libutil/op_bfd_wrappers.h
diff --git a/configure.ac b/configure.ac
index ac2fd35e..df032a78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -224,6 +224,26 @@ if test "$host_cpu" = "powerpc64le" -o "$host_cpu" = "powerpc64"; then
fi
AC_SUBST(PFM_LIB)
+HAVE_BINUTILS_234='1'
+AC_MSG_CHECKING([whether binutils 2.34 is being used])
+rm -f test-for-BINUTILS
+AC_LANG_CONFTEST(
+ [AC_LANG_PROGRAM([[#include <bfd.h>]],
+ [[asection * sect;
+ bfd_size_type buildid_sect_size = bfd_section_size(sect);
+ return 0;]])
+ ])
+$CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS $PERF_EVENT_FLAGS -o test-for-BINUTILS > /dev/null 2>&1
+if test -f test-for-BINUTILS; then
+ echo "yes"
+ HAVE_BINUTILS_234='1'
+else
+ echo "no"
+ HAVE_BINUTILS_234='0'
+fi
+AC_DEFINE_UNQUOTED(HAVE_BINUTILS_234, $HAVE_BINUTILS_234, [Using binutils 2.34])
+rm -f test-for-BINUTILS*
+
AC_ARG_WITH(java,
[ --with-java=java-home Path to Java home directory (default is "no"; "yes" will use /usr as Java home)],
JAVA_HOMEDIR=$with_java, [with_java=no])
diff --git a/libutil++/bfd_support.cpp b/libutil++/bfd_support.cpp
index fa904839..cd0f4f71 100644
--- a/libutil++/bfd_support.cpp
+++ b/libutil++/bfd_support.cpp
@@ -19,6 +19,7 @@
#include "locate_images.h"
#include "op_libiberty.h"
#include "op_exception.h"
+#include "op_bfd_wrappers.h"
#include <unistd.h>
#include <errno.h>
@@ -137,7 +138,7 @@ static bool get_build_id(bfd * ibfd, unsigned char * build_id)
}
}
- bfd_size_type buildid_sect_size = bfd_section_size(ibfd, sect);
+ bfd_size_type buildid_sect_size = op_bfd_section_size(ibfd, sect);
char * contents = (char *) xmalloc(buildid_sect_size);
errno = 0;
if (!bfd_get_section_contents(ibfd, sect,
@@ -188,7 +189,7 @@ bool get_debug_link_info(bfd * ibfd, string & filename, unsigned long & crc32)
if (sect == NULL)
return false;
- bfd_size_type debuglink_size = bfd_section_size(ibfd, sect);
+ bfd_size_type debuglink_size = op_bfd_section_size(ibfd, sect);
char * contents = (char *) xmalloc(debuglink_size);
cverb << vbfd
<< ".gnu_debuglink section has size " << debuglink_size << endl;
@@ -346,7 +347,7 @@ void fixup_linenr(bfd * abfd, asection * section, asymbol ** syms,
// first restrict the search on a sensible range of vma, 16 is
// an intuitive value based on epilog code look
size_t max_search = 16;
- size_t section_size = bfd_section_size(abfd, section);
+ size_t section_size = op_bfd_section_size(abfd, section);
if (pc + max_search > section_size)
max_search = section_size - pc;
@@ -819,10 +820,10 @@ find_nearest_line(bfd_info const & b, op_bfd_symbol const & sym,
else
pc = (sym.value() + offset) - sym.filepos();
- if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
+ if ((op_bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
goto fail;
- if (pc >= bfd_section_size(abfd, section))
+ if (pc >= op_bfd_section_size(abfd, section))
goto fail;
ret = bfd_find_nearest_line(abfd, section, syms, pc, &cfilename,
diff --git a/libutil/op_bfd_wrappers.h b/libutil/op_bfd_wrappers.h
new file mode 100644
index 00000000..b229cc12
--- /dev/null
+++ b/libutil/op_bfd_wrappers.h
@@ -0,0 +1,28 @@
+/**
+ * @file op_bfd_wrappers.h
+ * Wrappers to hide API changes in binutils 2.34
+ *
+ * @remark Copyright 2020 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author William Cohen
+ */
+
+#ifndef OP_BFD_WRAPPERS_H
+#define OP_BFD_WRAPPERS_H
+
+#if HAVE_BINUTILS_234
+#define op_bfd_section_size(ibfd, sec) bfd_section_size(sec)
+#define op_bfd_get_section_flags(abfd, sec) bfd_section_flags(sec)
+#define op_bfd_set_section_flags(abfd, sec, flags) bfd_set_section_flags(sec, flags)
+#define op_bfd_set_section_vma(abfd, sec, vma) bfd_set_section_vma(sec, vma)
+#define op_bfd_set_section_size(abfd, sec, size) bfd_set_section_size(sec, size)
+#else
+#define op_bfd_section_size(ibfd, sec) bfd_section_size(ibfd, sec)
+#define op_bfd_get_section_flags(abfd, sec) bfd_get_section_flags(abfd, sec)
+#define op_bfd_set_section_flags(abfd, sec, flags) bfd_set_section_flags(abfd, sec, flags)
+#define op_bfd_set_section_vma(abfd, sec, vma) bfd_set_section_vma(abfd, sec, vma)
+#define op_bfd_set_section_size(abfd, sec, size) bfd_set_section_size(abfd, sec, size)
+#endif
+
+#endif /* !OP_BFD_WRAPPERS_H */
diff --git a/opjitconv/create_bfd.c b/opjitconv/create_bfd.c
index 48db143b..da1e6d29 100644
--- a/opjitconv/create_bfd.c
+++ b/opjitconv/create_bfd.c
@@ -16,6 +16,7 @@
#include "opjitconv.h"
#include "op_libiberty.h"
+#include "op_bfd_wrappers.h"
#include <bfd.h>
#include <assert.h>
@@ -86,12 +87,12 @@ asection * create_section(bfd * abfd, char const * section_name,
bfd_perror("bfd_make_section");
goto error;
}
- bfd_set_section_vma(abfd, section, vma);
- if (bfd_set_section_size(abfd, section, size) == FALSE) {
+ op_bfd_set_section_vma(abfd, section, vma);
+ if (op_bfd_set_section_size(abfd, section, size) == FALSE) {
bfd_perror("bfd_set_section_size");
goto error;
}
- if (bfd_set_section_flags(abfd, section, flags) == FALSE) {
+ if (op_bfd_set_section_flags(abfd, section, flags) == FALSE) {
bfd_perror("bfd_set_section_flags");
goto error;
}
--
2.26.0

View File

@ -1,38 +0,0 @@
From: William Cohen <wcohen@redhat.com>
Date: Fri Aug 3 10:10:12 2018 -0400
Subject: Handle empty event name spec gracefully for PPC
Git-commit 457d33de89939ffaa523c2a6377ed7d1506ce255
References: none
Signed-off-by: Tony Jones <tonyj@suse.de>
Handle empty event name spec gracefully for PPC
During testing Michael Petlan found that the giving an empty event
name in the event spec to operf on PPC machines would cause operf
crash. Running the following following command would demonstrate
this problem:
operf -e : /bin/ls
The problem was traced to event_name in _handle_powerpc_event_spec
function having a length of 0. The strncmp using event_name in
_handle_powerpc_event_spec would indicate a match and cause strncpy to
be called to copy zero bytes. The zero length strncpy would crash
operf. Added a check to make ensure that the string is non-zero
length.
Signed-off-by: William Cohen <wcohen@redhat.com>
diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp
index f9638c77..2cae7840 100644
--- a/libpe_utils/op_pe_utils.cpp
+++ b/libpe_utils/op_pe_utils.cpp
@@ -588,7 +588,7 @@ static string _handle_powerpc_event_spec(string event_spec)
}
if (line[0] == ' ' || line[0] == '\t')
continue;
- if (!strncmp(line, event_name, evt_name_len)) {
+ if (evt_name_len && !strncmp(line, event_name, evt_name_len)) {
// Found a potential match. Check if it's a perfect match.
string save_event_name = event_name;
size_t full_evt_len = index(line, ':') - line;

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Sat Jan 16 18:21:11 UTC 2021 - Dirk Müller <dmueller@suse.com>
- update to 1.4.0:
* New/updated Processor Support
* Marvell (Cavium) ThunderX2
* Hygon Dhyana CPU
* Bugfixes
* Does not build with binutils-gdb master.
* ocount leaves orphan process on error
- remove oprofile-handle-empty-event-name-spec-gracefully-for-ppc.patch,
oprofile-handle-binutils-2_34.patch: upstream
-------------------------------------------------------------------
Tue Oct 13 10:06:24 UTC 2020 - Jan Engelhardt <jengelh@inai.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package oprofile
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,7 @@
Name: oprofile
Version: 1.3.0
Version: 1.4.0
Release: 0
Summary: System-Wide Profiler for Linux Systems
License: GPL-2.0-or-later AND LGPL-2.1-or-later
@ -30,9 +30,6 @@ Source4: jvmpi.h
Source5: README-BEFORE-ADDING-PATCHES
Patch1: %{name}-no-libjvm-version.patch
Patch2: %{name}-pfm-ppc.patch
Patch3: %{name}-handle-empty-event-name-spec-gracefully-for-ppc.patch
# PATCH-FIX-UPSTREAM
Patch4: %{name}-handle-binutils-2_34.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: binutils-devel
@ -106,7 +103,6 @@ from supported virtual machines.
mkdir -p java/include
# copy files necessary to build Java agent libraries
# libjvmpi_oprofile.so and libjvmti_oprofile.so
# %S:4 is rpm speak for Source4 (jvmpi.h)
ln -s %{_libdir}/jvm/java/include/* java/include
test -f java/include/jvmpi.h || ln -s %{SOURCE4} java/include